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
Documentation
User Guide
For server operators and end users.
- Choosing the Right Solution - MCP Server vs RAG Server
- Deployment - Docker, native, and systemd deployment
- 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
- 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
Contributing
For project contributors.
- Development Setup - Local development
- Architecture - System design
- Testing - Test suites
- CI/CD - Automation pipelines
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]
- Schema extraction - Server loads table/column metadata from PostgreSQL
- Query generation - LLM converts natural language to SQL
- Safe execution - Queries run in read-only transactions
- Result formatting - Answers returned to the user
License
Released under The PostgreSQL License.