An MCP (Model Context Protocol) server that lets an LLM agent safely
explore and query a PostgreSQL + PostGIS database. Every database tool
runs inside a SET TRANSACTION READ ONLY block with a short
statement_timeout and is unconditionally rolled back.
GET / — this pageGET /health — JSON healthPOST /mcp — MCP streamable HTTP transportGET /llms.txt · /llms-full.txt · /robots.txt · /sitemap.xml| Tool | Purpose |
|---|---|
list_tables | User tables/views with row estimate & geometry flag. |
get_table_schema | DDL + sample rows + indexes for one table. |
get_column_values | Distinct sample values for one column. |
list_srids | SRIDs in active use across geometry columns. |
get_relationships | Foreign-key edges. |
list_extensions | Installed extensions (PostGIS, pgvector, ...). |
pick_interesting_tables | Score by rows + geometry + FK hubness. |
validate_sql | Static SQL safety check (no DB needed). |
explain_sql | EXPLAIN [ANALYZE] inside a rolled-back tx. |
execute_sql | Read-only SELECT/WITH/EXPLAIN with row caps. |
postgis_help | Curated PostGIS recipe reference. |
list_sections / get_documentation | Doc manifest browser. |
run_locally | Plan-only execution recipes (psql, pg_dump, ogr2ogr, ...). |
export PG_DOCSBOX_DSN=postgresql://user:pass@host:5432/db postgres-postgis-docsbox-mcp
{
"mcpServers": {
"postgres-postgis-docsbox": {
"type": "http",
"url": "http://127.0.0.1:7820/mcp"
}
}
}