MCP.so
ログイン

PG MCP SERVER

@cbc3929

基本情報

カテゴリ

その他

トランスポート

stdio

作者

cbc3929

PG MCP SERVER について

概要はまだありません

PG MCP SERVER の設定

以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。

{
  "mcpServers": {
    "pg_mcp_server": {
      "command": "docker",
      "args": [
        "build",
        "-t",
        "pg-mcp-server:latest",
        "."
      ]
    }
  }
}

PG MCP SERVER のツール

ツール一覧はまだありません

この掲載には表示できるツール一覧がまだありません。サーバーにツールがないという意味ではありません。対応機能はプロジェクトのドキュメントをご確認ください。

ツールは README から自動的に抽出されます。メンテナーは ## Tools という見出しの下に記載することで、このタブに反映できます。

概要

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.

よくある質問

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.

コメント

「その他」の他のコンテンツ