Skip to content

pgEdge Natural Language Agent

A Model Context Protocol (MCP) server that enables natural language queries against PostgreSQL databases.

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 the pgEdge RAG Server instead. Read the full comparison →

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

Quick Start

Get started in 5 minutes →

Documentation

User Guide

For server operators and end users.

Reference

  • 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

Contributing

For project contributors.

How It 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 - Server loads table/column metadata from PostgreSQL
  2. Query generation - LLM converts natural language to SQL
  3. Safe execution - Queries run in read-only transactions
  4. Result formatting - Answers returned to the user

License

Released under The PostgreSQL License.