pgEdge MCP Server for Postgres

by pgedge

351 downloads
Not rated
GitHub

About

The pgEdge Postgres Model Context Protocol (MCP) server enables SQL queries against PostgreSQL databases through MCP-compatible clients like Claude Desktop. The Natural Language Agent provides supporting functionality that allows you to use natural language to form SQL queries.

Details

Author
pgedge
Downloads
351
Categories
Database, Other, Search

- Read‑only protection – all queries run in read‑only transactions
- Resources, tools, and prompts for database interaction
- Production Go CLI client with Anthropic prompt caching (90% cost reduction)
- HTTP/HTTPS mode with token authentication and TLS support
- Web‑based management interface built with React
- Docker support for containerized deployment and hot‑reload of auth files

Clone the repository, run make build, then configure your MCP client (e.g., Claude Desktop) with the path to the binary. Provide database connection details via environment variables (PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD) or a .pgpass file. The server can also be run as a standalone HTTP server or deployed with Docker.

pgEdge Postgres MCP Server and Natural Language Agent

CI - MCP Server
CI - CLI Client
CI - Web Client
CI - Docker
CI - Documentation

- Introduction
- Choosing the Right Solution
- Installing the MCP Server
- Deploying on Docker
- Deploying from Source
- Accessing Online Help
- Configuring the MCP Server
- Specifying Configuration Preferences
- Using Environment Variables to Specify Options
- Including Provider Embeddings in a Configuration File
- Configuring the Agent for Multiple Databases
- Configuring Supporting Services; HTTP, systemd, and nginx
- Using an Encryption Secret File
- Enabling or Disabling Features
- Configuring and Using Client Applications
- Connecting with the Web Client
- Using the Go Chat Client
- Using the Claude Desktop
- Authentication and Security
- Authentication Overview
- User Authentication Management
- Token Authentication Management
- Security Best Practices - Checklist
- Security Management
- Reference
- Tools
- Resources
- Prompts
- Examples
- Advanced Topics
- Custom Definitions
- Knowledgebase
- LLM Proxy
- For Developers
- Overview
- MCP Protocol
- API Reference
- Building Chat Clients
- Overview
- Python - Stdio and Claude
- Python - HTTP and OLLAMA
- Contributing
- Development Setup
- Architecture
- Internal Architecture
- KB Builder
- Testing
- CI/CD
- Troubleshooting
- pgEdge Postgres MCP Server and Natural Language Agent Release Notes
- Licence

The pgEdge Postgres Model Context Protocol (MCP) server enables SQL queries against
PostgreSQL databases through MCP-compatible clients like Claude Desktop. The Natural Language Agent provides supporting functionality that allows you to use natural language to form SQL queries.

> 🚧 WARNING: This code is in pre-release status and MUST NOT be put
> into production without thorough testing!

> ⚠️ 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.
> See the Choosing the Right Solution guide for
> details.

Key Features

- 🔒 Read-Only Protection - All queries run in read-only transactions
- 📊 Resources - Access PostgreSQL statistics and more
- 🛠️ Tools - Query execution, schema analysis, advanced hybrid search
(BM25+MMR), embedding generation, resource reading, and more
- 🧠 Prompts - Guided workflows for semantic search setup, database
exploration, query diagnostics, and more
- 💬 Production Chat Client - Full-featured Go client with Anthropic
prompt caching (90% cost reduction)
- 🌐 HTTP/HTTPS Mode - Direct API access with token authentication
- 🖥️ Web Interface - Modern React-based UI with AI-powered chat for
natural language database interaction
- 🐳 Docker Support - Complete containerized deployment with Docker
Compose
- 🔐 Secure - TLS support, token auth, read-only enforcement
- 🔄 Hot Reload - Automatic reload of authentication files without server
restart

Quick Start

1. Installation

git clone <repository-url>
cd pgedge-postgres-mcp
make build

2. Configure for Claude Code and/or Claude Desktop

Claude Code: .mcp.json in each of your project directories
Claude Desktop on macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop on Windows: %APPDATA%\\Claude\\claude_desktop_config.json

{
  "mcpServers": {
    "pgedge": {
      "command": "/absolute/path/to/bin/pgedge-postgres-mcp"
    }
  }
}

3. Connect to Your Database

Update your Claude Code and/or Claude Desktop configuration to include database connection
parameters:

{
  "mcpServers": {
    "pgedge": {
      "command": "/absolute/path/to/bin/pgedge-postgres-mcp",
      "env": {
        "PGHOST": "localhost",
        "PGPORT": "5432",
        "PGDATABASE": "mydb",
        "PGUSER": "myuser",
        "PGPASSWORD": "mypass"
      }
    }
  }
}

Alternatively, use a .pgpass file for password management (recommended for
security):

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.