Reference
Related Topics: Concepts (understand MXCP) | Tutorials (learn by doing) | YAML Schemas (configuration files) | Quality (testing, validation)
This section provides comprehensive reference documentation for all MXCP components.
Quick Start
Section titled “Quick Start”Looking for how to do something? See Common Tasks - quick answers to “How do I…?” questions.
Reference Topics
Section titled “Reference Topics”Quick how-to reference for frequent tasks:
- Adding authentication
- Filtering sensitive data
- Writing tests
- Configuring production
Complete command-line interface documentation:
- All commands and options
- Output formats
- Environment variables
- Error handling
SQL capabilities in MXCP:
- DuckDB SQL syntax
- Built-in authentication functions
- Parameter binding
- Common extensions
Python runtime API:
- Database access (
db) - Configuration (
config) - Plugin access (
plugins) - Lifecycle hooks
Plugin development guide:
- Plugin structure
- UDF definition
- Type mapping
- Authentication integration
Quick Reference
Section titled “Quick Reference”Common Commands
Section titled “Common Commands”# Project managementmxcp init # Initialize projectmxcp init --bootstrap # With example endpoint
# Servermxcp serve # Start server (default transport)mxcp serve --transport stdio # For Claude Desktopmxcp serve --transport streamable-http # HTTP API
# Developmentmxcp validate # Validate endpointsmxcp test # Run testsmxcp lint # Check metadata qualitymxcp list # List endpoints
# Executionmxcp run tool my_tool # Run a toolmxcp query "SELECT 1" # Execute SQL
# Qualitymxcp evals # Run LLM evaluationsmxcp drift-snapshot # Create baselinemxcp drift-check # Check for drift
# Auditmxcp log # Query audit logsmxcp log-cleanup # Apply retention
# dbtmxcp dbt-config # Generate dbt configmxcp dbt run # Run dbt modelsPython Runtime Quick Reference
Section titled “Python Runtime Quick Reference”from mxcp.runtime import db, config, plugins, on_init, on_shutdown
# Databaseresults = db.execute("SELECT * FROM users WHERE id = $id", {"id": 123})
# Configurationsecret = config.get_secret("api_key")setting = config.get_setting("project")
# Pluginsplugin = plugins.get("my_plugin")
# Lifecycle@on_initdef setup(): print("Starting")
@on_shutdowndef cleanup(): print("Stopping")SQL Functions Quick Reference
Section titled “SQL Functions Quick Reference”-- Authentication (when enabled)SELECT get_username();SELECT get_user_email();SELECT get_user_provider();SELECT get_user_external_token();
-- Request headers (HTTP transport)SELECT get_request_header('Authorization');SELECT get_request_headers_json();
-- ParametersSELECT * FROM users WHERE id = $user_id;Type Mapping Quick Reference
Section titled “Type Mapping Quick Reference”| YAML Type | Python Type | DuckDB Type |
|---|---|---|
string | str | VARCHAR |
integer | int | INTEGER |
number | float | DOUBLE |
boolean | bool | BOOLEAN |
array | list | Array |
object | dict | STRUCT/JSON |
See Type System for format annotations, constraints, and sensitive data marking.
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
MXCP_DEBUG | Enable debug logging |
MXCP_PROFILE | Default profile |
MXCP_READONLY | Read-only mode |
MXCP_DUCKDB_PATH | Override DuckDB path |
MXCP_CONFIG_PATH | User config path |
Telemetry
Section titled “Telemetry”| Variable | Description |
|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | OTLP collector endpoint |
OTEL_SERVICE_NAME | Service name |
MXCP_TELEMETRY_ENABLED | Enable/disable telemetry |
| Variable | Description |
|---|---|
MXCP_ADMIN_ENABLED | Enable admin socket |
MXCP_ADMIN_SOCKET | Admin socket path |
Project Structure
Section titled “Project Structure”my-project/├── mxcp-site.yml # Project configuration (required)├── tools/ # Tool definitions├── resources/ # Resource definitions├── prompts/ # Prompt definitions├── python/ # Python code├── plugins/ # DuckDB plugins├── sql/ # SQL files├── data/ # DuckDB database files├── evals/ # Evaluation suites├── drift/ # Drift snapshots├── audit/ # Audit logs├── models/ # dbt models└── target/ # dbt outputNext Steps
Section titled “Next Steps”- CLI Reference - Full command documentation
- SQL Reference - SQL capabilities
- Python Reference - Runtime API
- Plugin Reference - Plugin development
- YAML Schemas - Configuration file schemas