Basic information
About PG_MCP_SERVER MCP Server
# PG_MCP_SERVER
PG_MCP_SERVER is a MCP server in the Other category listed in the AddMCP.net directory, published by cbc3929. Supported transport: stdio. Runtime: go. Source code is hosted on github.com.
Setup
{
"mcpServers": {
"pg_mcp_server": {
"command": "docker",
"args": [
"build",
"-t",
"pg-mcp-server:latest",
"."
]
}
}
}
{
"mcpServers": {
"pg_mcp_server": {
"command": "docker",
"args": [
"build",
"-t",
"pg-mcp-server:latest",
"."
]
}
}
}
{
"servers": {
"pg_mcp_server": {
"command": "docker",
"args": [
"build",
"-t",
"pg-mcp-server:latest",
"."
]
}
}
}
PG_MCP_SERVER MCP Server 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",
"."
]
}
}
}
PG_MCP_SERVER MCP Server tools
Tool list not available yet
This listing does not currently have a tool list to display. This does not mean the server has no tools; check its documentation for supported capabilities.
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.
Frequently asked questions
1 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.
2 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.
3 Which PostgreSQL extensions are supported?
PostGIS and PgVector are fully supported. PgRouting support is marked as partial (⭕).
4 What transport protocols are available?
PG_MCP_SERVER supports Stdio and SSE transports via the go-mcp library.
5 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.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In