How do I connect Claude Desktop to a database?
Recipe verified on
Ran on the public demo (read-only)
Tested: the address and key header below, with an MCP client; Claude Desktop's settings as Anthropic documents them
Short answer
Add a database's MCP server to Claude Desktop's config file. For mcpdata that's a remote server (https://[you].mcpdata.org/mcp) with your API key, reached through the mcp-remote bridge; after a restart, Claude can list your tables and query them.
Steps
- Open the config file. In Claude Desktop: Settings, Developer, Edit Config. It opens
claude_desktop_config.json. - Add the server. This one points at the public demo (read-only, synthetic data); for your own instance use its address and your key:
{ "mcpServers": { "mcpdata-demo": { "command": "npx", "args": ["-y", "mcp-remote", "https://demo.mcpdata.org/mcp", "--header", "Authorization:${AUTH}"], "env": { "AUTH": "Bearer cdb_live_PkVoldus8qcE-hqffjajNZzQwiA7rTHMoR4RLSAxsCE" } } } } - Restart Claude Desktop. The mcpdata tools appear in the tools menu of a new chat.
- Ask your question. Give your AI this prompt:
Using mcpdata, which tables can you see, and how many rows does each have?
What your AI does: the tool call it makes for this prompt, and what came back
list_tables() → 3 tables: Demo.Orders, Demo.Products, Demo.Customers
| table | rows | last_updated |
|---|---|---|
| Demo.Orders | 10,005,000 | 2026-10-27 20:05:07.103000 |
| Demo.Products | 2,000 | 2026-10-27 19:50:37.321000 |
| Demo.Customers | 200,000 | 2026-10-27 19:50:36.983000 |
Synthetic data: the demo's orders are generated, not real customers.
The assistant needs mcpdata connected (step 1) to run the query.
Why this works
Claude Desktop's config file starts local programs. mcp-remote is a small program (run with npx, so it needs Node.js) that connects to a remote MCP server and passes your key as a header. Try it first with the public demo's address and key, shown here; then swap in your own instance.