Close Menu

    Subscribe to Updates

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

    What's Hot

    The first human test of a rejuvenation method will begin “shortly” 

    OpenAI’s latest product lets you vibe code science

    Stratospheric internet could finally start taking off this year

    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

      ChatGPT can embrace authoritarian ideas after just one prompt, researchers say

      January 24, 2026

      Ashley St. Clair, the mother of one of Elon Musk’s children, sues xAI over Grok sexual images

      January 17, 2026

      Anthropic joins OpenAI’s push into health care with new Claude tools

      January 12, 2026

      The mother of one of Elon Musk’s children says his AI bot won’t stop creating sexualized images of her

      January 7, 2026

      A new pope, political shake-ups and celebs in space: The 2025-in-review news quiz

      December 31, 2025
    • Business

      New VoidLink malware framework targets Linux cloud servers

      January 14, 2026

      Nvidia Rubin’s rack-scale encryption signals a turning point for enterprise AI security

      January 13, 2026

      How KPMG is redefining the future of SAP consulting on a global scale

      January 10, 2026

      Top 10 cloud computing stories of 2025

      December 22, 2025

      Saudia Arabia’s STC commits to five-year network upgrade programme with Ericsson

      December 18, 2025
    • Crypto

      Large XRP Whales Sold $800 Million, Will Price Drop Again?

      January 28, 2026

      EMCD x BeInCrypto Webinar Recap: Inflation, Volatility, and Practical Frameworks for Safer Crypto Decisions

      January 28, 2026

      What Does Retail Attention Rotating to Safe Havens Mean for a Potential Silver Top?

      January 28, 2026

      How January’s Sharp Decline in Spot Volume Is Threatening the Crypto Market Structure

      January 28, 2026

      What To Expect From Solana Price In February 2026?

      January 28, 2026
    • Technology

      The first human test of a rejuvenation method will begin “shortly” 

      January 28, 2026

      OpenAI’s latest product lets you vibe code science

      January 28, 2026

      Stratospheric internet could finally start taking off this year

      January 28, 2026

      The Download: OpenAI’s plans for science, and chatbot age verification

      January 28, 2026

      Sennheiser’s cheap new USB-C headphones and earbuds mean you have no excuse for not listening in glorious Hi-Res Audio everywhere

      January 28, 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

    The first human test of a rejuvenation method will begin “shortly” 

    January 28, 2026

    OpenAI’s latest product lets you vibe code science

    January 28, 2026

    Stratospheric internet could finally start taking off this year

    January 28, 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, 2025641 Views

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

    July 31, 2025241 Views

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

    April 14, 2025143 Views

    6 Best MagSafe Phone Grips (2025), Tested and Reviewed

    April 6, 2025111 Views
    Don't Miss
    Technology January 28, 2026

    The first human test of a rejuvenation method will begin “shortly” 

    The first human test of a rejuvenation method will begin “shortly”  When Elon Musk was…

    OpenAI’s latest product lets you vibe code science

    Stratospheric internet could finally start taking off this year

    The Download: OpenAI’s plans for science, and chatbot age verification

    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

    The first human test of a rejuvenation method will begin “shortly” 

    January 28, 20262 Views

    OpenAI’s latest product lets you vibe code science

    January 28, 20262 Views

    Stratospheric internet could finally start taking off this year

    January 28, 20262 Views
    Most Popular

    A Team of Female Founders Is Launching Cloud Security Tech That Could Overhaul AI Protection

    March 12, 20250 Views

    7 Best Kids Bikes (2025): Mountain, Balance, Pedal, Coaster

    March 13, 20250 Views

    VTOMAN FlashSpeed 1500: Plenty Of Power For All Your Gear

    March 13, 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.