DEV Community

Miguel Branco
Miguel Branco

Posted on

MXCP: Build Your Own Enterprise-Grade MCP Server

We've open-sourced MXCP, a framework for building secure, testable MCP servers using YAML, SQL, and Python. It’s designed for teams that want to expose operational data to LLMs without giving up control over security, data quality, or governance.

MXCP isn't just a library, but closer to a complete methodology for designing and operating MCP endpoints with the same rigor you’d apply to traditional APIs.

Key Features

  • First-class support for models, using dbt: Build on top of versioned, tested data models. We use DuckDB locally for fast execution without infra.
  • Clear API contracts: Define parameters, types, and policies using YAML. MXCP validates everything before serving.
  • Auth & RBAC: Supports OAuth2, user contexts, role-based access, and fine-grained policies (via CEL).
  • Audit Logging: Every request and tool call is logged, searchable, and exportable (JSONL or DuckDB).
  • Drift Detection: Snapshot schemas and detect changes over time, across environments.
  • Testing & Evaluation: Write unit tests, integration tests, and LLM evaluations directly in YAML.
  • Tooling: Includes CLI for validation, serving, drift checking, and audit exploration to integrate in any CI/CD flows.

You can define tools in either SQL or Python — or both — and MXCP handles typing, validation, policy enforcement, and audit automatically. Python tools get access to a runtime for secure DB access, config, and secrets.

Quickstart

Install and run a working MCP server quickly:

pip install mxcp
mxcp init --bootstrap
mxcp serve
Enter fullscreen mode Exit fullscreen mode

This gives you a working project structure with example tools, policies, and tests. The server is ready to connect to any LLM client that speaks MCP, e.g. Claude Desktop, Claude.ai, etc.

Example Use Case: dbt + LLM Interface

  • Use dbt to transform and test your data
  • Expose dbt tables via SQL endpoints with policies and validation
  • Add Python tools for complex logic or ML
  • Test with mxcp test, run mxcp evals to check LLM behavior
  • Use mxcp drift-check to track schema changes across environments
  • Export audit logs for review or compliance

Project Philosophy

We built MXCP because we needed a better way to expose internal data to LLMs without reinventing API infrastructure every time. We wanted:

  • A reproducible, versioned process for building LLM tools
  • Strong guarantees around data contracts, auth, and audits
  • Local development without having to deploy infra
  • Support for hybrid teams working in SQL, Python, and YAML MXCP gives us that - and we’re sharing it in case it helps others trying to solve the same problem.

Get Started

We’re actively developing MXCP and would love feedback.

If you find it useful, try it out, open an issue, or give it a star on GitHub. Thank you!

Top comments (0)