Database operations are central to most applications, but Claude Code doesn't have built-in database connectivity. MCP servers provide secure, controlled access to your databases, enabling Claude to explore schemas, execute queries, and even optimize performance. Here are the best options for working with databases.
Recommended MCP Servers
Supabase MCP
supabase-community/supabase-mcp
Official Supabase MCP server connecting AI assistants directly with Supabase projects for table management, config, and data queries.
Key Features
- Official Supabase integration with OAuth
- Read-only mode for safe exploration
- Project-scoped access control
- Works with CLI and self-hosted setups
Installation
Remote server: https://mcp.supabase.com/mcpIf you're already using Supabase, this is the obvious choice. The official MCP server provides seamless integration with OAuth authentication, read-only mode for safety, and project-scoped access. Just add the URL to your config and you're connected.
Postgres MCP Pro
crystaldba/postgres-mcp
All-in-one PostgreSQL MCP server with index tuning, query plans, health checks, and safe SQL execution.
Key Features
- Database health analysis and monitoring
- Index tuning with industrial-strength algorithms
- EXPLAIN plan analysis and optimization
- Safe SQL execution with read-only mode
Installation
pip install postgres-mcpPostgres MCP Pro goes far beyond basic queries. It includes index tuning that explores thousands of possible indexes, health monitoring for connections and vacuum status, and EXPLAIN plan analysis. Essential for anyone serious about PostgreSQL performance.
MCP Toolbox for Databases
googleapis/genai-toolbox
Google's open source MCP server for databases with connection pooling, authentication, and multi-database support.
Key Features
- Connection pooling and authentication
- Multi-database support
- Tool reuse between agents and frameworks
- Best practices baked in
Installation
See docs at googleapis.github.io/genai-toolboxGoogle's MCP Toolbox is built for production use with connection pooling, authentication handling, and support for multiple databases. It's ideal for enterprise environments where you need robust, reusable database tools across multiple agents.
MySQL MCP Server
designcomputer/mysql_mcp_server
MySQL database integration with configurable access controls, schema inspection, and comprehensive security.
Key Features
- List and read MySQL tables as resources
- Execute SQL queries with error handling
- Environment variable configuration
- Comprehensive logging
Installation
pip install mysql-mcp-serverA straightforward MCP server for MySQL that does exactly what you need: list tables, read data, and execute queries. Configuration via environment variables keeps credentials secure. Perfect for developers who just need reliable MySQL access.
Quick Comparison
| MCP | Stars | Best For | Pros | Cons |
|---|---|---|---|---|
| Supabase MCP | 2k+ | Supabase projects | Zero config, OAuth | Supabase only |
| Postgres MCP Pro | 1.6k+ | PostgreSQL tuning | Index & query optimization | PostgreSQL only |
| MCP Toolbox | 11k+ | Enterprise multi-DB | Connection pooling | More complex setup |
| MySQL MCP | 1k+ | MySQL databases | Simple and focused | Basic features |
Getting Started
To get started with database queries in Claude Code:
Choose your MCP based on your database:
- Supabase → Use the remote Supabase MCP server
- PostgreSQL → Install
postgres-mcp - MySQL → Install
mysql-mcp-server
Configure credentials via environment variables or OAuth.
Enable read-only mode for safe exploration (recommended).
Example prompt: "Show me the schema of the users table and find users who signed up in the last 7 days."