# pgedge-postgres-mcp

pgedge-postgres-mcp is a self-hosted ai app. The pgEdge Postgres Model Context Protocol (MCP) server enables SQL queries against PostgreSQL databases through MCP-compatible clients. It is open source and self-hosted, installable on Unraid.

Canonical page: https://ourlocalhost.com/app/6921/pgedge-postgres-mcp

## Description

The pgEdge Postgres Model Context Protocol (MCP) server enables SQL queries against PostgreSQL databases through MCP-compatible clients. The Natural Language Agent provides supporting functionality that allows you to use natural language to form SQL queries. Supported Versions: PostgreSQL 14 and higher. If you on windows, you can generate random api token using powershell with command: $bytes = New-Object byte 32 ::Fill($bytes) ::ToHexString($bytes).ToLower() Then place it at "INIT_TOKENS". You will use the same value as the MCP bearer token in ChatGPT, Copilot and others. Verify after starting: http://Unraid_IP:8080/health

## Platform availability

Available on 1 of 9 platforms: Unraid.

## Links

- Unraid: https://ca.unraid.net/apps/pgedge-postgres-mcp-0p0gypz1js4a9f?q=pgedge-postgres-mcp
- Official website: https://docs.pgedge.com/
- GitHub: https://github.com/pgEdge/pg-healthcheck
- Documentation: https://docs.pgedge.com/

## Common questions

### How do I generate and set the initial bearer token on Windows?

Use PowerShell to create 32 random bytes, convert the bytes to lowercase hexadecimal, set that value as INIT_TOKENS, and use the same value as the MCP bearer token.

### How do I verify the service after startup?

After starting it, check the health endpoint on port 8080.

### What common issues should I check if setup fails?

Check version requirements, port conflicts, database connectivity, Docker networking, and certificate validation.

### How can I query Postgres with natural language?

The Natural Language Agent lets you send natural-language queries to the MCP Server to query Postgres.

---
Source: Our Local Host (https://ourlocalhost.com/app/6921/pgedge-postgres-mcp), the self-hosted and open-source app directory.
