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]
- Schema extraction - The server loads table/column metadata from PostgreSQL.
- Query generation - The LLM converts natural language to SQL.
- Safe execution - Queries run in read-only transactions.
- Result formatting - Answers are returned to the user.
User Guide
For server operators and end users:
- Choosing the Right Solution - MCP Server vs RAG Server
- Configuration - All configuration options
- Authentication - Users, tokens, and access control
- CLI Client - Command-line interface
- Security - Security best practices
- Troubleshooting - Common issues and solutions
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:
- Overview - Integration approaches
- MCP Protocol - Protocol details
- API Reference - HTTP endpoints
- Building Chat Clients - Client development
Advanced Topics:
- Custom Prompts & Resources - Extend functionality
- Knowledgebase - Documentation search system
- LLM Proxy - Server-side LLM integration
For project contributors:
- Development Setup - Local development
- Architecture - System design
- Testing - Test suites
- CI/CD - Automation pipelines
License
This project is licensed under the PostgreSQL License.