MCP Toolbox for PostgreSQL
Google's maintained MCP Toolbox for Databases running its prebuilt PostgreSQL tools: SQL execution, schema listing, query plans and health checks. Runs locally through npx with database connection settings.
Local (stdio)Credential
Set up MCP Toolbox for PostgreSQL
Configuration examples, not tested connections. Replace placeholders and review the upstream documentation before use.
Claude Code
Run in your terminal.
claude mcp add toolbox-postgres --env POSTGRES_HOST="localhost" --env POSTGRES_PORT="5432" --env POSTGRES_DATABASE="$POSTGRES_DATABASE" --env POSTGRES_USER="$POSTGRES_USER" --env POSTGRES_PASSWORD="$POSTGRES_PASSWORD" -- npx -y @toolbox-sdk/server --prebuilt=postgres --stdio
Cursor
Merge into ~/.cursor/mcp.json
{
"mcpServers": {
"toolbox-postgres": {
"command": "npx",
"args": [
"-y",
"@toolbox-sdk/server",
"--prebuilt=postgres",
"--stdio"
],
"env": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_DATABASE": "REPLACE_WITH_POSTGRES_DATABASE",
"POSTGRES_USER": "REPLACE_WITH_POSTGRES_USER",
"POSTGRES_PASSWORD": "REPLACE_WITH_POSTGRES_PASSWORD"
}
}
}
}
Codex
Run in your terminal.
codex mcp add toolbox-postgres --env POSTGRES_HOST="localhost" --env POSTGRES_PORT="5432" --env POSTGRES_DATABASE="$POSTGRES_DATABASE" --env POSTGRES_USER="$POSTGRES_USER" --env POSTGRES_PASSWORD="$POSTGRES_PASSWORD" -- npx -y @toolbox-sdk/server --prebuilt=postgres --stdio
Gemini CLI
Merge into ~/.gemini/settings.json
{
"mcpServers": {
"toolbox-postgres": {
"command": "npx",
"args": [
"-y",
"@toolbox-sdk/server",
"--prebuilt=postgres",
"--stdio"
],
"env": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_DATABASE": "REPLACE_WITH_POSTGRES_DATABASE",
"POSTGRES_USER": "REPLACE_WITH_POSTGRES_USER",
"POSTGRES_PASSWORD": "REPLACE_WITH_POSTGRES_PASSWORD"
}
}
}
}
OpenCode
Merge into ~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"toolbox-postgres": {
"type": "local",
"command": [
"npx",
"-y",
"@toolbox-sdk/server",
"--prebuilt=postgres",
"--stdio"
],
"enabled": true,
"environment": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_DATABASE": "REPLACE_WITH_POSTGRES_DATABASE",
"POSTGRES_USER": "REPLACE_WITH_POSTGRES_USER",
"POSTGRES_PASSWORD": "REPLACE_WITH_POSTGRES_PASSWORD"
}
}
}
}
VS Code
Merge into .vscode/mcp.json
{
"servers": {
"toolbox-postgres": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@toolbox-sdk/server",
"--prebuilt=postgres",
"--stdio"
],
"env": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_DATABASE": "${input:POSTGRES_DATABASE}",
"POSTGRES_USER": "${input:POSTGRES_USER}",
"POSTGRES_PASSWORD": "${input:POSTGRES_PASSWORD}"
}
}
},
"inputs": [
{
"id": "POSTGRES_DATABASE",
"type": "promptString",
"description": "POSTGRES_DATABASE",
"password": false
},
{
"id": "POSTGRES_USER",
"type": "promptString",
"description": "POSTGRES_USER",
"password": false
},
{
"id": "POSTGRES_PASSWORD",
"type": "promptString",
"description": "POSTGRES_PASSWORD",
"password": true
}
]
}
Using more than one server?Add to a config with other servers
Step-by-step setup guides: Claude Code and Codex CLI, Cursor and VS Code. In Claude Desktop, the Cursor JSON goes in claude_desktop_config.json. This is a local server that runs on your machine; see remote vs local servers and authentication and security basics.
Overview
MCP Toolbox for Databases is an open-source server from Google, maintained in googleapis/mcp-toolbox. Version 1.14.0 was released on 8 October 2026. Its prebuilt PostgreSQL configuration is a maintained way to connect an agent to any Postgres database. The archived reference server that this registry lists as postgres no longer receives updates.
Starting the server with --prebuilt=postgres gives you a ready set of tools. execute_sql runs statements and list_tables, list_schemas, list_views and list_indexes describe the schema. get_query_plan explains a query. A group of health tools, including list_active_queries, list_locks, long_running_transactions, list_invalid_indexes and database_overview, helps with operational checks. Toolbox can also load your own tool definitions from a tools.yaml file, and prebuilt configurations exist for other databases.
The example runs npx -y @toolbox-sdk/server --prebuilt=postgres --stdio and reads its connection settings from POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DATABASE, POSTGRES_USER and POSTGRES_PASSWORD, as the upstream PostgreSQL guide documents. Unlike the old reference server, execute_sql is not limited to read-only transactions. Connect with a database role that has only the privileges you want the agent to use, and point it at a development copy when you can.
Example tools
execute_sqllist_tableslist_schemasget_query_planlist_active_queriesdatabase_overview
Tool names are upstream examples. The server's live tool list can differ.
Related Database servers
Sources
This page was written from the upstream documentation below and last reviewed on 11 October 2026. Listing is not a security or compatibility endorsement. Report a correction through the contact page.