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.
@stuzero
基本信息
暂无概览
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"pg-mcp-server": {
"command": "uv",
"args": [
"sync"
]
}
}
}工具列表暂未提供
当前收录暂时没有可展示的工具列表,不代表服务没有工具。请查阅项目文档了解支持的能力。
工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。
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.
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.
pg_query) with connection IDpg_explain tool to analyze query execution plans in JSONUse the `connect` tool with a PostgreSQL connection string. It returns a secure connection ID used for subsequent operations.
Yes, read-only mode is enforced via transaction settings by default.
Built-in context is provided for PostGIS and pgvector. Additional extensions can be added via YAML configuration files.
Credentials are sent once during initial connection and are never exposed in resource URLs—only opaque connection IDs are used.
It requires Python 3.13+ and uses SSE (Server-Sent Events) transport for production use.

Model Context Protocol Servers
A Model Context Protocol (MCP) server implementation that provides database capabilities for Chroma
Universal MCP-Server for your Databases optimized for LLMs and AI-Agents.
An official Qdrant Model Context Protocol (MCP) server implementation
The Xata MCP server lets AI assistants and agents interact with your Xata organizations, projects, and Postgres database branches.
评论