Skip to main content

Crate postgres_mcp

Crate postgres_mcp 

Source
Expand description

Read-only MCP server for PostgreSQL and TimescaleDB.

Re-exports§

pub use server::AppState;
pub use server::build_router;
pub use server::run;

Modules§

audit
Audit log: one audit target line per tool call, with no SQL text, values or error detail.
config
Environment-only configuration: server, API key, limits, toolsets, logging and database connections.
encode
Decodes PostgreSQL TEXT-format values into JSON, lossless or capped.
gate
Read-only query gate: accepts one statement that is provably read-only, rejects the rest.
http_guard
HTTP access guard: Origin allow-list, optional API key, and the JSON errors they return.
pg
resources
MCP resources and completions: a summary per database, and the schema and table views the tools return.
scrub
Password hash scrubber: replaces text shaped like a PostgreSQL password hash wherever text leaves the server.
server
Command line, shared state, HTTP router, stdio serving and the local health check.
tools
MCP tool layer: error texts, the shared query runner, the tool catalog and the rmcp server handler.
typeinfo
Resolves column type OIDs: built-ins from the static table, other types from pg_type, cached per OID.