MCP Toolbox for Databases security: what to configure before an agent touches your data

MCP Toolbox for Databases gives agents database tools from a YAML file. Its safest mode is the one most quick starts skip. Here is what each mode allows, and the settings that matter.

The short answer

MCP Toolbox for Databases is Google’s open source MCP server for databases, configured with a tools.yaml file of sources, tools and toolsets.1 It’s safe when you use it the way it’s designed: custom tools with fixed, parameterised SQL. It’s risky when you start it with --prebuilt and hand an agent execute_sql, which runs any statement the agent writes. Toolbox’s own docs say that tool “is intended for developer assistant workflows with human-in-the-loop and shouldn’t be used for production agents.”2

Toolbox has a strong read-only mode, but its engine-level lock is documented for four Google Cloud engines (Cloud SQL for PostgreSQL and MySQL, AlloyDB and BigQuery).4 For a self-hosted Postgres source, connect with a read-only database role as well.

Every MCP tool call goes through your rules first. Here a delete that doesn’t say which rows is stopped before it reaches the database. These are the rules deedglass init starts with; the call is made up.

What Toolbox is

Toolbox sits between an MCP client (an IDE, Claude, an agent framework) and your databases. It handles connections and exposes tools. The project is Apache-2.0 licensed, and its docs are at version 1.15.0 as of this writing.1 It supports Google Cloud databases and many others, including PostgreSQL, MySQL, SQL Server, MongoDB and Snowflake.1

A configuration has three main parts:

Part What it holds
Sources Connections: host, database, user, credentials1
Tools What the agent can do: a type, a source, parameters, a description, and for SQL tools the statement1
Toolsets Named groups of tools to load together1

It also emits OpenTelemetry traces and metrics1, which helps you see which tools an agent called, though not what each call changed in the database.

Custom tools vs prebuilt execute_sql

This is the decision that matters most.

Custom tools fix the SQL in the config file. The agent supplies only parameter values:

Code A settings file: the rules a tool reads before it acts.

kind: tool
name: search-hotels-by-name
type: mysql-sql
source: my-mysql-source
description: Search hotels by name.
parameters:
  - name: name
    type: string
statement: SELECT * FROM hotels WHERE name LIKE CONCAT('%', ?, '%');

The agent can search hotels by name. It can’t drop the table, read another table, or update anything, because no statement that does those things exists in the config. That is a real tool-call policy: the allowed actions are the listed ones.

Prebuilt tools are the quick start. Running Toolbox with --prebuilt=<database> loads standard tools such as list_tables and execute_sql.1 postgres-execute-sql takes a single sql parameter and runs it.2 Whatever the database user can do, the agent can now do.

Custom SQL tools Prebuilt execute_sql
Who writes the SQL You, in tools.yaml The agent, at run time
What the agent can change Only what your statements change Anything the database user can
Prompt injection impact Limited to your statements’ parameters Arbitrary SQL
Toolbox’s own guidance The intended pattern Developer workflows with a human in the loop2

Use prebuilt tools to explore a dev database from your IDE. For an agent that runs unattended or near production data, write custom tools.

Read-only mode, and where it applies

Toolbox’s read-only feature is better than most. Setting readOnly: true on a source enables what its docs call an immutable protocol-level lock, and how it’s enforced depends on the engine:4

Engine How Toolbox enforces read-only
Cloud SQL for PostgreSQL Session read-only parameter on the connection; writes fail with SQLSTATE 250064
AlloyDB for PostgreSQL Same approach4
Cloud SQL for MySQL Read-only connection attribute in the driver4
BigQuery A dry-run check that rejects anything other than SELECT4

In read-only mode Toolbox also removes write tools from the catalog and marks the exposed ones with readOnlyHint: true.4 Prebuilt servers take environment variables such as CLOUD_SQL_POSTGRES_READONLY=true.4

