# MCP Toolbox for Databases (MCP Server)

> Google's open-source MCP server for 20+ databases

- Type: MCP server
- Publisher: Google (official)
- Categories: Data & Analytics, DevOps & Cloud
- Website: https://github.com/googleapis/mcp-toolbox
- Docs: https://mcp-toolbox.dev
- Source: https://github.com/googleapis/mcp-toolbox
- Transport: stdio
- Launch command: npx -y @toolbox-sdk/server --prebuilt=postgres --stdio
- Sign-in: none
- Environment variables: POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DATABASE, POSTGRES_USER, POSTGRES_PASSWORD
- GitHub stars: 16544
- Listed: 2025-04-01

## About

Open-source MCP server from Google for connecting agents to databases including AlloyDB, BigQuery, Cloud SQL, Spanner, PostgreSQL, MySQL, SQL Server, MongoDB and more. Offers prebuilt tool sets via --prebuilt or custom tools defined in tools.yaml, with connection pooling and IAM auth.

## Install

1. **Add the server to Codex**

   Codex CLI:

   ```bash
   codex mcp add mcp-toolbox-databases --env POSTGRES_HOST=YOUR_POSTGRES_HOST --env POSTGRES_PORT=YOUR_POSTGRES_PORT --env POSTGRES_DATABASE=YOUR_POSTGRES_DATABASE --env POSTGRES_USER=YOUR_POSTGRES_USER --env POSTGRES_PASSWORD=YOUR_POSTGRES_PASSWORD -- npx -y @toolbox-sdk/server --prebuilt=postgres --stdio
   ```

   config.toml:

   ```toml
   [mcp_servers.mcp-toolbox-databases]
   command = "npx"
   args = ["-y", "@toolbox-sdk/server", "--prebuilt=postgres", "--stdio"]
   
   [mcp_servers.mcp-toolbox-databases.env]
   POSTGRES_HOST = "YOUR_POSTGRES_HOST"
   POSTGRES_PORT = "YOUR_POSTGRES_PORT"
   POSTGRES_DATABASE = "YOUR_POSTGRES_DATABASE"
   POSTGRES_USER = "YOUR_POSTGRES_USER"
   POSTGRES_PASSWORD = "YOUR_POSTGRES_PASSWORD"
   ```

   Agents SDK:

   ```python
   from agents import Agent, Runner
   from agents.mcp import MCPServerStdio
   
   async with MCPServerStdio(
       name="MCP Toolbox for Databases",
       params={"command": "npx", "args": ["-y", "@toolbox-sdk/server", "--prebuilt=postgres", "--stdio"]},
   ) as server:
       agent = Agent(name="Assistant", mcp_servers=[server])
       result = await Runner.run(agent, "List the tables in my Postgres database")
       print(result.final_output)
   ```

## Tools

- `execute_sql`
- `list_tables`
- `list_schemas`
- `list_views`
- `list_indexes`
- `list_active_queries`
- `get_query_plan`
- `database_overview`
- `list_locks`
- `list_query_stats`

## Example prompts

- "List the tables in my Postgres database"
- "Show the slowest queries right now"
- "Explain the query plan for this SELECT"
- "Which tables are most bloated?"

## Also available as

- plugin: [Google Drive](https://chatgptplugins.directory/plugins/google-drive.md)

## Related

- [GitHub](https://chatgptplugins.directory/mcp/github.md): Manage repos, issues, pull requests and Actions from your AI agent
- [Supabase](https://chatgptplugins.directory/mcp/supabase.md): Manage Supabase databases, migrations, edge functions and logs
- [Sentry](https://chatgptplugins.directory/mcp/sentry.md): Search Sentry errors, issues and traces and debug them with Seer
- [Graphiti MCP](https://chatgptplugins.directory/mcp/graphiti.md): Temporal knowledge graph memory for agents, by Zep
- [Cloudflare API](https://chatgptplugins.directory/mcp/cloudflare-api.md): Access 2,500+ Cloudflare API endpoints through two Code Mode tools
- [Vercel](https://chatgptplugins.directory/mcp/vercel.md): Manage Vercel projects, deployments, logs and docs from AI tools

---
Source: https://chatgptplugins.directory/mcp/mcp-toolbox-databases · Index: https://chatgptplugins.directory/llms.txt · Independent and community-run. Not affiliated with or endorsed by OpenAI. ChatGPT is a trademark of OpenAI.
