Skip to content

pgEdge Postgres MCP Server and Natural Language Agent

The pgEdge Natural Language Agent enables access to the pgEdge Postgres Model Context Protocol (MCP) Server, allowing you to use natural language queries when interacting with a Postgres database.

Pre-Release

This software is in pre-release status. Test thoroughly before production use.

Not for Public-Facing Applications

This MCP server provides LLMs with read access to your entire database schema and data. It should only be used for internal tools, developer workflows, or environments where all users are trusted. For public-facing applications, consider using the pgEdge RAG Server instead. Read the full comparison →

MCP Server Features

  • Natural Language to SQL - Ask questions in plain English
  • Read-Only Protection - All queries execute in read-only transactions
  • Multiple LLM Support - Anthropic Claude, OpenAI, or Ollama (local/free)
  • Web Interface - Modern React-based chat UI
  • CLI Client - Production chat client with Anthropic prompt caching
  • Secure - TLS, token/user authentication, read-only enforcement

How the MCP server works:

flowchart LR
    A[User Question] --> B[LLM]
    B --> C[SQL Query]
    C --> D[MCP Server]
    D --> E[PostgreSQL]
    E --> F[Results]
    F --> B
    B --> G[Answer]
  1. Schema extraction - The server loads table/column metadata from PostgreSQL.
  2. Query generation - The LLM converts natural language to SQL.
  3. Safe execution - Queries run in read-only transactions.
  4. Result formatting - Answers are returned to the user.

User Guide

For server operators and end users:

Reference Pages:

  • Tools - Database query, schema, search tools
  • Resources - System info and schema resources
  • Prompts - Guided workflow prompts
  • Examples - Query examples

For Developers building applications that use the MCP server:

Advanced Topics:

For project contributors:

License

This project is licensed under the PostgreSQL License.