๐ API Reference: cockroachdb-mcp-server
¶
This document describes the full HTTP API surface of the CockroachDB MCP Server implementation.
๐ง Overview¶
All endpoints follow RESTful conventions and are aligned with the Model Context Protocol (MCP).
- Base URL:
http://localhost:8081
(by default) - Content-Type:
application/json
- Auth: Optional (token-based support planned)
๐ /healthz
¶
Check server health and readiness.
Request¶
GET /healthz
````
### Response
```json
{ "status": "ok" }
๐ฆ /contexts
¶
The main endpoint for creating, listing, retrieving, updating, and deleting contexts.
POST /contexts
โ Create a Context¶
Create a new MCP-compatible context.
Request Body¶
{
"context_name": "summarizer",
"context_version": "1.0.0",
"body": {
"inputs": ["text"],
"outputs": ["summary"],
"description": "Summarize any block of text."
}
}
Example¶
curl -X POST http://localhost:8081/contexts \
-H "Content-Type: application/json" \
-d @context.json
Response¶
{
"status": "created",
"context_name": "summarizer"
}
GET /contexts
โ List Contexts¶
Returns all registered contexts (minimal metadata).
curl http://localhost:8081/contexts
{
"contexts": [
{
"id": "abc123-uuid",
"context_name": "summarizer",
"context_version": "1.0.0",
"created_at": "2025-06-11T15:30:00Z"
}
]
}
GET /contexts/{id}
โ Get by ID¶
Retrieve full context metadata and body.
curl http://localhost:8081/contexts/abc123-uuid
PUT /contexts/{id}
โ Replace a Context¶
Submit full replacement for the context (same shape as POST). Partial updates not supported.
DELETE /contexts/{id}
โ Remove a Context¶
curl -X DELETE http://localhost:8081/contexts/abc123-uuid
๐ /debug/*
โ Demo + Diagnostics¶
โ ๏ธ These endpoints are only available when the server is started with:
bash export MCP_DEMO_MODE=true cockroachdb-mcp-server serve --demo-mode
GET /debug/info
¶
Returns basic CockroachDB metadata.
curl http://localhost:8081/debug/info
{
"database": "defaultdb",
"version": "CockroachDB CCL v25.2.1 ..."
}
GET /debug/tables
¶
Lists public user-defined tables in the connected CRDB instance.
curl http://localhost:8081/debug/tables
{
"tables": ["mcp_contexts"]
}
POST /debug/sql
¶
Execute a read-only SELECT SQL statement.
Request¶
{
"query": "SELECT version()"
}
Example¶
curl -X POST http://localhost:8081/debug/sql \
-H "Content-Type: application/json" \
-d '{"query": "SELECT version()"}'
Response¶
[
{ "version": "CockroachDB CCL v25.2.1 ..." }
]
โ Any non-SELECT query will be rejected.
๐งช Swagger + OpenAPI¶
Interactive documentation is auto-generated and available at:
๐ Future Enhancements¶
Planned API extensions:
/run
โ trigger LLM evaluation/evaluate
โ scoring and comparison/deploy
โ push to model runtime
Stay tuned.