mcpdata Request an invite

Answers / Connect your AI

How do I connect Cursor to a database?

Recipe verified on Ran on the public demo (read-only) Tested: the URL and header below, with an MCP client; Cursor's settings as Cursor documents them
Short answer

Add the database's MCP server to ~/.cursor/mcp.json (or .cursor/mcp.json in a project) with its URL and your key as a header. For mcpdata that's https://[you].mcpdata.org/mcp with Authorization: Bearer <key>; the tools then show up in Cursor's MCP settings.

Steps

  1. Add the server to Cursor's MCP config. In ~/.cursor/mcp.json; this points at the public demo, swap in your own instance and key later:
    {
      "mcpServers": {
        "mcpdata-demo": {
          "url": "https://demo.mcpdata.org/mcp",
          "headers": { "Authorization": "Bearer cdb_live_PkVoldus8qcE-hqffjajNZzQwiA7rTHMoR4RLSAxsCE" }
        }
      }
    }
  2. Check it's connected. Cursor Settings, MCP: the server is listed with its tools.
  3. Ask your question. Give your AI this prompt:
    Using mcpdata, top 5 categories by revenue in Demo.Orders.
What your AI does: the tool call it makes for this prompt, and what came back
query(table_name="Demo.Orders", group_by=["category"], agg=[{"func": "sum", "column": "revenue", "alias": "revenue"}], sort=[{"column": "revenue", "desc": true}], limit=5) → 5 rows (more available)
What you should get · the recipe's real result from its last run
categoryrevenue
Laptops1,501,830,967
Cameras940,192,658
Phones706,442,054
Tablets571,821,488
Monitors482,471,921

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

Cursor speaks streamable HTTP to remote servers, so the config is just the address and a header. Keeping the key in your user-level file (not the project's) keeps it out of the repository.

Related questions