~/CLIRank

Best MCP Servers for Databases (2026)

Connect Claude Code directly to your databases. Run queries, inspect schemas, debug data issues, and manage migrations without switching to a separate database client. These MCP servers cover relational, document, and key-value stores.

Quick comparison

#ServerCLI ScoreQuality

Detailed rankings

How to install MCP servers in Claude Code

MCP servers install with a single command. Run the install command in your terminal and the server will be available in all future Claude Code sessions.

1. Run the install command

claude mcp add postgres -- npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@localhost:5432/mydb

2. Set any required environment variables

Most MCP servers need an API key or token. Set it as an environment variable in your shell profile:

export GITHUB_TOKEN=ghp_your_token_here

3. Or configure in Claude Code settings

You can also add MCP servers directly in your Claude Code settings file (~/.claude.json):

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "@package/server-name"],
      "env": {
        "API_KEY": "your-key-here"
      }
    }
  }
}

4. Verify it works

Start a new Claude Code session and ask Claude to use the server. For example: "List my GitHub repos" or "Show my Postgres tables". Claude will use the MCP server automatically.

Frequently asked questions

Is it safe to connect Claude Code to my production database?

Use read-only credentials for production. Most database MCP servers accept a connection string, so create a read-only user and pass those credentials.

Which database MCP server should I use for Postgres?

Use the PostgreSQL MCP server for direct connections. If you use Supabase or Neon as your hosting provider, their dedicated MCP servers offer extra features like branching and auth management.

Can Claude Code run destructive SQL queries?

It can if the credentials allow it. Claude Code asks for confirmation before running write operations. Add rules in CLAUDE.md to restrict DELETE/DROP if you want extra safety.

Browse other MCP server categories