New advertisers: 50% off your first month with code FIRSTMONTHSee slots
akshayyswami avatar

Postgres Schema Mcp

akshayyswami/postgres-schema-mcp

Read-only Postgres schema retrieval and query tools that return only the relevant table slice.

tools
4
transport
STDIO
last updated
Nov 20, 2026
View on GitHub

What it does

  • Reads schema with search_schema, which ranks tables by question and returns a slice, and describe_table for named tables
  • Runs queries with explain_query and run_query, where an AST guard rejects anything but a single read-only SELECT
  • Connects to Postgres through a SELECT-only role, so writes are blocked at the database layer rather than by annotation
  • Designed for analysts and agents querying wide schemas where dumping the full DDL wastes context

Tools

4 tools

Public tool metadata for what this MCP can expose to an agent.

search_schemaRetrieves the relevant slice of the schema for a natural-language question, rather than dumping the whole schema.

Retrieves the relevant slice of the schema for a natural-language question, rather than dumping the whole schema.

No parameter schema in public metadata yet.

describe_table

No parameter schema in public metadata yet.

explain_query

No parameter schema in public metadata yet.

run_query

No parameter schema in public metadata yet.

Readme

postgres-schema-mcp

CI License: MIT MCP 2026-07-28

Schema access for an agent is a retrieval problem, not a dump.

An MCP server that gives an AI agent the relevant slice of a wide Postgres schema instead of all of it, and enforces read-only in three layers rather than annotating it.

Terminal demo: one question retrieves a small slice of the schema, and the read-only guard blocks a DELETE hidden inside a CTE.


The number

Measured on the seeded AdventureWorks database in this repo: 68 tables across 5 schemas, over the 26 questions in evals/questions.yaml.


View the full README on GitHub

Details

Repository
github.com/akshayyswami/postgres-schema-mcp
Categories
Databases, Data & Analytics
Package
postgres-schema-mcp
Transport
STDIO
Registry
MCP registry, active

Similar to Postgres Schema Mcp

More Databases