MCP Server Security Checklist for Databases: 14 Controls

14 security controls a database MCP server needs before an AI agent touches production data, scored on four servers we tested, ours included.

Key takeaways

  • Test what the server does, not what it says. We checked every write by reading the SQLite file back over a separate read-only connection. Annotations and tool names don't prove anything.
  • Defaults differ a lot. With out-of-the-box settings, write attempts landed on DBHub, MCP Toolbox and ExecuteAutomation. Only Faucet rejected an unauthenticated MCP request (401). DBHub and MCP Toolbox answered with 200.
  • Read-only can be enforced, but differently on each server. Faucet blocked 0/9 writes with a GET-only role, DBHub 0/4 with readonly = true, and Toolbox 0/4 only through a SQLite mode=ro URI. ExecuteAutomation has no read-only mode.
  • Row caps are rare by default. Faucet returned 25 rows (1,000 max) for SELECT * FROM InvoiceLine; DBHub, MCP Toolbox and ExecuteAutomation returned all 2,240.
  • Put a least-privilege database account under every server. Server-side read-only checks have been bypassed before: DBHub fixed two read-only bypasses in June 2026, and AWS fixed one in its Postgres MCP server in September 2026.

A database MCP server is the shortest path from a prompt to your production data. These 14 controls decide what that path can reach, and we scored four servers against them, including our own.

What makes a database MCP server secure?

A database MCP server is ready for production data when it passes 14 checks: authentication on every network endpoint, including schema endpoints; safe bind, Origin and TLS defaults; server-enforced read-only and per-table permissions that apply on every transport; raw SQL off by default; row, time and rate limits; honest tool annotations; hashed, revocable credentials; per-user identity with an audit trail; and verifiable installs, all running on a least-privilege database account.

We ran four servers against the checklist on 2026-10-16: DBHub, ExecuteAutomation database-server, Faucet (the open-source database-to-REST-API and MCP server we make) and Google’s MCP Toolbox for Databases. DBHub, ExecuteAutomation and MCP Toolbox each failed several controls. The scorecard below shows how each one did.

Database MCP server security compared at a glance

T = we ran it on 2026-10-16. D = the project’s own docs or advisories. S = Faucet source code. Columns are alphabetical. Details are under each control below.

ControlDBHub 1.5.0ExecuteAutomation 1.1.0Faucet (dev build v0.1.15-4)MCP Toolbox 1.14.0
1. Auth on every endpointNo: off by default (T)n/a: stdio only— †No: off by default (T)
2. Safe network defaultsPartial: 0.0.0.0 (T); Host allowlist (D)n/a: stdio only— †Yes: 127.0.0.1 (T)
3. Server-enforced read-onlyYes: 0/4 landed (T)No: 3/3 landed (T)Yes: 0/9 landed (T)SQLite: no switch (T); Cloud SQL: yes (D)
4. Per-table, per-verb permissionsNo: per tool (D)No (D)Yes: verb tested (T), table (S)Partial: per-tool auth (D)
5. Same rules on every transportNot testedn/a: one transport— †Not tested
6. Row- and column-level rulesNo (D)No (D)No: table-level roles; use DB views or RLS (S)Partial: claim-bound params (D)
7. Raw SQL off or gatedNo: on by default (T)No: always on (T)Yes: refused by default (T)No: prebuilt config (T)
8. Guards on destructive writesNo (D)Partial: drop_table confirm (D)Partial: empty filter refused (S)No (D)
9. Row and time limitsConfigurable; none by default (T, D)No: 2,240 rows (T)Partial: 1,000-row cap (T)No: 2,240 rows (T)
10. Rate and size limitsNo: gateway advised (D)n/a: stdio only— †Not documented (D)
11. Honest annotations, minimal toolsYes: 1 tool read-only (T)No annotations (T)— †Over-flagged (T)
12. Credential storage and lifecycleStatic tokens (D)Passwords as CLI args (D)— †Your IdP’s tokens (D)
13. Per-user identity and auditNo OAuth (D)No (D)— †Yes: OIDC, OTel (D)
14. Advisories and verifiable installsYes: 3 advisories, fixed (D)Partial: no release since May 2025 (D)— †Partial: security policy (D)

† Re-testing on Faucet v0.1.16.

