Ask Your Database Questions in Plain English with MCP

beginnerSetup time: 10 minutes

With a database MCP server, your AI assistant becomes a SQL expert that already knows your schema. Ask questions in plain English and get instant, accurate answers — without writing a single query.

Servers You'll Need

Step-by-Step Setup

  1. 1

    Install the database server

    For PostgreSQL: `npm install -g @modelcontextprotocol/server-postgres`. For SQLite: `npm install -g @modelcontextprotocol/server-sqlite`. You only need the one matching your database.

  2. 2

    Add it to your AI client config

    Open your Claude Desktop (or Cursor) config file and add the server. For Postgres, you'll provide a connection string in the environment. For SQLite, provide the file path as an argument.

  3. 3

    Restart your AI client

    Quit and reopen Claude Desktop (or restart Cursor). The server should connect automatically. You'll see database tools listed if you click the tools icon.

  4. 4

    Start asking questions

    Ask the AI to describe your schema, find rows, aggregate data, or explain query results. The AI generates and executes the SQL, then explains the result to you.

Example Prompts to Try

  • What tables are in my database and what do they contain?
  • How many users signed up last week?
  • Which products have the highest return rate?
  • Show me all orders over $500 from the past month
  • Is there any data quality issue I should know about in the users table?

Tips

  • Grant read-only database credentials for safety — the AI can still answer questions without write access.
  • Ask the AI to explain the SQL it ran. It's a great way to learn.
  • For complex analytics, tell the AI the business question first, then let it figure out the query.

FAQ

Can the AI modify my database?

By default, most database MCP servers expose both read and write operations. For safety, create a read-only database user and use those credentials in your MCP config.

Does my database data get sent to Anthropic?

Query results are included in the conversation context sent to the AI API. Treat this the same as any other data you include in a chat with Claude. Don't use it with sensitive PII unless your data agreements allow it.