What Is MCP Toolbox for Databases? Connecting an Assistant to a Database: Setup, tools.yaml, Read-Only Mode and Safety
An assistant can't reach the real data in your database on its own: if you ask for the number of orders, it waits for SQL or an exported file from you. MCP Toolbox for Databases (Google, open source) connects the assistant to the database. It has two routes: prebuilt tools (list tables, explain the schema, run SQL) and fixed, parameterized queries that you define in a tools.yaml file. You say "get the return rate by product for the last 7 days"; the assistant writes and runs SQL, or calls the tool you defined. The software is free. The prebuilt tools are for developer supervision: to limit the write risk, use a dedicated database user with SELECT permission only.
- What it does
- Connects the assistant to a database: schema exploration, SQL, fixed query tools
- Type
- MCP server (runs on your computer or your own server)
- Made by
- Google (official; code is Apache-2.0)
- Databases
- PostgreSQL, MySQL, SQL Server, Oracle, MongoDB, BigQuery, AlloyDB, Cloud SQL and more
- Where
- Claude Code, Claude Desktop, Codex, Cursor, VS Code, Gemini CLI
- Write access
- A prebuilt tool can write as far as the database user is allowed
- Cost
- Software is free; database and hosting costs are separate
What Is MCP Toolbox for Databases For?
A database is where a business's order, stock and customer data sits; without being connected to it, an AI assistant can only guess about them. MCP Toolbox for Databases is an MCP server that connects the assistant to the database. MCP is the standard for connecting AI programs to external tools; here the external tool is your database. Google develops it and publishes it as open source; its first name was "Gen AI Toolbox for Databases" (the repository moved from genai-toolbox to mcp-toolbox).
Who it helps: developers and data teams who want to query their own database with an assistant; e-commerce companies that set up safe, fixed query tools for their own dashboard or agent (in the docs' pattern: define parameterized queries on the order database and give the assistant only those). The docs describe Toolbox as developer and agent infrastructure; it isn't a ready-made dashboard for someone who doesn't know database administration: you write a terminal command or a YAML file.
How Does It Work? A Server Between the Assistant and the Database
You write your request in the chat. The assistant calls one of the tools Toolbox offers; Toolbox connects to the database, runs the query and sends the result back. Toolbox handles connection pooling, authentication and observability (OpenTelemetry) itself.
What's sent: the tool the assistant picks and its parameters (or the SQL it writes). What comes back: database rows. The rows go to the assistant and its AI service.
There are two routes; the docs separate them as "build-time" (during development) and "run-time" (for a running agent):
| Route | What it gives | When |
|---|---|---|
| Prebuilt tools (--prebuilt) | Ready-made generic tools by database type: list tables, show the schema, run SQL (execute_sql) and monitoring tools | A trusted developer exploring their own database; the docs say these aren't secure enough for agents talking to untrusted users |
| Custom tools (tools.yaml) | Fixed, parameterized queries that you define; the assistant can call only these | A running agent or dashboard; you write the query and the assistant only fills in the parameter |
tools.yaml is the definition file for custom tools; you separate several sections with ---. The section kinds:
| Section | What it defines |
|---|---|
| kind: source | Which database to connect to (type, address, user, password) |
| kind: tool | A job the assistant can do: which source, which parameters, which SQL it runs |
| kind: toolset | Groups of tools to load together (different groups for different agents) |
| kind: prompt | Ready-made prompt templates offered to the assistant |
| kind: resource | Read-only content the assistant can read (such as a schema file) |
| kind: authService | Authentication and authorization (Google, generic OIDC) |
By default Toolbox reloads tools.yaml changes by itself (turn it off with --disable-reload). To load one tool group, put the group name at the end of the client address: http://127.0.0.1:5000/mcp/<toolset_name>; in a prebuilt configuration, --prebuilt=postgres/data loads only the SQL tools.
Without Toolbox and With It
The chat is illustrative; the query's correctness depends on how clear the schema is and on the SQL the assistant writes. Check the result yourself against a few sample rows.
How Do You Use MCP Toolbox? What You Type and What You Get
After installing, ask for something about the database in a plain sentence. The prompts below are derived from the uses in the README and docs (schema exploration, running SQL, a custom tool); their outputs are described only as far as the docs describe them. Table and column names depend on your database.
What you get: the assistant reads the tables and schema information with the prebuilt list_tables tool and summarizes it for you. This job only reads; but because execute_sql is in the same tool set, limit the user's permissions from the start.
What you get: the assistant reads the schema, writes the SQL and runs it with execute_sql; saying "show me first" leaves the confirmation step to you. The docs say execute_sql is for developer-supervised use and shouldn't be used for live agents. If your database user has SELECT permission only, write attempts are rejected by the database.
The third way is to give a fixed query as a custom tool. The README's example: a parameterized tool that searches hotels by name. You write it in the tools.yaml file:
› kind: tool
name: search-hotels-by-name
type: postgres-sql
source: my-pg-source
description: Search for hotels based on name.
parameters:
- name: name
type: string
description: The name of the hotel.
statement: SELECT * FROM hotels WHERE name ILIKE '%' || $1 || '%';What you get: the assistant calls the search-hotels-by-name tool with the name parameter; Toolbox runs only the fixed SQL you defined, and the parameter takes the place of $1. The assistant can't write other SQL; all it can do is pick this tool and its parameter. In the same pattern you can define read-only tools such as a "daily sales summary" on an order database.
Don't write the password into tools.yaml in plain text: read it from an environment variable with password: ${DB_PASSWORD}. The docs recommend this.
How Do You Install MCP Toolbox?
First create a separate user for Toolbox in the database; for the prebuilt tools the docs recommend a user with SELECT permission on only the tables needed (see "Reading and writing"). Then choose your route: for the prebuilt tools you write an entry into the client's MCP setting, and for custom tools you write tools.yaml and run the server. The commands are taken from the README and docs.
Create a .mcp.json file in the project folder root (if it doesn't exist) and add this; fill the empty environment variables with your own values. The line below is the README's npx route; @toolbox-sdk/server@1.18.0 is written to pin the version.
› { "mcpServers": { "postgres": { "command": "npx", "args": ["-y", "@toolbox-sdk/server@1.18.0", "--prebuilt=postgres", "--stdio"], "env": { "POSTGRES_HOST": "", "POSTGRES_PORT": "", "POSTGRES_DATABASE": "", "POSTGRES_USER": "", "POSTGRES_PASSWORD": "" } } } }The README's line carries no version (the newest version comes with every run). The docs say the npx route is for convenience and that for performance and reliability you should use the binary or a container; the PostgreSQL guide shows the toolbox binary you downloaded as the command ("command": "./PATH/TO/toolbox", args: --prebuilt postgres --stdio). Restart Claude Code after the setting.
Open Claude Desktop, open the configuration file with Settings then Developer then Edit Config, add the mcpServers entry above and save. Then restart Claude Desktop; a hammer (MCP) icon should appear on the new chat screen.
The docs give the configuration line for the claude_desktop_config.json file. The Claude plan needed for a local MCP server in Claude Desktop isn't stated in the docs.
The PostgreSQL guide gives the same mcpServers entry for Cursor (.cursor/mcp.json), Windsurf, VS Code (Copilot), Cline, Gemini CLI and Gemini Code Assist; the README also names Codex and Google Antigravity (for Antigravity there is a one-click install in its MCP store).
For custom tools, download Toolbox as a binary (a Linux AMD64 example; the README has separate addresses for macOS and Windows), write tools.yaml and run it:
› export VERSION=1.18.0
curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/linux/amd64/toolbox
chmod +x toolbox› ./toolbox --config "tools.yaml"The server listens on 127.0.0.1:5000 by default. Give the client this address:
› { "mcpServers": { "toolbox": { "type": "http", "url": "http://127.0.0.1:5000/mcp" } } }On macOS there is also brew install mcp-toolbox, and with Go go install github.com/googleapis/mcp-toolbox@v1.18.0. For Windows the binary addresses are under windows/amd64 and windows/arm64. Always check the version on the releases page.
› export VERSION=1.18.0
docker pull us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION› docker run -p 5000:5000 -v $(pwd)/tools.yaml:/app/tools.yaml us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION --config "/app/tools.yaml"The README's run example shows an older version number (0.24.0) and says "use the version you pulled"; the line above uses the version you pulled.
› gemini extensions install https://github.com/gemini-cli-extensions/mcp-toolboxThe README also mentions Gemini CLI extensions for specific databases such as AlloyDB, BigQuery and Cloud SQL. After installing, check with /extensions list and /mcp list.
Reading and Writing: How Do You Limit the Assistant's Writes to the Database?
The prebuilt execute_sql runs the SQL the assistant writes with the database user's permissions (INSERT, UPDATE and DELETE included if the permission exists); draw the boundary in the database, the docs describe three layers:
- A dedicated database identity: Create a separate user for the assistant with SELECT permission on only the schemas, tables or views needed. Don't give an owner, admin, migration or application-write account. This layer works on every database.
- Read-only on the source: For Cloud SQL (PostgreSQL, MySQL), AlloyDB and BigQuery, write
readOnly: trueon the source (an environment variable on a prebuilt server). Toolbox locks the session at the engine level, removes write tools from the list and addsreadOnlyHintto the tools; a write attempt is rejected by the engine. - Fixed, parameterized tools: For a fixed workflow, define your own query in
tools.yamlinstead of usingexecute_sql; the docs recommend custom parameterized tools for fixed flows, and dynamic SQL tools for trusted exploratory read-only work.
| Database | Environment variable on a prebuilt server | What the engine does |
|---|---|---|
| Cloud SQL (PostgreSQL) | CLOUD_SQL_POSTGRES_READONLY=true | A lock is added to the connection string; writes fail at the engine |
| Cloud SQL (MySQL) | CLOUD_SQL_MYSQL_READONLY=true | The connection opens read-only; writes fail at the engine |
| AlloyDB (PostgreSQL) | ALLOYDB_POSTGRES_READONLY=true | A lock is added to the connection string; writes fail at the engine |
| BigQuery | BIGQUERY_READONLY=true | Statements other than SELECT are rejected before running (BIGQUERY_WRITE_MODE=protected allows writing only to temporary session tables) |
› kind: source
name: analytics-db
type: cloud-sql-postgres
project: production-data-42
region: us-central1
instance: analytics-instance
database: corporate
readOnly: true!The docs' read-only lock table covers only Cloud SQL (PostgreSQL, MySQL), AlloyDB (PostgreSQL) and BigQuery; on sources such as plain PostgreSQL and MySQL protection is up to the database user's permissions, so a SELECT-only user is essential there.
Which Programs and Databases Does MCP Toolbox Work With?
| Claude CodeYes | The docs have a .mcp.json setting. |
|---|---|
| Claude DesktopYes | The docs have a configuration file setting. |
| Cursor, Windsurf, VS Code (Copilot), ClineYes | The PostgreSQL guide has a setting for each. |
| CodexYes | The README lists Codex among the clients that can connect. |
| Gemini CLI, Gemini Code AssistYes | There are extensions and a setting for Gemini CLI; Gemini Code Assist is named in the guide. |
| Google AntigravityYes | The README: the prebuilt tools install with one click in Antigravity's MCP store. |
| Google Cloud databasesYes | AlloyDB, BigQuery, Cloud SQL (PostgreSQL, MySQL, SQL Server), Spanner, Firestore, Knowledge Catalog (formerly Dataplex). |
| Other databasesYes | PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, MongoDB, Redis, Elasticsearch, CockroachDB, ClickHouse, Couchbase, Neo4j, Snowflake, Trino and, as the docs put it, more; there is a prebuilt configuration page for SQLite too. |
The list was compiled from the README and docs pages. The prebuilt tool list differs for each database: see the current list on the docs' "Prebuilt Configs" page. "Not in the docs" doesn't mean it doesn't work.
Is MCP Toolbox Free? Cost and License
Toolbox itself is free and open source (Apache-2.0); there is no pricing page or plan in the official sources. The docs state plainly that no Google Cloud account or project is needed: some sources may require GCP credentials but Toolbox doesn't. The cost sits in the parts that remain yours: the database you connect to (for example Google Cloud services are billed separately) and the machine or hosting that runs the server. There is no Turkish lira price.
- Apache-2.0: using, modifying and distributing is allowed, commercial use included
- The source code is on GitHub; the binary, Docker image and npm package are published by Google
- The charges and terms of the database and cloud services you connect to are separate; Toolbox doesn't cover them
- Google Cloud's managed MCP servers are a separate product; the docs explain the difference in the FAQ
Source: the README and FAQ (November 23, 2026). This isn't legal or financial advice.
What Does MCP Toolbox Access, and What Data Leaves?
The connection details come from the environment variables in the MCP setting (such as POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD) or from tools.yaml; the docs advise not writing secrets into the file in plain text and using the ${ENV_NAME} form.
It reaches every table the database user is allowed to. The prebuilt PostgreSQL configuration can read table, schema and administration information (locks, active queries, statistics); execute_sql writes if the permission exists. Custom tools run only the query you defined. So the real permission control is the database user.
In HTTP mode the server listens on 127.0.0.1:5000 by default; --allowed-origins and --allowed-hosts default to every address (*), and authentication is added with authService.
The database rows that come back go to the assistant and therefore to its AI service. The docs don't describe Toolbox collecting and sending data on its own; logs go to standard output, and traces and metrics are sent only if you turn on an export such as --telemetry-otlp or --telemetry-gcp.
!Before giving the assistant a database, create a separate user with SELECT permission on only the tables needed, don't use the prebuilt tools in a live agent, and remember that in HTTP mode the --allowed-hosts and --allowed-origins defaults are open to every address.
This isn't a security certification. OSV lists no record for the npm package and there are no published security advisories on GitHub (November 23, 2026). Vulnerabilities are reported through g.co/vulnz.
Common Problems and Fixes
| What's happening | What to do |
|---|---|
| The prebuilt configuration can't connect to the database | Check that the environment variables are filled in the env section of the MCP setting: for PostgreSQL POSTGRES_DATABASE, POSTGRES_USER and POSTGRES_PASSWORD are needed, POSTGRES_HOST and POSTGRES_PORT are optional. For SQLite, SQLITE_DATABASE is the file path. |
| The tools don't show in the client | Save the setting and restart the client. In Claude Desktop a hammer (MCP) icon should appear on the new chat screen; in Gemini CLI list the servers with /mcp list. |
| A tools.yaml change doesn't take effect | Toolbox reloads the configuration by itself by default. If you turned it off with --disable-reload, restart the server. |
A "no project found" error with --telemetry-gcp | Make sure Application Default Credentials are available (GOOGLE_APPLICATION_CREDENTIALS or a compatible setup) and give the project ID with the --telemetry-gcp-project flag or the GOOGLE_CLOUD_PROJECT environment variable. |
| The npx route is slow or falls short | The docs say the npx route is optimized for convenience rather than performance; for steady use, use the binary or the Docker image. |
| Instructions you found under the old name (genai-toolbox) | The repository moved to the name mcp-toolbox. If you have a local clone, update the address with git remote set-url origin https://github.com/googleapis/mcp-toolbox.git. The docs also say the original configuration format is in the documentation for versions v0.26.0 and older. |
How Do You Uninstall MCP Toolbox?
- Remove it from the assistant: Delete the toolbox entry from the client's MCP configuration (
.mcp.json,claude_desktop_config.json,.cursor/mcp.jsonand so on) and restart the client. - Stop the server: If it runs in a terminal, stop it with Ctrl+C (the docs: "terminate signal"). You remove the
toolboxfile you downloaded, the Docker image you pulled, or the Homebrew install withbrew uninstall mcp-toolboxyourself; the docs don't describe uninstall steps separately. - The database side: Delete the database user you created for Toolbox or revoke its permissions; change the password if you used it elsewhere too.
Other Database Tools in the Same Class
There are other MCP servers that connect an assistant to a database. What sets Toolbox apart is that one server supports many database types (PostgreSQL, MySQL, BigQuery, MongoDB and others) and lets you define your own parameterized tools; the others focus on a single service. There is no ranking of which is better; try the one that fits your database and job. Google Cloud's managed MCP servers are a separate option too: according to the docs they need no setup, while Toolbox is open source and a server you host yourself.
Supabase MCP: connects to the database and management of Supabase projects
Frequently asked questions
What is MCP Toolbox for Databases and what is it for?
Google's open-source MCP server: it connects an assistant to databases such as PostgreSQL, MySQL and BigQuery. With prebuilt tools it explores the schema and runs SQL; it also offers the fixed, parameterized queries you define in tools.yaml as tools.
Is MCP Toolbox the same as genai-toolbox?
Yes. Because the project started before MCP, its first name was Gen AI Toolbox for Databases; the repository moved from googleapis/genai-toolbox to googleapis/mcp-toolbox.
How do I use MCP Toolbox with Claude Code?
Write an entry in the .mcp.json file at the project root with npx -y @toolbox-sdk/server and the arguments --prebuilt=postgres --stdio, fill in the POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DATABASE, POSTGRES_USER and POSTGRES_PASSWORD variables, and restart Claude Code.
How do I connect MCP Toolbox to a PostgreSQL database?
For the prebuilt configuration, run with the --prebuilt=postgres flag and give the connection details as environment variables. For custom tools, write a source with type: postgres and a tool of the postgres-sql type in tools.yaml, then start it with toolbox --config tools.yaml.
Is MCP Toolbox free, and do I need a Google Cloud account?
The software is free and open source (Apache-2.0). The docs say no Google Cloud account or project is needed. The cost of the database you connect to and of hosting is separate.
Can the assistant write to my database through MCP Toolbox?
The prebuilt execute_sql runs any SQL statement the database user is allowed to, so it writes if the permission exists. To block writes, use a user with SELECT permission only; Cloud SQL (PostgreSQL, MySQL), AlloyDB (PostgreSQL) and BigQuery also have a readOnly: true lock.
Which databases does MCP Toolbox support?
The README: AlloyDB, BigQuery, Cloud SQL, Spanner, Firestore and Knowledge Catalog, plus PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, MongoDB, Redis, Elasticsearch, CockroachDB, ClickHouse, Couchbase, Neo4j, Snowflake, Trino and more. The current list is on the docs' Prebuilt Configs page.
Related guides
Sources
- MCP Toolbox for Databases README
- Docs: introduction
- Docs: prebuilt configs
- Docs: read-only tools
- Docs: authentication
- Docs: IDE guide for PostgreSQL
- Docs: the postgres-execute-sql tool
- Docs: telemetry
- Docs: FAQ
- Google Cloud docs: prebuilt tools for BigQuery
- npm: @toolbox-sdk/server
Not clear in the official sources: An engine-level read-only lock for plain PostgreSQL and MySQL sources (the docs state it only for Cloud SQL (PostgreSQL, MySQL), AlloyDB (PostgreSQL) and BigQuery) · the Claude plan needed for a local MCP server in Claude Desktop · whether Toolbox sends data out on its own (the docs describe only telemetry you turn on) · the Turkish lira price (the software is free, with no pricing page). Each is covered in the relevant section along with what you can do.