The checklist (copy this)

  • Unauthenticated requests to /mcp, schema and spec endpoints (such as /openapi.json), setup endpoints and every other path return 401 or 403.
  • The HTTP listener binds to 127.0.0.1 unless it sits behind a proxy, rejects unexpected Origin and Host headers, and has TLS in front of it.
  • A write sent through every tool in read-only mode is absent when the database is re-read over a separate read-only connection.
  • The agent’s credential can reach only the tables and verbs it needs, and cannot run DDL.
  • The local (stdio) mode applies the same restrictions as the HTTP endpoint, or is never pointed at production.
  • Rows and columns the agent must never see are blocked by views or row-level security in the database.
  • Raw SQL is off, or allowed only when the server connects as a database user with no write or DDL grants beyond what the agent needs.
  • An update or delete without a WHERE clause is refused, and table drops are impossible for the agent.
  • SELECT * on your largest table returns at most N rows, and a long query is killed after T seconds.
  • A loop of 1,000 tool calls is throttled by the server or a gateway in front of it.
  • tools/list for the agent’s credential shows only the tools it may call, with accurate readOnlyHint and destructiveHint.
  • Keys are hashed at rest, expire, and can be revoked; admin passwords use a slow salted hash.
  • Each agent has its own credential, and server and database logs record which one made each call.
  • You are watching the project’s security advisories, and you verified the checksum or signature of the binary you run.

How we evaluated

Criteria. The 14 controls map to the MCP specification’s requirements (2026-07-28 revision: servers must validate inputs, implement access controls and rate-limit tool invocations; Streamable HTTP servers must validate Origin, should bind to localhost when local, and should authenticate every connection) plus the failures that have actually hit database MCP servers: read-only bypasses, unauthenticated endpoints and over-broad credentials.

Hands-on, 2026-10-16. We ran Faucet (an unreleased build from source, v0.1.15-4-g2327d63), DBHub 1.5.0, MCP Toolbox for Databases 1.14.0 and ExecuteAutomation database-server 1.1.0 against the Chinook 1.4.5 SQLite database, with a fresh copy for each tool and mode. Each server got an INSERT, an UPDATE and a DELETE through every write path. The raw-SQL tools of DBHub, Toolbox and ExecuteAutomation also got a CTE-prefixed DELETE (WITH x AS (SELECT 1) DELETE ...). Faucet refused raw SQL before execution in every mode we tested, so we did not send it the CTE variant. A write counted as landed only if a separate mode=ro SQLite connection could see it in the file, regardless of what the server replied. We also sent unauthenticated requests and a SELECT * on the 2,240-row InvoiceLine table. Machine: Linux x86_64, 8 vCPU, 15 GB RAM.

From docs or code. Cells marked D come from each project’s README, docs site or GitHub security advisories, listed in Sources. Cells marked S come from reading Faucet’s source. We did not test OAuth flows, Postgres, MySQL or SQL Server in this run. The harness (a stdlib-only Python MCP client plus run scripts) and the raw JSON results are available on request.

The 14 controls

1. Authentication on every network endpoint, including metadata

Why: An HTTP MCP endpoint without auth lets anyone who can reach the port run the tools. Schema and spec endpoints matter too: they tell an attacker your table and column names.

Test:

curl -s -o /dev/null -w '%{http_code}\n' -X POST http://HOST:PORT/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Repeat for every path the server exposes, not just /mcp.

Results: Faucet returned 401 on /mcp, the table API and the per-service _doc spec.

DBHub returned 200 with auth disabled by default, and its /api/sources endpoint also returned 200; its docs add --auth-token for bearer tokens. Toolbox returned 200 in its default configuration.

2. Safe network defaults: bind address, Origin checks, TLS and CORS

Why: The MCP spec says local servers should bind to 127.0.0.1 and must validate Origin to block DNS rebinding, where a web page in your browser talks to a server on your machine. DBHub’s CVE-2026-61742 (fixed in 0.22.5) was exactly that.

Results: Toolbox bound to 127.0.0.1 in our run. DBHub bound to 0.0.0.0, and its docs warn about that default. Its --allowed-hosts DNS-rebinding protection is on by default, though: requests whose Host isn’t loopback or the machine itself get a 403.

3. Read-only enforced by the server

Why: “Please only read” in a prompt is not a control. The server has to refuse the write.

