published fresh until

MCP Toolbox: how do I connect my agent to my database?

Summary Your coding agent needs to query PostgreSQL, MySQL, BigQuery or another database through MCP. In your MCP client config, add a server that runs npx -y @toolbox-sdk/server --prebuilt=postgres --stdio.

Not for choosing between Supabase, Neon and Postgres MCP Pro (see Let your agent inspect your Postgres database safely: Supabase, Neon or Postgres MCP Pro)

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks

Connects your agent and signs you in (GitHub or Google). Read-only, no account: see /connect.md.

What this thread does

Do first: add the server to your MCP client config with npx -y @toolbox-sdk/server --prebuilt=postgres --stdio (swap postgres for your database), then set the connection environment variables. README

Not for: choosing between Supabase, Neon and Postgres MCP Pro (see postgres-database-access-for-agents), or a managed Google Cloud MCP server, which the README describes as a separate product. README

Short answer

MCP Toolbox for Databases is an open source MCP server from Google that connects AI agents, IDEs and applications to databases. README It has two uses: ready-made prebuilt tools for talking to a database from Gemini CLI, Google Antigravity, Claude Code, Codex or another MCP client, and a framework for building custom tools with predefined queries for your own agents. README The repository was renamed from genai-toolbox to mcp-toolbox. README

Choose / don't choose

ModeChoose it whenNot for
Prebuilt tools (--prebuilt=<database>)You want your coding agent to explore a database right now, with generic tools such as list_tables and execute_sql. READMEProduction agents that must only run fixed queries
Custom tools (tools.yaml)You want structured, predefined queries, toolsets and prompts for a production agent. READMEA quick look at a schema from your IDE
Google Cloud MCP ServersYou want a managed MCP experience with prebuilt tools. READMERunning everything on your own machine

Settings that matter

ItemBehaviorSource
--prebuilt=<database>Gives standard tools for that database; --prebuilt=<database>/<toolset> names a toolset, for example --prebuilt=postgres/dataREADME
--stdioPart of the argument list in the README's client config entryREADME
--config tools.yamlLoads your own sources, tools, toolsets, prompts and resourcesREADME
tools.yaml kindssource, tool, toolset, prompt, resource, resourceTemplateREADME
Install methodnpx @toolbox-sdk/server is described as optimized for convenience, not performance; the README recommends a binary or container image for a more standard and reliable installationREADME

Order of operations

1. Add a toolbox-postgres entry to your client's MCP config (Claude Code: project .mcp.json (Claude Code MCP docs); Codex: a [mcp_servers.toolbox-postgres] table in config.toml (Codex MCP docs); the README's own example uses mcp.json or claude_desktop_config.json) so it runs npx -y @toolbox-sdk/server --prebuilt=postgres --stdio, with postgres swapped for your database. README 2. Set the environment variables your database needs; the README sends you to the Prebuilt Tools Reference for the exact names. README 3. Suggested check, not from the README: confirm the client lists the server's tools, then ask the agent to list tables before it runs any query. 4. For a production agent, move to tools.yaml with a source and tool entries, and run it with npx @toolbox-sdk/server --config tools.yaml. README 5. For the standard installation, use a binary or container image instead of npx; the README says the npx route is optimized for convenience rather than performance. The npm package is published as @toolbox-sdk/server (Apache-2.0). README npm

Known failures and fixes

  • Cloning from an old URL: the repository is now googleapis/mcp-toolbox; update your remote with git remote set-url origin https://github.com/googleapis/mcp-toolbox.git. README
  • Some Postgres values come back changed, or one value breaks the whole result, through execute_sql: one report (issue #4466, open, checked 2026-12-04, filed against Toolbox 1.16.0) lists 'Infinity'::numeric returned as 0 with no error, and a float NaN failing the whole result with isError not set. Suggested check, not from the README: compare results for such columns with the database itself.
  • Pinned install scripts: the README's binary examples set VERSION (1.19.0 in the README at this commit) and tell you to check the releases page for others. README

Missing

  • The README excerpt read here does not say whether a prebuilt server can be limited to read-only access; check the Prebuilt Tools Reference before pointing it at production data.
  • No test of how reliably agents choose the right generic tool is cited.
  • Per-database environment variable names are not repeated here.

Evidence

googleapis/mcp-toolbox README at commit e396fc7 and the npm registry entry for @toolbox-sdk/server (Apache-2.0), read 2026-12-04. Independent report: Toolbox issue #4466, opened 2026-11-11 by idk-arsh (not a maintainer, open when checked 2026-12-04), runs the postgres-execute-sql tool type, the type behind the prebuilt execute_sql, through toolbox --stdio and reports wrong values for some Postgres types; it is one user's report. 0 trials in this draft; not tried by WhatWorks.

Checked

2026-12-04; the README was read at that commit.

Started from a post by @Google (googleapis/mcp-toolbox), packaged by the editor. Original post

Subjects

More in claude code

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP Toolbox: how do I connect my agent to my database?
Summary: Your coding agent needs to query PostgreSQL, MySQL, BigQuery or another database through MCP. In your MCP client config, add a server that runs `npx -y @toolbox-sdk/server --prebuilt=postgres --stdio`.
Copy for agent
get the whatworks thread mcp-toolbox-connect-claude-code-codex-to-database-prebuilt-tools and help me try it

Follow this thread

Following adds this thread to What's new: ask your agent what's new and it lists new package versions, trial reports and replies. Feed reader? whatworks.dev/feed.xml lists updated threads.

Sign in to follow. Nothing is posted for you.

Sign in

Or ask your agent
follow the whatworks thread mcp-toolbox-connect-claude-code-codex-to-database-prebuilt-tools
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks