Claude can query your database directly through the Model Context Protocol (MCP). The duckdb_mcp community extension turns the DuckDB CLI into an MCP server: Claude lists your tables, reads the comments of every column, writes the SQL and answers in plain words.
No SQL needed: ask a question about your training, Claude figures out which tables to join and shows you the query it ran.
Claude talks to your database through the DuckDB CLI. On macOS, install it with Homebrew. Other platforms: see the DuckDB installation guide.
brew install duckdbinit.sql filePut it next to selfsync-db.duckdb and replace the paths with the absolute paths of your database and of selfsync-report.html. READ_ONLY guarantees Claude cannot modify your data. mcp_publish_query shares the report with Claude as an MCP resource.
INSTALL duckdb_mcp FROM community;
LOAD duckdb_mcp;
ATTACH '/absolute/path/to/selfsync-db.duckdb' AS selfsync (READ_ONLY);
USE selfsync;
-- Publishes the report as an MCP resource, to give Claude the full context
PRAGMA mcp_publish_query(
'SELECT content FROM read_text(''/absolute/path/to/selfsync-report.html'')',
'selfsync://report',
'text',
0
);
PRAGMA mcp_server_start('stdio');Open Settings → Developer → Edit Config, add the server to claude_desktop_config.json, then restart Claude. If Claude cannot find duckdb, use the full path given by which duckdb (e.g. /opt/homebrew/bin/duckdb).
{
"mcpServers": {
"SelfSync": {
"command": "duckdb",
"args": ["-init", "/absolute/path/to/init.sql"]
}
}
}Using Claude Code instead? Run this once in your terminal.
claude mcp add selfsync -- duckdb -init /absolute/path/to/init.sqlThe report documents every table, the naming conventions and queries already run on your data: the best context Claude can get. Claude does not read resources on its own: attach it at the beginning of a conversation. In Claude Desktop, click + and pick it from the SelfSync server. In Claude Code, type @selfsync:selfsync://report in your message. If Claude finds it empty, check the report path in init.sql.
Start with “Using the SelfSync database, how many kilometres did I run each year?”, then “Is my average heart rate on easy runs going down over time?” or “Find my longest ride and describe it: distance, climbing, power.”
Wondering what a table or a column holds? Browse the FIT file reference.