Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    OnePlus Nord 6 launch window leaks along with key details

    Acemagic M1A Pro+ with 128 GB RAM and AMD Ryzen AI Max+ 395 -PC as a serious alternative to high RAM prices?

    OnePlus Nord 6 launch window leaks along with key details

    Facebook X (Twitter) Instagram
    • Artificial Intelligence
    • Business Technology
    • Cryptocurrency
    • Gadgets
    • Gaming
    • Health
    • Software and Apps
    • Technology
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Tech AI Verse
    • Home
    • Artificial Intelligence

      What the polls say about how Americans are using AI

      February 27, 2026

      Tensions between the Pentagon and AI giant Anthropic reach a boiling point

      February 21, 2026

      Read the extended transcript: President Donald Trump interviewed by ‘NBC Nightly News’ anchor Tom Llamas

      February 6, 2026

      Stocks and bitcoin sink as investors dump software company shares

      February 4, 2026

      AI, crypto and Trump super PACs stash millions to spend on the midterms

      February 2, 2026
    • Business

      The team behind continuous batching says your idle GPUs should be running inference, not sitting dark

      March 13, 2026

      Met Office ‘supercomputing as a service’ one year old

      March 12, 2026

      Tech hiring evolves as candidates ask for AI compute alongside pay and perks

      March 11, 2026

      Oracle is spending billions on AI data centers as cash flow turns negative

      March 11, 2026

      Google: Cloud attacks exploit flaws more than weak credentials

      March 10, 2026
    • Crypto

      Banks Respond to Kraken’s Federal Reserve Access as Trump Sides with Crypto

      March 4, 2026

      Hyperliquid and DEXs Break the Top 10 — Is the CEX Era Ending?

      March 4, 2026

      Consensus Hong Kong 2026: The Institutional Turn 

      March 4, 2026

      New Crypto Mutuum Finance (MUTM) Reports V1 Protocol Progress as Roadmap Enters Phase 3

      March 4, 2026

      Bitcoin Short Sellers Caught Off Guard in New White House Move

      March 4, 2026
    • Technology

      OnePlus Nord 6 launch window leaks along with key details

      March 14, 2026

      Acemagic M1A Pro+ with 128 GB RAM and AMD Ryzen AI Max+ 395 -PC as a serious alternative to high RAM prices?

      March 14, 2026

      I turned a Raspberry Pi 5 into a real SSD-powered PC for less than $200

      March 14, 2026

      This $35 tool bundle simplifies PC upgrades

      March 14, 2026

      Get Windows 11 Pro and training for just $25

      March 14, 2026
    • Others
      • Gadgets
      • Gaming
      • Health
      • Software and Apps
    Check BMI
    Tech AI Verse
    You are at:Home»Technology»Show HN: Cloud-Ready Postgres MCP Server
    Technology

    Show HN: Cloud-Ready Postgres MCP Server

    TechAiVerseBy TechAiVerseMarch 30, 2025No Comments3 Mins Read1 Views
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Show HN: Cloud-Ready Postgres MCP Server
    Share
    Facebook Twitter LinkedIn Pinterest WhatsApp Email

    Show HN: Cloud-Ready Postgres MCP Server

    PostgreSQL Model Context Protocol (PG-MCP) Server

    A Model Context Protocol (MCP) server for PostgreSQL databases with enhanced capabilities for AI agents.

    Overview

    PG-MCP is a server implementation of the Model Context Protocol for PostgreSQL databases. It provides a comprehensive API for AI agents to discover, connect to, query, and understand PostgreSQL databases through MCP’s resource-oriented architecture.

    This implementation builds upon and extends the reference Postgres MCP implementation with several key enhancements:

    1. Full Server Implementation: Built as a complete server with SSE transport for production use
    2. Multi-database Support: Connect to multiple PostgreSQL databases simultaneously
    3. Rich Catalog Information: Extracts and exposes table/column descriptions from the database catalog
    4. Extension Context: Provides detailed YAML-based knowledge about PostgreSQL extensions like PostGIS and pgvector
    5. Query Explanation: Includes a dedicated tool for analyzing query execution plans
    6. Robust Connection Management: Proper lifecycle for database connections with secure connection ID handling

    Features

    Connection Management

    • Connect Tool: Register PostgreSQL connection strings and get a secure connection ID
    • Disconnect Tool: Explicitly close database connections when done
    • Connection Pooling: Efficient connection management with pooling

    Query Tools

    • pg_query: Execute read-only SQL queries using a connection ID
    • pg_explain: Analyze query execution plans in JSON format

    Schema Discovery Resources

    • List schemas with descriptions
    • List tables with descriptions and row counts
    • Get column details with data types and descriptions
    • View table constraints and indexes
    • Explore database extensions

    Data Access Resources

    • Sample table data (with pagination)
    • Get approximate row counts

    Extension Context

    Built-in contextual information for PostgreSQL extensions like:

    • PostGIS: Spatial data types, functions, and examples
    • pgvector: Vector similarity search functions and best practices

    Additional extensions can be easily added via YAML config files.

    Installation

    Prerequisites

    • Python 3.13+
    • PostgreSQL database(s)

    Using Docker

    # Clone the repository
    git clone https://github.com/stuzero/pg-mcp.git
    cd pg-mcp
    
    # Build and run with Docker Compose
    docker-compose up -d

    Manual Installation

    # Clone the repository
    git clone https://github.com/stuzero/pg-mcp.git
    cd pg-mcp
    
    # Create and activate a virtual environment
    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venvScriptsactivate
    
    # Install using uv
    uv sync --frozen
    
    # Run the server
    python -m server.app

    Usage

    Testing the Server

    The repository includes test scripts to verify server functionality:

    # Basic server functionality test
    python test.py "postgresql://username:password@hostname:port/database"
    
    # Claude-powered natural language to SQL conversion
    python client/claude_cli.py "Show me the top 5 customers by total sales"

    The claude_cli.py script requires environment variables:

    # .env file
    DATABASE_URL=postgresql://username:password@hostname:port/database
    ANTHROPIC_API_KEY=your-anthropic-api-key
    PG_MCP_URL=http://localhost:8000/sse
    

    For AI Agents

    Example prompt for use with agents:

    Use the PostgreSQL MCP server to analyze the database. 
    Available tools:
    - connect: Register a database connection string and get a connection ID
    - disconnect: Close a database connection
    - pg_query: Execute SQL queries using a connection ID
    - pg_explain: Get query execution plans
    
    You can explore schema resources via:
    pgmcp://{conn_id}/schemas
    pgmcp://{conn_id}/schemas/{schema}/tables
    pgmcp://{conn_id}/schemas/{schema}/tables/{table}/columns
    

    Architecture

    This server is built on:

    • MCP: The Model Context Protocol foundation
    • FastMCP: Python library for MCP
    • asyncpg: Asynchronous PostgreSQL client
    • YAML: For extension context information

    Security Considerations

    • The server runs in read-only mode by default (enforced via transaction settings)
    • Connection details are never exposed in resource URLs, only opaque connection IDs
    • Database credentials only need to be sent once during the initial connection

    Contributing

    Contributions are welcome! Areas for expansion:

    • Additional PostgreSQL extension context files
    • More schema introspection resources
    • Query optimization suggestions
    Share. Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Telegram Email
    Previous ArticleElectric power generation from Earth’s rotation through its own magnetic field
    Next Article How Amir Satvat finds jobs for thousands of game industry people | The DeanBeat
    TechAiVerse
    • Website

    Jonathan is a tech enthusiast and the mind behind Tech AI Verse. With a passion for artificial intelligence, consumer tech, and emerging innovations, he deliver clear, insightful content to keep readers informed. From cutting-edge gadgets to AI advancements and cryptocurrency trends, Jonathan breaks down complex topics to make technology accessible to all.

    Related Posts

    OnePlus Nord 6 launch window leaks along with key details

    March 14, 2026

    Acemagic M1A Pro+ with 128 GB RAM and AMD Ryzen AI Max+ 395 -PC as a serious alternative to high RAM prices?

    March 14, 2026

    I turned a Raspberry Pi 5 into a real SSD-powered PC for less than $200

    March 14, 2026
    Leave A Reply Cancel Reply

    Top Posts

    Ping, You’ve Got Whale: AI detection system alerts ships of whales in their path

    April 22, 2025716 Views

    Lumo vs. Duck AI: Which AI is Better for Your Privacy?

    July 31, 2025303 Views

    Wired Headphones Are Making A Comeback, And We Have Gen Z To Thank

    July 22, 2025212 Views

    6.7 Cummins Lifter Failure: What Years Are Affected (And Possible Fixes)

    April 14, 2025173 Views
    Don't Miss
    Technology March 14, 2026

    OnePlus Nord 6 launch window leaks along with key details

    OnePlus Nord 6 launch window leaks along with key details – NotebookCheck.net News ⓘ OnePlusThe…

    Acemagic M1A Pro+ with 128 GB RAM and AMD Ryzen AI Max+ 395 -PC as a serious alternative to high RAM prices?

    OnePlus Nord 6 launch window leaks along with key details

    OnePlus Nord 6 launch window leaks along with key details

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    About Us
    About Us

    Welcome to Tech AI Verse, your go-to destination for everything technology! We bring you the latest news, trends, and insights from the ever-evolving world of tech. Our coverage spans across global technology industry updates, artificial intelligence advancements, machine learning ethics, and automation innovations. Stay connected with us as we explore the limitless possibilities of technology!

    Facebook X (Twitter) Pinterest YouTube WhatsApp
    Our Picks

    OnePlus Nord 6 launch window leaks along with key details

    March 14, 20262 Views

    Acemagic M1A Pro+ with 128 GB RAM and AMD Ryzen AI Max+ 395 -PC as a serious alternative to high RAM prices?

    March 14, 20263 Views

    OnePlus Nord 6 launch window leaks along with key details

    March 14, 20262 Views
    Most Popular

    Outbreak turns 30

    March 14, 20250 Views

    New SuperBlack ransomware exploits Fortinet auth bypass flaws

    March 14, 20250 Views

    CDs Offer Guaranteed Returns in an Uncertain Market. Today’s CD Rates, March 14, 2025

    March 14, 20250 Views
    © 2026 TechAiVerse. Designed by Divya Tech.
    • Home
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions

    Type above and press Enter to search. Press Esc to cancel.