PostgreSQL MCP Server (Model Context Protocol)
FastMCP Based MCP Server to Control Postgres
VivekMalipatel
README
PostgreSQL MCP Server (Model Context Protocol)
A basic implementation of FastMCP for PostgreSQL, enabling direct interaction with PostgreSQL databases from Claude AI.
With this MCP, you can transform your AI chat experience by:
- Storing and retrieving chat data in PostgreSQL databases
- Creating AI applications with persistent data storage
- Building knowledge management systems with structured database queries
- Analyzing large datasets directly through natural language prompts
- Implementing database-driven workflows without writing traditional code
This implementation leverages the MCP protocol to securely bridge Claude AI with PostgreSQL databases, allowing Claude to execute operations on your behalf while maintaining proper isolation and security boundaries.
Features
- Query execution against PostgreSQL databases
- Table management (create, drop)
- Data operations (select, insert, update, delete)
- Schema inspection
- Integrated with Claude through MCP protocol
Prerequisites
- Python 3.8+
- PostgreSQL server
- Access to Claude AI with MCP capabilities
Installation
-
Clone this repository to your local machine
-
Create and activate a Python virtual environment:
# Create virtual environment
python -m venv .mcp
# Activate virtual environment
# On macOS/Linux
source .mcp/bin/activate
# On Windows
.mcp\Scripts\activate
- Install required dependencies:
pip install -r requirements.txt
Configuration
-
Create a
.env
file in the project root with your PostgreSQL connection details and debugging: -
Configure the PostgreSQL MCP with Claude AI app by adding the following configuration:
{
"mcpServers": {
"PostgreSQL MCP": {
"command": "<path/to/clonedrepo/.mcp/bin/uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with",
"asyncpg",
"--with",
"httpx",
"--with",
"python-dotenv",
"--with",
"psycopg2-binary",
"mcp",
"run",
"path/to/clonedrepo/postgres_mcp_server.py"
],
"env": {
"POSTGRES_HOST": "<your_postgres_host>",
"POSTGRES_PORT": "<your_postgres_port>",
"POSTGRES_USER": "<your_username>",
"POSTGRES_PASSWORD": "<your_password>",
"POSTGRES_DB": "<your_database_name>"
}
}
}
}
Note : Replace "path/to/clonedrepo/" with actual path
Add this configuration to the Claude AI app settings in the MCP configuration section. This will allow Claude to connect to your PostgreSQL MCP server.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Linear MCP Server
Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.
mermaid-mcp-server
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.
Jira-Context-MCP
MCP server to provide Jira Tickets information to AI coding agents like Cursor

Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.