PG_MCP_SERVER
@cbc3929
About PG_MCP_SERVER
No overview available yet
Basic information
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"pg_mcp_server": {
"command": "docker",
"args": [
"build",
"-t",
"pg-mcp-server:latest",
"."
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is PG_MCP_SERVER?
PG_MCP_SERVER is a general-purpose PostgreSQL MCP (Model Context Protocol) server that provides efficient schema context to large language models by pre-processing table structures. It supports PostGIS and PgVector extensions and communicates via Stdio or SSE transports.
How to use PG_MCP_SERVER?
Configure the database connection string either in main.go via RegisterConnection or by setting the SCHEMA_LOAD_DB_URL environment variable. Run with Docker (docker run -d -p 8181:8181 pg-mcp-server:latest) or directly with go run ./cmd/server/main.go after cloning and installing dependencies.
Key features of PG_MCP_SERVER
- Pre-fetches database schema to reduce token usage.
- Uses MCP Tool descriptions and Resources for implicit schema context.
- Supports PostGIS geometry types, indexes, and EPSG codes.
- Native PgVector extension support.
- Implements Stdio and SSE transports.
- Docker deployment available.
Use cases of PG_MCP_SERVER
- Provide LLMs with optimized database context without repeated schema queries.
- Query spatial data in PostGIS-enabled databases through natural language.
- Manage vector embeddings stored with PgVector via LLM agents.
- Enable secure, role-based read-only database access for MCP applications.
FAQ from PG_MCP_SERVER
Why does PG_MCP_SERVER pre-process the database schema instead of reading it on every call?
Reading the schema on each call consumes significant time and token context. Pre-processing caches table structures, columns, constraints, foreign keys, indexes, geometry types, and EPSG codes during initialization.
What database permissions does PG_MCP_SERVER require?
It recommends creating a dedicated role with SELECT on the public schema and all privileges on a temp schema. Configuring a role limits SQL injection risk and protects sensitive data.
Which PostgreSQL extensions are supported?
PostGIS and PgVector are fully supported. PgRouting support is marked as partial (⭕).
What transport protocols are available?
PG_MCP_SERVER supports Stdio and SSE transports via the go-mcp library.
How do I configure the database connection?
Set the connection string in main.go with schemaLoadConnID, err := dbService.RegisterConnection(tempCtx, "postgres://user:pass@host:port/db") or use the SCHEMA_LOAD_DB_URL environment variable in a .env file.
More Other MCP servers
XcodeBuildMCP
cameroncookeA Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.
IDA Pro MCP
mrexodiaAI-powered reverse engineering assistant that bridges IDA Pro with language models through MCP.
Servers
modelcontextprotocolModel Context Protocol Servers
Codelf
unbugA search tool helps dev to solve the naming things problem.
MaxKB
1Panel-dev🔥 MaxKB is an open-source platform for building enterprise-grade agents. 强大易用的开源企业级智能体平台。
Comments