
Postgres Context Server
https://github.com/zed-industries/postgres-context-server- Category
- Developer Tools
- Rank
- No. 1645Tools index
Previous survey · No. 1651 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- zed-industries
- GitHub
- 27 stars
- Date
About
Model Context Protocol server for Postgres.
What it does
It connects an AI client to a PostgreSQL database, exposes table structure as resources and prompts, and accepts SQL through a query tool. Schema requests can target one table or collect every non-system table. Query results return as formatted JSON over standard input and output.
Why it's ranked here
The server offers useful database context with unusually little machinery. It combines schema discovery, prompt completion, and guarded querying in one executable package. However, a nullability bug can produce inaccurate table definitions, so its schema output needs verification before serious use.
What's good
Queries run inside read-only transactions, use prepared statements to block multiple statements, and destroy each query session afterward. Schema lookups parameterize table names. Clients can browse public tables as resources, request one or all schemas, and complete prompt arguments from discovered table names.
Tradeoffs
Generated table definitions reverse PostgreSQL nullability: nullable columns receive a not-null marker, while required columns do not. Schema discovery is also inconsistent. Resources list only public tables, but the all-tables path includes every non-system schema, and single-table lookups do not distinguish schemas with matching table names.
How to use it well
Use it when an MCP-capable assistant needs quick schema context and exploratory, read-only access to a trusted PostgreSQL database. Treat generated definitions as hints until the nullability issue is fixed. It does not provide migrations, writes, database administration, or an HTTP service.
Technical notes+
index.mjs creates an MCP Server with resources, tools, prompts, and completions over StdioServerTransport. It reads DATABASE_URL, uses pg.Pool, queries information_schema, and wraps the query tool in BEGIN TRANSACTION READ ONLY followed by ROLLBACK and forced client destruction. Its getSchema logic appears inverted: is_nullable === "NO" emits no constraint, while other values emit not null. package.json defines an ESM package with @modelcontextprotocol/sdk, pg, and zod dependencies, although zod is not imported by index.mjs.
Observed
- License
- MIT
- Primary language
- JavaScript using ECMAScript modules
- Packaging
- Public npm package named @zeddotdev/postgres-context-server
- Install surface
- Published package includes index.mjs and a vendor directory
- Interface
- MCP server over standard input and output
- Execution
- Executable Node.js entry script
- Database support
- PostgreSQL through the pg package
Read from README.md, package.json, index.mjs, LICENSE.
What it can do
Connect to Postgres database
Database connection parameters → Active database connection
Query database tables and schemas
Database connection and query parameters → Table structure and schema information
Execute SQL queries
SQL query string and database connection → Query results and data
Provide database context to language models
Database schema and table information → Structured context data for AI models
Retrieve table metadata
Table names and database connection → Column definitions, data types, and constraints
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.