Start a project Estimate a range

Public MCP tools, Markdown pages and a project brief API. No account required.

Integration

PostgreSQL MCP integration with bounded, read-only access

The safe database integration is not a text-to-SQL endpoint. It is a small set of named views with a dedicated role, limits and no path to a write.

Request integration

In short

A PostgreSQL MCP integration exposes allowlisted views or functions through read-only tools. It uses a dedicated database role, parameterized queries, statement timeouts and row limits. Arbitrary SQL, schema changes and writes are excluded from the default profile.

What the integration exposes

Default PostgreSQL tool surface
ToolInputReturnsGuardrail
list_viewsnoneNames and descriptions of approved viewsAllowlist only
describe_viewviewColumn names, types and descriptionsAllowlist only
query_viewview, filters, limitRows from one approved viewParameterized, 100-row cap
get_rowview, keyOne row by primary keyAllowlist and key type check

Why not text-to-SQL

Text-to-SQL is impressive in a demo and difficult to bound in production. The model can write a join that scans a large table, read columns the user should not see, or construct a statement that is valid but expensive.

Named views move the modeling decision into the database, where you can review it, grant it and explain it. The model chooses filters, not the schema. If a workflow needs a new question answered, you add a view and review the query plan.

Prerequisites

  • A dedicated login role with SELECT on the approved views only.
  • A read replica or a low-privilege schema for production reads.
  • Views that already enforce row-level security or tenant filters.
  • A network path from the runtime with TLS and an IP allowlist.
  • A statement timeout and a connection pool size agreed with your DBA.
  • A documented owner for view changes.

Controls that are not optional

Database control baseline
ControlSettingEffect
Statement timeout5 seconds, tuned per viewStops expensive accidental queries
Row limit100 rows per callKeeps results inside the model context
ParameterizationEvery filter bound as a parameterPrevents SQL injection
Identifier allowlistExact view and column namesPrevents schema probing
Role permissionsSELECT only, no schema usage beyond viewsPrevents writes and DDL
LoggingQuery fingerprint, actor, durationSupports review without storing row data

Performance and failure behavior

We test each view with representative data and record its plan and p95 latency. A view that cannot answer within the timeout is rewritten, indexed or removed from the surface; we do not raise the timeout to hide a slow query.

When the database is unavailable, the tool returns a bounded error with a retry hint. The server does not retry non-idempotent work, and it never returns a partial row set without labeling it.

Questions people ask before starting

Can the assistant write to the database?

Not in the default profile. The role has SELECT only, and write tools are excluded. If a write is required, it becomes a separate, narrowly scoped tool with approval and idempotency.

Can it run any SQL the model writes?

No. The model selects a view and supplies parameterized filters. The server validates the view against an allowlist and rejects anything else.

Does this work with row-level security?

Yes, and we recommend it. The database role should see only the rows the tenant or user is allowed to see, so the boundary is enforced below the MCP server as well.

What about sensitive columns?

They are excluded from the view or masked before the view is granted. We do not rely on the model to avoid selecting them.

Next step

Scope a database boundary

Send the questions the assistant must answer. We will map them to views and show the limits before code.

Last verified .

Start a project

Tell us what you need

Used only to reply. No newsletter.

System, AI client and action. Do not include secrets or personal data.

No account. A reference code is returned immediately. Prefer an agent? Use the agent hub.

Copy manually

Clipboard access was blocked. Select the text and copy it.