Provides tools for interacting with a PostgreSQL database, enabling AI assistants to execute SQL queries and inspect database schemas.
Click on "Install 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 Servershow me the database schema"
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.
PostgreSQL MCP Server
An MCP server that exposes PostgreSQL database operations as tools for AI assistants.
What is MCP?
Model Context Protocol (MCP) connects AI assistants to external tools and data. This server lets AI assistants execute SQL queries and inspect your PostgreSQL database schema.
Setup
Python version: This project currently supports Python 3.10–3.13. Python 3.14 is excluded due to upstream dependency wheel support (e.g., psycopg2-binary and pydantic-core).
1. Install Dependencies
Note: This project uses Poetry for dependency management. If you don't have Poetry installed, you can install it with:
curl -sSL https://install.python-poetry.org | python3 -See the official Poetry documentation for alternative installation methods.
2. Configure Database
Copy .env.example to .env and add your PostgreSQL credentials:
Edit .env:
Testing
MCP Inspector (Recommended)
Note: The Inspector runs via
npx, so you need Node.js (which includes npm). If you don't have it installed, get it from the official Node.js installer.
This opens a web UI where you can:
View available tools under the Tools tab
Test
get_schemaSee real-time results
Quick Test
Press Ctrl+C to stop. No errors = working correctly.
Available Tools
get_schema() - Get database schema
Connect to Cursor
Add to your Cursor MCP config (global settings):
Replace /absolute/path/to/postgres-mcp-server with your actual project path.
Future Proof Data Science - Teaching data scientists to optimize workflows with AI