The important detail is the table’s length. A plain postgres source pointing at your own server, Neon, Supabase or RDS isn’t in that enforcement list.4 For those, read-only has to come from the database: a role with SELECT grants and nothing else. A read-only transaction opened by the tool layer can be escaped, as the Postgres MCP read-only bypass showed, and a session setting the role can change isn’t enough either. Our read-only Postgres role comparison shows how to build one.

Also remember that readOnlyHint is a hint to the client.4 Clients may use it to skip a confirmation step, so make sure the hint is true before you rely on it.

Authentication and per-user data

Toolbox has its own auth services, google (Google Sign-In) and generic (any OIDC provider).3 They give you two useful controls:

  • Authorized invocation. A tool with authRequired only runs for callers with a valid token; Toolbox rejects calls that fail to validate.3
  • Authenticated parameters. A parameter’s value comes from a claim in the caller’s ID token instead of from the model.3

The second is the one to use for per-user data. If a tool’s statement is SELECT * FROM orders WHERE user_id = ? and that ? is filled from the signed token, the agent can’t ask for someone else’s orders by changing an argument, because it never supplies the argument. That closes a common hole in agent tools, where the model is trusted to pass the right user id.

Toolbox can also protect the whole MCP endpoint with MCP Authorization (mcpEnabled: true), but only with the generic auth type.3 Our MCP server security basics cover where that layer fits.

What Toolbox doesn’t do

Toolbox is a well-designed tool layer. Like any tool layer, it has edges:

  • It doesn’t check results. If an agent calls an update tool, Toolbox runs it. Whether one row or ten thousand changed is up to your statement and your data.
  • It doesn’t add approvals. Human review of a risky call happens in the MCP client, if the client offers it.
  • It’s only as narrow as the database user. With execute_sql, the source credentials are the real limit. A source configured with an owner or admin user gives the agent an owner or admin.
  • Engine-level read-only covers four engines in its docs.4

None of these are criticisms. They’re the boundaries of what an MCP server can know. The checks that matter for writes, such as approval before risky calls and a read-back after, sit beside it. Our best Postgres MCP server comparison puts Toolbox’s approach next to others.

A setup checklist

  1. Prefer custom SQL tools with fixed statements over --prebuilt for any agent you don’t watch call by call.2
  2. Give each source its own database user with the narrowest grants that work.
  3. Turn on readOnly: true where it’s enforced; for other Postgres sources, use a SELECT-only role as well.4
  4. Use authenticated parameters for any per-user lookup.3
  5. Require auth on tools that read sensitive data or write anything.3
  6. Group tools into toolsets per agent, so each agent loads only what it needs.1
  7. Send OpenTelemetry to your tracing backend, and keep a separate record of what writes changed.1

To try approvals and read-backs on a real database in your browser, open the playground. To grade which database tools and credentials your coding agents can reach on your own machine, run npx deedglass scan (the grade, explained).

Written with AI assistance and checked against our claims register.

The takeaway

Toolbox's docs say execute_sql isn't for production agents; its read-only lock covers 4 Google engines, so plain Postgres still needs a read-only role.

Read nextThe best Postgres MCP server depends on its brakes: five compared Try it: install in 7 s

Related on this site

More posts

Sources

  1. 1googleapis/genai-toolbox (MCP Toolbox for Databases) on GitHub · github.com · checked 27 October 2026
  2. 2MCP Toolbox docs: postgres-execute-sql · mcp-toolbox.dev · checked 27 October 2026
  3. 3MCP Toolbox docs: Authentication · mcp-toolbox.dev · checked 27 October 2026
  4. 4MCP Toolbox docs: Read-only tools · mcp-toolbox.dev · checked 27 October 2026

Published 27 October 2026, sources last checked 27 October 2026. If something here is out of date, write to hello@deedglass.com.

Try it on your own setup

npx deedglass scan

Grades only your own setup. Nothing is uploaded.

Pricing