Results: Faucet blocked 0/9 writes for a GET-only role and API key, over both REST and MCP. The harness used the shortest form, which grants GET on every service and component (*/*):

faucet db add --name chinook --driver sqlite --path chinook.db
faucet role create --name readonly --verbs GET
faucet key create --role readonly

For a real agent, scope the role to one service’s tables instead:

faucet role create --name support-reader --service chinook \
  --component "_table/*" --verbs GET

Faucet’s per-service read_only flag also blocked 0/9 over HTTP, even for an admin with raw SQL enabled, and 0/6 over stdio. You set it in the admin UI or with PUT /api/v1/system/service/<name> and {"read_only": true}.

DBHub blocked 0/4, including the CTE DELETE, with a seven-line dbhub.toml:

[[sources]]
id = "chinook"
dsn = "sqlite:///path/to/chinook.db"

[[tools]]
name = "execute_sql"
source = "chinook"
readonly = true

Since 0.22.6, DBHub’s read-only combines a per-engine keyword check with engine-level enforcement: SQLite opens read-only, Postgres sets default_transaction_read_only, and MySQL and MariaDB run inside a READ ONLY transaction (its source notes that DDL can still escape that transaction through an implicit commit, so the keyword check has to catch it).

Toolbox’s SQLite source has no read-only option, so we used SQLITE_DATABASE=file:/path/chinook.db?mode=ro, which blocked 0/4; that is SQLite enforcing it, not Toolbox. For Cloud SQL (Postgres and MySQL), AlloyDB and BigQuery, Toolbox documents a readOnly: true source setting and *_READONLY environment variables that lock the session at the engine and prune write tools (documented, not tested). ExecuteAutomation’s read_query refused 4/4 non-SELECT statements, but write_query is always listed, and 3/3 writes landed through it.

A server’s read-only mode is the second layer; the guarantee comes from a database user that cannot write. How to set that up per engine.

4. Per-table, per-verb permissions

Why: An agent that answers billing questions has no reason to see the users table, but a database-wide grant gives it that access. Scoping by table and verb limits what a prompt injection can reach.

Results: Faucet roles grant verbs (GET, POST, PUT, PATCH, DELETE) per service and component pattern, and services a role can’t reach disappear from the agent’s service list. We tested per-verb denial; per-table scoping comes from the source. Scope agent roles to _table/* as shown above, so they can reach table data but not the _schema endpoints that create, alter and drop tables. See Faucet’s RBAC docs.

DBHub’s settings apply per tool, not per table; you can define custom parameterized tools instead. Toolbox’s model is curated tools in a config file, with “authorized invocations” that check a caller’s token before a tool runs (documented, not tested).

5. The same rules on every transport

Why: If HTTP is locked down but a local mode ignores roles, the local mode becomes the way around them.

Results: Faucet’s service read_only flag applied over stdio as well as HTTP: 0/6 writes landed over stdio. DBHub’s read-only setting lives in the config file rather than the transport, but we only tested it over HTTP.

6. Row- and column-level restrictions

Why: Table-level grants can’t express “only this customer’s rows” or “never the SSN column”. Without them, a support agent can pull every customer’s sensitive columns in one query.

Results: Faucet’s roles are table-level, so use database views or PostgreSQL row-level security underneath. DBHub and ExecuteAutomation document no row or column controls. Toolbox’s authenticated parameters fill a query parameter from a claim in the caller’s OIDC token, which lets a custom tool filter rows per user (documented, not tested).

7. Raw SQL off by default, or gated

Why: Raw SQL turns read-only enforcement into a parsing problem, and keyword checks are where bypasses live. DBHub’s CVE-2026-61788 (fixed in 0.22.6) was a SELECT calling a function that writes: the intended database-level read-only setting was never applied, which left only a keyword check. CVE-2026-61789, fixed in the same release, let a statement hidden after -- pass the check on MySQL and MariaDB, because those engines only treat -- as a comment when whitespace follows.

Results: Faucet’s faucet_raw_sql was refused with defaults. It only runs when the service allows raw SQL, isn’t read-only, and the role grants all five verbs on _sql.

DBHub, the prebuilt Toolbox SQLite config and ExecuteAutomation expose raw SQL by default; in our runs, 4/4 writes landed through DBHub’s and Toolbox’s execute_sql, including the CTE DELETE. Our analysis of a Postgres MCP read-only bypass shows why stacked statements defeat naive checks.

8. Guards on bulk and destructive writes

Why: DELETE FROM orders with a forgotten WHERE clause is the classic agent incident (we collected several in AI agent security incidents involving databases, and the PocketOS wipe shows how token scope decides the blast radius).

Results: Faucet’s REST and MCP update and delete paths refuse a request with no filter or ids, but a filter that matches every row, such as ArtistId > 0, still runs. ExecuteAutomation’s drop_table requires confirm: true, but write_query has no such guard. DBHub and Toolbox’s execute_sql run whatever they are given unless read-only.

9. Row and time limits

Why: An unbounded SELECT * floods the agent’s context and can exfiltrate a table in one call. A runaway query can hold locks.

Results: Faucet’s REST API and faucet_query returned 25 rows by default and clamped limit=5000 to 1,000. Raw SQL, when enabled, defaults to 100 rows with a 10,000 maximum and a 30-second timeout capped at 300 seconds. DBHub, Toolbox and ExecuteAutomation all returned all 2,240 rows by default. DBHub documents max_rows and query_timeout in its TOML file.

10. Rate and request-size limits

Why: The MCP spec says servers must rate-limit tool invocations. An agent in a loop can issue thousands of calls a minute.

Results: DBHub has no built-in limit; its docs recommend a fronting gateway or WAF and expose per-tool routing headers so one can rate-limit individual tools. We found no rate-limit settings in Toolbox’s docs. ExecuteAutomation runs only over stdio, so it has no network surface to limit.

11. Honest tool annotations and a minimal tool list

Why: Clients use readOnlyHint and destructiveHint to decide when to ask a human. The spec says clients must treat them as untrusted unless the server is trusted, so they help usability, not security. The 2026-07-28 spec also allows the tool list to vary by the caller’s authorization, which is how a server should hide tools a credential can’t use. Fewer tools also means less surface for tool poisoning.

Results: DBHub sent a full set of hints, and its read-only config shrank tools/list to one tool (112 tokens, o200k). Toolbox marked both tools destructiveHint: true, including list_tables, which is cautious but means clients will prompt on harmless calls. Faucet lists eight structured CRUD and schema tools rather than a single execute_sql (the largest list here, 1,400 tokens, o200k). ExecuteAutomation sent no annotations.

12. Credential storage and lifecycle

Why: Agent credentials leak through config files, logs and shell history. They need to be scoped, expiring and revocable, and stored hashed, so a leaked database dump or log file doesn’t hand out working keys.

Results: Faucet API keys are 32 random bytes, stored as a SHA-256 hash, shown once, with optional expiry and revocation by prefix. DBHub uses static bearer tokens from a flag or environment variable. Toolbox delegates tokens to your identity provider. ExecuteAutomation’s README examples pass database passwords as command-line arguments, which show up in process listings.

13. Per-user identity, OAuth and an audit trail

Why: A shared service key means every query looks like the same user. The MCP authorization spec uses OAuth 2.1 and requires servers to accept only tokens issued for them, so a server can know who is asking.

Results: Faucet authenticates agents with API keys, so give each agent its own key, and pair any server with database-side statement logging. Toolbox documents MCP authorization with a generic OIDC provider (mcpEnabled: true) and exports OpenTelemetry traces and metrics; we did not test either. DBHub documents no OAuth. For background, see the MCP auth spec and the database security boundary and why on-behalf-of tokens are replacing service accounts.

14. Published advisories and verifiable installs

Why: You can’t patch what you don’t hear about, and an install script that skips checksums trusts the network.

Results: DBHub published three GitHub security advisories on 2026-06-24 (CVE-2026-61742, CVE-2026-61788 and CVE-2026-61789) and released the fixes the same day in 0.22.5 and 0.22.6, which is what good disclosure looks like; the 1.5.0 we ran is a later release that includes all three fixes. Toolbox links a security policy from its README. ExecuteAutomation links one too, but its last npm release (1.1.0) was on 2025-05-30 and its last commit was in August 2025, so don’t expect quick fixes. Faucet’s releases ship a checksums.txt.

Where each server passes and fails

Full profiles, features and setup for each server are in our open-source multi-database MCP servers comparison and the broader best MCP servers for databases. Here is the security summary only.

ServerPassesFailsConfigure before production
DBHub 1.5.0Read-only (0/4), minimal tool list, full annotations, fast advisoriesAuth off by default, 0.0.0.0 bind, raw SQL default, no per-table rules--auth-token, readonly = true, max_rows, query_timeout, a gateway for rate limits
ExecuteAutomation 1.1.0No network surface, drop_table confirmationNo read-only mode, no annotations, no row cap, no recent releasesA database user with only the rights you’d give the agent; scratch data only
Faucet (dev build)Auth on /mcp and data API, read-only role and service flag, raw SQL off, row cap— †Roles scoped to _table/*, read_only on services agents can reach, a least-privilege database account
MCP Toolbox 1.14.0127.0.0.1 bind, documented OIDC auth and OpenTelemetry, engine-level readOnly on Cloud SQL sourcesAuth off by default, raw SQL in the prebuilt SQLite config, no row capOIDC auth service, custom tools.yaml instead of prebuilt raw SQL, readOnly: true sources

† Re-testing on Faucet v0.1.16.

If you are choosing between DBHub and Toolbox specifically, the multi-database comparison covers that head to head.

Other servers we didn’t score

Our harness ran on SQLite, so we left out servers that target only Postgres, SQL Server or a hosted platform. Their documented controls, from their own docs:

  • Microsoft SQL MCP Server (Data API builder 1.7+). MIT. Per-entity role permissions with field include and exclude, applied identically across REST, GraphQL and MCP; no raw SQL (NL2SQL) and no DDL tools by design. Its stdio mode takes a role and defaults to anonymous. On paper it would pass controls 4, 5 and 7.
  • Supabase MCP. Apache-2.0. The hosted server uses OAuth 2.1 with organization selection, read_only=true hides mutating tools, and project_ref scopes it to one project. The local and self-hosted versions have no OAuth.
  • Postgres MCP Pro (crystaldba). MIT. --access-mode=restricted limits it to read-only transactions with an execution-time limit; stdio and SSE transports.
  • AWS Labs postgres-mcp-server. CVE-2026-87911 (AWS bulletin 2026-104, September 2026): before 1.1.7, a crafted COPY ... TO PROGRAM statement could pass read-only mode and run OS commands when the database role was a superuser or held pg_execute_server_program. Fixed in 1.1.7.
  • The archived reference Postgres server (@modelcontextprotocol/server-postgres). Datadog Security Labs showed that COMMIT; followed by a destructive statement escaped its BEGIN TRANSACTION READ ONLY wrapper. The npm package is archived; Zed’s fork carries the fix.

Engine-specific setups are in the Postgres MCP servers comparison and the SQL Server MCP servers comparison.

Conclusion

Run the checklist against whatever you deploy: send an unauthenticated request to every path, try a write in read-only mode and read the result back from the database, and SELECT * your biggest table.

Faucet fits if you want the same table-level roles for apps (REST) and agents (MCP) on self-hosted PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, Snowflake or SQLite. The Faucet getting started guide walks through install, a first database and an API key, and connecting Claude to your database covers the client side. Then lock it down with scoped roles, the service read_only flag and a least-privilege database account.

Frequently asked questions

Is the MCP readOnlyHint annotation a security control?

No. The MCP specification says clients must treat tool annotations as untrusted unless they come from trusted servers. Annotations help a client decide when to ask a human for confirmation. They do not stop a write. Enforcement belongs in the server (roles, read-only mode) and the database (a user without write privileges). More in MCP tool annotations and database safety.

Can an AI agent bypass a read-only database MCP server?

Yes, it has happened several times. DBHub fixed two read-only bypasses in 0.22.6 (CVE-2026-61788 and CVE-2026-61789), AWS fixed a COPY TO PROGRAM bypass in postgres-mcp-server 1.1.7 (CVE-2026-87911), and the archived reference Postgres server fell to stacked COMMIT statements. A database account that cannot write is the reliable defense. See Read-only that wasn't.

Should a database MCP server allow raw SQL?

Only when you need it, and not by default for production data. Raw SQL makes every statement the database accepts reachable by the agent, so read-only enforcement depends on parsing. Typed tools such as query, insert and update with a required filter are easier to restrict per table. If you enable raw SQL, pair it with a read-only database user, row limits and a timeout.

Do I still need a read-only database user if my MCP server has a read-only mode?

Yes. The server's read-only mode is a second layer that can have bugs; the database's own privilege check applies to whatever SQL reaches it, including statements a parser misreads. In our runs, a SQLite mode=ro connection blocked every write regardless of which server sent it. Per-engine setup is in how to give an AI agent read-only database access.

Which database MCP servers support OAuth?

Of the four we scored, only MCP Toolbox documents MCP authorization, using a generic OIDC provider; we did not test it. DBHub supports static bearer tokens, Faucet uses role-scoped API keys, and ExecuteAutomation runs over stdio only. Supabase's hosted MCP server uses OAuth 2.1.

How do I audit what an AI agent did in my database?

Combine two sources. Turn on database-side auditing or statement logging for the account the MCP server uses, and keep the server's own logs with a request ID. Give each agent its own credential so the two can be matched. Toolbox exports OpenTelemetry traces.

Sources

Last reviewed