Skip to main content

MXCP: Model eXecution + Context Protocol

Project description

MXCP: Enterprise-Grade Data-to-AI Infrastructure

MXCP Logo

Python 3.11+ License

The MCP server built for production: Transform your data into AI-ready interfaces with enterprise security, audit trails, and policy enforcement

๐Ÿš€ What Makes MXCP Different?

While other MCP servers focus on simple data access, MXCP is built for production environments where security, governance, and scalability matter:

  • ๐Ÿ”’ Enterprise Security: Policy enforcement, audit logging, OAuth authentication
  • โšก Developer Experience: Go from SQL to AI interface in under 60 seconds
  • ๐ŸŽฏ dbt Native: Cache data locally with dbt, serve instantly via MCP
  • ๐Ÿ›ก๏ธ Production Ready: Type safety, drift detection, comprehensive validation
  • ๐Ÿ“Š Data Governance: Track every query, enforce access controls, mask sensitive data

๐ŸŽฏ 60-Second Quickstart

Experience the power of MXCP in under a minute:

# 1. Install and create project (15 seconds)
pip install mxcp
mkdir my-data-api && cd my-data-api
mxcp init --bootstrap

# 2. Start serving your data (5 seconds)
mxcp serve

# 3. Connect to Claude Desktop (40 seconds)
# Add this to your Claude config:
{
  "mcpServers": {
    "my-data": {
      "command": "mxcp",
      "args": ["serve", "--transport", "stdio"],
      "cwd": "/path/to/my-data-api"
    }
  }
}

Result: You now have a type-safe, validated data API that Claude can use to query your data with full audit trails and policy enforcement.

๐Ÿ’ก Real-World Example: dbt + Data Caching

See how MXCP transforms data workflows with our COVID-19 example:

# Clone and run the COVID example
git clone https://github.com/raw-labs/mxcp.git
cd mxcp/examples/covid_owid

# Cache data locally with dbt (this is the magic!)
dbt run  # Transforms and caches OWID data locally

# Serve cached data via MCP
mxcp serve

What just happened?

  1. dbt models fetch and transform COVID data from Our World in Data into DuckDB tables
  2. DuckDB stores the transformed data locally for lightning-fast queries
  3. MCP endpoints query the DuckDB tables directly (no dbt syntax needed)
  4. Audit logs track every query for compliance
  5. Policies can enforce who sees what data

Ask Claude: "Show me COVID vaccination rates in Germany vs France" - and it queries the covid_data table instantly, with full audit trails.

๐Ÿ›ก๏ธ Enterprise Features That Set Us Apart

Policy Enforcement

# Control who can access what data
policies:
  input:
    - condition: "!('hr.read' in user.permissions)"
      action: deny
      reason: "Missing HR read permission"
  output:
    - condition: "user.role != 'admin'"
      action: filter_fields
      fields: ["salary", "ssn"]

Audit Logging

# Track every query with enterprise-grade logging
mxcp log --since 1h --status error
mxcp log --tool employee_data --export-duckdb audit.db

Authentication & Authorization

  • OAuth integration (GitHub, Atlassian, custom)
  • Role-based access control
  • Fine-grained permissions
  • Session management

๐Ÿ—๏ธ Architecture: Built for Production

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   LLM Client    โ”‚    โ”‚      MXCP        โ”‚    โ”‚   Data Sources  โ”‚
โ”‚  (Claude, etc)  โ”‚โ—„โ”€โ”€โ–บโ”‚   (Security      โ”‚โ—„โ”€โ”€โ–บโ”‚  (DB, APIs,     โ”‚
โ”‚                 โ”‚    โ”‚    Audit         โ”‚    โ”‚   Files, dbt)   โ”‚
โ”‚                 โ”‚    โ”‚    Policies)     โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚ Audit Logs   โ”‚
                       โ”‚ (JSONL/DB)   โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Unlike simple data connectors, MXCP provides:

  • Security layer between LLMs and your data
  • Audit trail for every query and result
  • Policy engine for fine-grained access control
  • Type system for LLM safety and validation
  • Development workflow with testing and drift detection

๐Ÿš€ Quick Start

# Install globally
pip install mxcp

# Install with Vault support (optional)
pip install "mxcp[vault]"

# Or develop locally
git clone https://github.com/raw-labs/mxcp.git && cd mxcp
python -m venv .venv && source .venv/bin/activate
pip install -e .

Try the included examples:

# Simple data queries
cd examples/earthquakes && mxcp serve

# Enterprise features (policies, audit, dbt)
cd examples/covid_owid && dbt run && mxcp serve

