crdb-mcp-server
A Model Context Protocol (MCP) server implemented in Python using FastAPI and CockroachDB.
🧠 What This Is
crdb-mcp-server is a production-grade, spec-aligned MCP server that:
- Implements the Model Context Protocol
- Uses CockroachDB as a resilient, SQL-compatible backend
- Exposes full CRUD APIs for managing model contexts
- Stores context definitions as JSONB, allowing arbitrary input/output schema
- Works seamlessly with the
crdb-mcpctlCLI
✅ Feature Highlights
- ✅ REST API for MCP context management (
/contexts) - ✅ Schema bootstrapping via CLI flag or env var
- ✅ CRDB URL auto-detection and dialect fix
- ✅ ASCII banner and version info
- ✅ Structured logging and configurable log level
- ✅ Ready for
/run,/deploy,/evaluateextensions
🚀 Quickstart
📦 Install from PyPI
pip install crdb-mcp-server
🏃 Run with schema init
crdb-mcp-server serve --init-schema --log-level INFO
Or:
export MCP_AUTO_INIT_SCHEMA=true
crdb-mcp-server serve
Server runs at
http://localhost:8081by default
🔧 CLI Usage
crdb-mcp-server serve --init-schema
crdb-mcp-server serve --port 8081 --host 127.0.0.1 --reload
crdb-mcp-server --version
crdb-mcp-server --banner
🔐 Configuring the Database
✅ Set the CRDB_URL environment variable
export CRDB_URL="postgresql://root@localhost:26257/defaultdb?sslmode=disable"
Automatically rewritten to
cockroachdb://...under the hood for compatibility.
Alternatively, set it directly:
export CRDB_URL="cockroachdb://root@localhost:26257/defaultdb?sslmode=disable"
✅ Both formats are supported.
🧪 API Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /contexts |
Create a context |
| GET | /contexts |
List all contexts |
| GET | /contexts/{id} |
Get context by ID |
| PUT | /contexts/{id} |
Update context |
| DELETE | /contexts/{id} |
Delete context |
🧱 Schema Auto-Bootstrap
Run this manually:
crdb-mcp-server serve --init-schema
Or automatically with:
export MCP_AUTO_INIT_SCHEMA=true
The schema created is:
CREATE TABLE IF NOT EXISTS mcp_contexts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
context_name STRING NOT NULL,
context_version STRING NOT NULL,
body JSONB NOT NULL,
created_at TIMESTAMP DEFAULT now()
);
🔗 Related Projects
- crdb-mcpctl: CLI tool to manage MCP contexts, simulate LLM runs, export, and batch simulate across providers.
🙌 Contributions
This project is designed for internal and community use.
PRs welcome to extend functionality (auth, deployment support, /evaluate, telemetry, etc.).
Metadata
Release files for crdb-mcp-server 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crdb_mcp_server-0.1.0.tar.gz | 6.3 kB | Without provenance | Details for crdb_mcp_server-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crdb_mcp_server-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for crdb_mcp_server-0.1.0-py3-none-any.whl |
Total release size: 13.9 kB
Release files / crdb_mcp_server-0.1.0.tar.gz
| Download URL | crdb_mcp_server-0.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cd2c9b09848a1a74f31a58fe2f948e5460778d1b19054300181a6b5fd122200
|
|
BLAKE2b-256 checksum How to use checksums |
7ebaa241ad53cb9251ec3a9af08a02159285e10ca9a3d3125f5bd9f596b5d54f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / crdb_mcp_server-0.1.0-py3-none-any.whl
| Download URL | crdb_mcp_server-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fe546489a53f7043d31234f22c6aa9b107b1fb54a807b8af0d8e6985c205bab
|
|
BLAKE2b-256 checksum How to use checksums |
0778542fc2d838fdb42eb41f797ff9796a41fb2d44cf7d30e49ebf60d3d53da5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Security for crdb-mcp-server 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.