MCP cover image
See in Github
2025-03-31

FastMCP Based MCP Server to Control Postgres

1

Github Watches

0

Github Forks

0

Github Stars

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

  1. Clone this repository to your local machine

  2. 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
  1. Install required dependencies:
pip install -r requirements.txt

Configuration

  1. Create a .env file in the project root with your PostgreSQL connection details and debugging:

  2. 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.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • modelcontextprotocol
  • Model Context Protocol Servers

  • Mintplex-Labs
  • The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • n8n-io
  • Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

  • open-webui
  • User-friendly AI Interface (Supports Ollama, OpenAI API, ...)

  • WangRongsheng
  • 🧑‍🚀 全世界最好的LLM资料总结(Agent框架、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.

    Reviews

    3 (1)
    Avatar
    user_RiwluKer
    2025-04-16

    As a loyal MCP user, I must say that the Netlify MCP Server by MCERQUA is an outstanding addition to my toolkit. It's straightforward to integrate and offers exceptional performance for my web projects. If you're looking to optimize your workflow and need a reliable server solution, I highly recommend this product. Check it out at https://mcp.so/server/netlify-mcp/MCERQUA!