PostgreSQL MCP Legacy
⚠️ DEPRECATED - Use https://github.com/neverinfamous/postgresql-mcp instead.
What is PostgreSQL MCP Legacy?
PostgreSQL MCP Legacy is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ⚠️ deprecated - use https://github.com/neverinfamous/postgresql-mcp instead.
⚠️ DEPRECATED - Use https://github.com/neverinfamous/postgresql-mcp instead.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- ⚠️ DEPRECATED - Use https://github.com/neverinfamous/postgre
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx postgres-mcp-legacyConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use PostgreSQL MCP Legacy
PostgreSQL MCP Legacy is the deprecated Python implementation of a PostgreSQL MCP server. It is no longer maintained and will not receive security patches. Users should migrate to the actively supported TypeScript successor at https://github.com/neverinfamous/postgresql-mcp, which expands from 63 tools to 203 tools and adds HTTP/SSE transport and OAuth 2.1 authentication.
Prerequisites
- Python 3.9+ (for the legacy version only)
- A running PostgreSQL instance with connection credentials
- pip or uv package manager
- Claude Desktop or another MCP-compatible client
- NOTE: The new postgresql-mcp package is strongly recommended over this legacy version
Install the legacy package (not recommended)
If you specifically require the legacy Python version, clone the repository directly. No PyPI package is available for the legacy version. Be aware that this version receives no updates or security patches.
git clone https://github.com/neverinfamous/postgres-mcp-legacy.git
cd postgres-mcp-legacy
pip install -r requirements.txtMigrate to the maintained TypeScript version (recommended)
Install the actively maintained successor package using Docker or npm. The TypeScript version supports stdio and HTTP/SSE transport, OAuth 2.1, 203 tools, 20 resources, and 19 prompts.
# Docker (recommended)
docker pull writenotenow/postgres-mcp:latest
# npm global install
npm install -g @neverinfamous/postgres-mcp
# or use npx without installing
npx @neverinfamous/postgres-mcpConfigure database connection
Set the PostgreSQL connection string as an environment variable. The server uses the standard libpq connection URI format including host, port, database name, user, and password.
export DATABASE_URL="postgresql://username:password@localhost:5432/mydb"Add to Claude Desktop configuration
Update your Claude Desktop config file to include the postgresql-mcp server. On macOS the config is at ~/Library/Application Support/Claude/claude_desktop_config.json.
{
"mcpServers": {
"postgresql": {
"command": "npx",
"args": ["-y", "@neverinfamous/postgres-mcp"],
"env": {
"DATABASE_URL": "postgresql://username:password@localhost:5432/mydb"
}
}
}
}Verify the connection
Restart Claude Desktop and ask Claude to list tables in the connected database. If the server connects successfully, Claude will describe the schema of your PostgreSQL instance.
PostgreSQL MCP Legacy Examples
Client configuration
Claude Desktop configuration for the recommended postgresql-mcp TypeScript package replacing the legacy version.
{
"mcpServers": {
"postgresql": {
"command": "npx",
"args": ["-y", "@neverinfamous/postgres-mcp"],
"env": {
"DATABASE_URL": "postgresql://myuser:mypassword@localhost:5432/mydb"
}
}
}
}Prompts to try
Example questions to ask Claude after connecting to PostgreSQL.
- "List all tables in the public schema and describe their columns"
- "Show the top 10 rows from the orders table ordered by created_at descending"
- "Write and run a query to find duplicate email addresses in the users table"Troubleshooting PostgreSQL MCP Legacy
Legacy server fails to start with import errors or missing dependencies
The legacy Python package is unmaintained and may have broken dependencies. Switch to @neverinfamous/postgres-mcp which is actively maintained and available via npx without any Python environment setup.
Connection refused when the server tries to reach PostgreSQL
Verify DATABASE_URL is correct and that PostgreSQL is running and accepting connections on the specified host and port. Test with psql using the same connection string before starting the MCP server.
Security warnings about using an unmaintained package in production
Migrate to https://github.com/neverinfamous/postgresql-mcp immediately. The legacy repository explicitly states that security patches will not be applied. The TypeScript successor is a drop-in functional replacement with significantly more features.
Frequently Asked Questions about PostgreSQL MCP Legacy
What is PostgreSQL MCP Legacy?
PostgreSQL MCP Legacy is a Model Context Protocol (MCP) server that ⚠️ deprecated - use https://github.com/neverinfamous/postgresql-mcp instead. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install PostgreSQL MCP Legacy?
Follow the installation instructions on the PostgreSQL MCP Legacy GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with PostgreSQL MCP Legacy?
PostgreSQL MCP Legacy works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is PostgreSQL MCP Legacy free to use?
Yes, PostgreSQL MCP Legacy is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
PostgreSQL MCP Legacy Alternatives — Similar Databases Servers
Looking for alternatives to PostgreSQL MCP Legacy? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
★ 20.6kGo language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
★ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
★ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
★ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
★ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
★ 1.7k🏎️ 🏠 ☁️ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up PostgreSQL MCP Legacy in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use PostgreSQL MCP Legacy?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.