๐Ÿ’ก Key Features

1. Declarative Interface Definition

# tools/analyze_sales.yml
mxcp: "1.0.0"
tool:
  name: analyze_sales
  description: "Analyze sales data with automatic caching"
  parameters:
    - name: region
      type: string
      description: "Sales region to analyze"
  return:
    type: object
    properties:
      total_sales: { type: number }
      top_products: { type: array }
  source:
    code: |
      -- This queries the table created by dbt
      SELECT 
        SUM(amount) as total_sales,
        array_agg(product) as top_products
      FROM sales_summary  -- Table created by dbt model
      WHERE region = $region

2. dbt Integration

-- models/sales_summary.sql (dbt model)
{{ config(materialized='table') }}

SELECT 
  region,
  product,
  SUM(amount) as amount,
  created_at::date as sale_date
FROM {{ source('raw', 'sales_data') }}
WHERE created_at >= current_date - interval '90 days'
GROUP BY region, product, sale_date

Why this matters: dbt creates optimized tables in DuckDB, MXCP endpoints query them directly - perfect separation of concerns with caching, transformations, and governance built-in.

3. Production-Ready Security

  • Authentication: OAuth, API keys, session management
  • Authorization: Role-based access, permission checking
  • Audit: Every query logged with user context
  • Policies: Dynamic data filtering and access control
  • Drift Detection: Monitor schema changes across environments

๐Ÿ› ๏ธ Core Concepts

Tools, Resources, Prompts

Define your AI interface using MCP (Model Context Protocol) specs:

  • Tools โ€” Functions that process data and return results
  • Resources โ€” Data sources and caches
  • Prompts โ€” Templates for LLM interactions

Project Structure

your-project/
โ”œโ”€โ”€ mxcp-site.yml    # Project configuration
โ”œโ”€โ”€ tools/           # Tool definitions
โ”œโ”€โ”€ resources/       # Data sources
โ”œโ”€โ”€ prompts/         # LLM templates
โ””โ”€โ”€ models/          # dbt transformations & caches

CLI Commands

mxcp serve           # Start production MCP server
mxcp init            # Initialize new project
mxcp list            # List all endpoints
mxcp validate        # Check types, SQL, and references
mxcp test            # Run endpoint tests
mxcp dbt run         # Run dbt transformations
mxcp log             # Query audit logs
mxcp drift-check     # Check for schema changes

๐Ÿ”Œ LLM Integration

MXCP implements the Model Context Protocol (MCP), making it compatible with:

  • Claude Desktop โ€” Native MCP support
  • OpenAI-compatible tools โ€” Via MCP adapters
  • Custom integrations โ€” Using the MCP specification

For specific setup instructions, see:

๐Ÿ“š Documentation

๐Ÿ“š Getting Started

๐Ÿ“– Guides

โšก Features

๐Ÿ“‹ Reference

  • CLI Reference - Complete command-line interface documentation
  • Type System - Data validation and type definitions
  • Plugins - Custom Python extensions and UDFs

๐Ÿค Contributing

We welcome contributions! See our development guide to get started.

๐Ÿข Enterprise Support

MXCP is developed by RAW Labs for production data-to-AI workflows. For enterprise support, custom integrations, or consulting:


Built for the modern data stack: Combines dbt's modeling power, DuckDB's performance, and enterprise-grade security into a single AI-ready platform.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mxcp-0.1.6.tar.gz (127.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mxcp-0.1.6-py3-none-any.whl (127.2 kB view details)

Uploaded Python 3

File details

Details for the file mxcp-0.1.6.tar.gz.

File metadata

  • Download URL: mxcp-0.1.6.tar.gz
  • Upload date:
  • Size: 127.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for mxcp-0.1.6.tar.gz
Algorithm Hash digest
SHA256 5268f71a4ec3c73ef3a8d4a2832f3f0df1d721d6b93d0c76c79c6b424cea3685
MD5 28a5c762580ac1c67767b5393dcabf5c
BLAKE2b-256 53618d19a40ca9d4af47f3f2d96f8f3fefb1256851b4d231618cbaed409ab1b0

See more details on using hashes here.

File details

Details for the file mxcp-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: mxcp-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 127.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for mxcp-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5038e5ba0077ae3a178cc621a111f78173dad396268f71e71df89a7b720381c8
MD5 1cc454c778d3b84b6ba727a8b15f4420
BLAKE2b-256 0c0efe99baf2a8dad78ab9101a655d04fc73129817af1ac824175b7e383bae7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page