AI Agents / MCP¶
DataPress exposes its dataset query surface as MCP (Model Context Protocol) tools, so any MCP-compatible AI agent or LLM application can discover, describe, and query your datasets over a standard JSON-RPC 2.0 streamable-HTTP connection.
Protocol revision: MCP 2025-11-25.
Prerequisites¶
- Build DataPress with the
mcpfeature:
- Enable the endpoint in
datasets.toml:
- Restart the server. The startup log will include:
Claude Desktop¶
Add a server entry in ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"datapress": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-fetch"],
"env": {
"MCP_SERVER_URL": "http://localhost:8080/mcp"
}
}
}
}
Authentication: if
[auth]is enabled withanonymous_read = false, add"Authorization": "Bearer <token>"to theheadersenv var supported by your fetch server wrapper, or configure Claude Desktop's bearer token.
Claude Code (CLI)¶
With a bearer token:
claude mcp add datapress --transport http http://localhost:8080/mcp \
--header "Authorization: Bearer $DATAPRESS_TOKEN"
VS Code (GitHub Copilot)¶
Add to your VS Code settings.json:
{
"github.copilot.chat.mcp.servers": {
"datapress": {
"type": "http",
"url": "http://localhost:8080/mcp"
}
}
}
Verifying the connection¶
Use the MCP Inspector to test the endpoint manually:
The inspector shows the initialize handshake, tools/list result, and lets
you invoke each tool interactively.
Available tools¶
| Tool | When |
|---|---|
list_datasets |
Always |
describe_dataset |
Always |
describe_all_datasets |
Always |
query_dataset |
Always |
count_rows |
Always |
sql |
Only when [mcp].expose_sql = true AND [sql].enabled = true |
Typical agent workflow¶
- Call
list_datasets→ discover what data exists. - Call
describe_dataset(ordescribe_all_datasetsfor joins) → get column names and types. - Call
count_rowswith predicates → check result size before paginating. - Call
query_dataset→ run structured queries with filters, sorting, and pagination. - Call
sql(if enabled) → express joins or complex expressions the structured tool cannot.
Local models (Ollama)¶
Run DataPress tools with a local model via ollmcp:
# Install ollmcp once
pip install mcp-client-for-ollama # or: uvx --from mcp-client-for-ollama ollmcp
# Run with qwen3 (recommended: ≥14B or MoE variant for multi-step queries)
uvx --from mcp-client-for-ollama ollmcp \
--servers-json '{"mcpServers":{"datapress":{"type":"streamable_http","url":"http://localhost:8080/mcp"}}}' \
--model qwen3:30b-a3b
Or save the server config in a file and reference it:
{
"mcpServers": {
"datapress": {
"type": "streamable_http",
"url": "http://localhost:8000/mcp"
}
}
}
uvx --from mcp-client-for-ollama ollmcp \
--servers-json-file datapress-mcp.json \
--model qwen3:30b-a3b
Troubleshooting with Ollama¶
- Model calls no tools. Reasoning models with thinking enabled sometimes
emit a thinking block but no tool call. Disable thinking with
/tmin the chat, or switch to a non-reasoning model. - Tool calls fail or truncate. Raise
num_ctxto at least 16 000 tokens in the Ollama model file. Multi-step queries with large schemas fill context quickly. - Poor multi-step behaviour. Prefer ≥ 14 B parameter or MoE (mixture-of- experts) models — smaller models struggle with the discover → schema → count → query workflow reliably.