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 Server list 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: postgres-mcp
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
Inputs: no named parameters. Returns: result
get_table_columnsC
Returns list of tables in the DB
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
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
Hosted PostgreSQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
MCP server for interacting with the Supabase platform
Managed Postgres MCP: projects, SQL, docs search, and storage buckets via OAuth.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides access to PostgreSQL database schemas and metadata, allowing MCP-compatible tools like Cursor to explore database structure, inspect table schemas, and understand relationships.5MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for PostgreSQL that enables Cursor and other MCP clients to execute SQL queries, list tables, and explore database schemas via HTTP.MIT
- FlicenseNot gradedqualityDmaintenanceRead-only PostgreSQL schema metadata server for AI coding agents, providing table/column details, relationships, and markdown export via MCP protocol.-
- AlicenseAqualityDmaintenanceMCP server for PostgreSQL, providing schema discovery, catalog introspection, read-only querying, and optional safe write operations to AI assistants.832 npmPolyForm Noncommercial 1.0.0