Python MCP
Give AI agents your Python ClickHouse datasets, not a SQL console
Define datasets in Python and run hypequery mcp app:api. Agents get exactly the endpoints the caller may call, so Claude and Cursor query governed measures while SQL, credentials, and the tenant stay in your Python process.
Agent surface
Authorized endpoints only
SQL and credentials
Stay in Python
Works with
Claude, Cursor, MCP clients
A SQL tool hands the model your database
Generic ClickHouse MCP servers let the agent pick tables, joins, and result sizes. A prompt is not a permission system.
Agents invent their own revenue
When the agent writes its own query, its number disagrees with your dashboard. The definition has to be shared, not re-derived.
Python teams were left out
Most semantic-layer MCP servers expect a Node or YAML project. Your analytics already live in a Python service.
Client contract
Publish what agents may call
Install dataset endpoints with a client profile and add the client-contract route. The contract lists each endpoint’s fields, operators, and limits for the calling principal, and nothing else.
- Agents see only endpoints the API key’s principal is allowed to call
- The tenant comes from that principal on the Python side; the agent cannot choose it
- Fields, filters, and limits are validated by Python before any SQL runs
- Every tool call runs through
Api.handle, so auth, endpoint policy and rate limits apply exactly as they do over HTTP
api.py
Dataset endpoints plus live discovery
The same endpoints your React app calls. No separate agent backend.
MCP server
Run hypequery mcp on your API
The Python CLI serves your API's authorized client contract to agents, over stdio or, with --http, at a URL. No Node process and no separate agent backend.
app:api is the Api from create_api. Each tool call goes through it in the same process, so authentication, endpoint policy, rate limits and tenant resolution are the ones an HTTP caller meets.
API already deployed? hypequery mcp --client-contract-url bridges it over HTTPS instead, with the same tools. Agents get list_datasets, get_dataset_schema, and query_dataset, and never write or receive SQL.
terminal
Serve it to an agent
Paste the printed entry into Claude Desktop or Cursor, or connect a client to the --http URL.
Where teams usually get stuck
Questions teams ask
ClickHouse MCP server for Python
Use your existing Python service as the MCP backend instead of exposing ClickHouse directly.
Semantic layer for AI agents in Python
Agents query named measures and dimensions from your datasets, so their numbers match your product.
Multi-tenant MCP
Over stdio the server acts as one principal and its tenant. Over HTTP with your app’s auth or OAuth, each caller’s tenant comes from their own credential.
Native Python MCP server
Yes: hypequery mcp app:api runs in your Python process. Python keeps ownership of SQL, auth, and tenancy.
Examples
Runnable examples
Every example runs against the same seeded ClickHouse dataset. Scaffold one with npx @hypequery/cli create <slug> -y, or browse the full list.
Further reading
Go deeper where it actually helps
MCP quick start
Expose your first Python dataset to Claude or Cursor, then share it over HTTP.
Open guide
React and MCP clients
Declare client endpoints and export the contract.
Open guide
MCP overview
Every way to run the MCP server, and when to use each.
Open guide
MCP tool catalog
Exactly what agents can discover and run.
Open guide
MCP safety model
Credentials, limits, and tenant isolation.
Open guide
Next step
Connect one dataset to your first agent
Add a client contract route to your API, then run hypequery mcp app:api --self-test.
Open source, and it runs in your own backend. Want it hosted?