MCP.so
ログイン

PostgreSQL MCP (PG-MCP) Server

@stuzero

基本情報

カテゴリ

データベース

ライセンス

MIT

トランスポート

stdio

作者

stuzero

PostgreSQL MCP (PG-MCP) Server について

概要はまだありません

PostgreSQL MCP (PG-MCP) Server の設定

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

{
  "mcpServers": {
    "pg-mcp-server": {
      "command": "uv",
      "args": [
        "sync"
      ]
    }
  }
}

PostgreSQL MCP (PG-MCP) Server のツール

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

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

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

概要

What is PostgreSQL Model Context Protocol (PG-MCP) Server?

PG-MCP is a server implementation of the Model Context Protocol (MCP) for PostgreSQL databases. It provides a comprehensive API for AI agents to discover, connect to, query, and understand PostgreSQL databases through MCP’s resource-oriented architecture. The server includes multi-database support, rich catalog information, built-in extension context (e.g., PostGIS, pgvector), and query explanation tools.

How to use PostgreSQL Model Context Protocol (PG-MCP) Server?

Install via Docker (docker-compose up -d) or manually (uv sync, then python -m server.app). Use the provided test scripts (test.py and example-clients/claude_cli.py) to verify functionality. For AI agents, use the server’s tools (connect, disconnect, pg_query, pg_explain) and explore schema resources via pgmcp://{conn_id}/ URIs.

Key features of PostgreSQL Model Context Protocol (PG-MCP) Server

  • Connect tool to register PostgreSQL connection strings and get a secure connection ID
  • Read-only SQL execution (pg_query) with connection ID
  • pg_explain tool to analyze query execution plans in JSON
  • Schema discovery: list schemas, tables, columns, constraints, indexes, extensions
  • Sample table data with pagination and approximate row counts
  • Built-in YAML-based context for extensions like PostGIS and pgvector

Use cases of PostgreSQL Model Context Protocol (PG-MCP) Server

  • AI agents exploring and understanding database schemas autonomously
  • Natural language to SQL conversion via Claude-powered CLI
  • Analyzing query execution plans for performance tuning
  • Programmatic inspection of table relationships, constraints, and indexes

よくある質問

1

How do I connect to a database?

Use the `connect` tool with a PostgreSQL connection string. It returns a secure connection ID used for subsequent operations.

2

Is the server read-only?

Yes, read-only mode is enforced via transaction settings by default.

3

What PostgreSQL extensions are supported?

Built-in context is provided for PostGIS and pgvector. Additional extensions can be added via YAML configuration files.

4

How are database credentials handled?

Credentials are sent once during initial connection and are never exposed in resource URLs—only opaque connection IDs are used.

5

What runtime and transport does the server require?

It requires Python 3.13+ and uses SSE (Server-Sent Events) transport for production use.

コメント

「データベース」の他のコンテンツ