PostgreSQL MCP Server
Provides tools for accessing PostgreSQL database metadata, including listing tables and other database objects.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PostgreSQL MCP Serverlist all tables and show the schema for users"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Postgres MCP server
An FastMCP-based MCP server for PostgreSQL metadata (table lists, etc.). Default transport is stdio (for Cursor/IDE); with HTTP transport, GET /health is available.
Requirements: Python 3.14+, uv, and a running PostgreSQL instance.
List of available tools
get_all_tables - list all tables in the DB;
get_table_columns - list all columns in the specified table;
get_table_primary_key - list table primary key;
get_table_foreign_keys - list table foreign key.
Related MCP server: PostgreSQL MCP Server
Install
git clone <url> mccp && cd mccp
uv syncDatabase configuration
Init file
By default, env/local.ini is read (path is relative to the repo root, not the current working directory). Copy the example and set your values:
db_host=localhost
db_port=5432
db_name=your_db
db_user=postgres
db_password=secretEnv variables
The same settings can be passed via environment variables DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
CLI flags
Or use CLI flags --db_host, --db_port, etc. (see python src/main.py --help).
Run the server
uv run python src/main.py -t stdioOther FastMCP transports: -t http, -t sse, and so on. Logs go to a file (default logs/mccp.log); override with --log_file.
For quick DB checks without MCP, use uv run python src/r.py — it uses the same config and calls the tools directly.
Tests
uv run python -m unittest src.tests.process_stdio -vThese integration tests spawn src/main.py as a stdio subprocess; you need a reachable database configured in env/local.ini.
Available Tools
2 toolsget_all_tablesB
Returns list of tables in the DB
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It states the tool returns a list but omits: whether views/system tables are included, pagination behavior, or performance implications of listing all tables.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely brief (6 words) and front-loaded, avoiding verbosity. However, it borders on under-specification—while no words are wasted, the single sentence structure provides no room for essential context that would help an agent understand scope or constraints.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has zero parameters and an output schema exists (per context signals), the description meets minimum requirements by identifying the operation scope ('in the DB'). However, it lacks completeness regarding what constitutes a 'table' (views? temporary tables? across all schemas?) which agents need for proper invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, which according to the baseline rules warrants a score of 4. The input schema confirms no arguments are accepted, and the description doesn't need to elaborate on non-existent parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb (Returns) and resource (list of tables in the DB), providing a concrete purpose. However, it fails to differentiate from sibling tool 'get_table_columns'—it doesn't clarify that this tool requires no parameters while the sibling likely requires a table identifier.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance provided on when to use this tool versus alternatives, or any prerequisites (e.g., database connection requirements, permissions needed to view tables). The description stands alone without contextual workflow guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_table_columnsC
Returns list of tables in the DB
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden for behavioral disclosure. It fails to clarify whether this is a read-only operation (though implied by 'Returns'), whether it requires specific database permissions, or what specific column metadata (names, types, constraints) is actually returned despite the name suggesting column retrieval.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence, but given the misleading content regarding tables vs columns, the sentence does not earn its place effectively. It is brief but uninformative regarding the tool's actual purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
While an output schema exists (reducing the need to describe return values), the description fails to resolve the fundamental confusion between listing tables and retrieving columns, and does not explain the relationship to sibling 'get_all_tables'. For a database introspection tool, this ambiguity is a significant gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema contains zero parameters. According to the scoring guidelines, 0 parameters equals a baseline score of 4, as there are no parameter semantics to describe beyond what the empty schema already conveys.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states it 'Returns list of tables in the DB', but this contradicts the tool name 'get_table_columns' which implies retrieving column metadata, not tables. It also fails to distinguish from sibling 'get_all_tables', creating confusion about which tool to use for listing tables versus retrieving column information.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides no guidance on when to use this tool versus the sibling 'get_all_tables'. Given the description suggests both tools return lists of tables, the agent has no basis for selecting the correct tool for the user's actual intent (tables vs columns).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
get_all_tables - First observed
get_table_columns
TDQS
Scored across 2 tools
Both tools have identical descriptions stating they 'Returns list of tables in the DB', creating severe ambiguity despite different names. An agent cannot reliably distinguish which tool retrieves column information versus table listings based on the provided descriptions.
Both tools follow a consistent snake_case pattern with the 'get_' verb prefix followed by a descriptive noun phrase (all_tables, table_columns), making the naming predictable and readable.
Two tools is minimal for a PostgreSQL server, covering only basic schema introspection. While not an extreme mismatch, it falls into the 'feels thin' category for the stated domain of database management.
Severely limited functionality lacking SQL query execution, data modification, index/constraints inspection, or schema management. Only supports listing tables and columns, making it inadequate for general database operations and likely to cause agent failures when attempting to retrieve or manipulate data.
Maintenance
Related MCP Connectors
- SupabaseOAuthcom.supabase
MCP server for interacting with the Supabase platform
Hosted MCP server for PostgreSQL diagnostics: slow queries, missing indexes, connection pressure.
The Instant MCP server is a wrapper around the Instant Platform SDK that enables creating, managing, and updating InstantDB applications directly within an editor. It provides tools for fetching rules files for LLMs, retrieving and pushing app schemas, managing permission rules, and executing database queries. Key capabilities include schema management (get-schema, push-schema), permission management (get-perms, push-perms), query execution, and listing recent query history.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol server providing dual transport (HTTP and Stdio) access to PostgreSQL databases, allowing AI assistants to query databases and fetch schema information through natural language.26 npm31MIT
- AlicenseBqualityDmaintenanceProvides access to PostgreSQL database schemas and metadata, allowing MCP-compatible tools like Cursor to explore database structure, inspect table schemas, and understand relationships.533 npmISC
- AlicenseNot gradedqualityDmaintenanceMCP server for PostgreSQL that enables Cursor and other MCP clients to execute SQL queries, list tables, and explore database schemas via HTTP.993 npmMIT
- FlicenseNot gradedqualityCmaintenanceRead-only PostgreSQL schema metadata server for AI coding agents, providing table/column details, relationships, and markdown export via MCP protocol.-