PostgreSQL MCP Server (Model Context Protocol)
@VivekMalipatel
关于 PostgreSQL MCP Server (Model Context Protocol)
FastMCP Based MCP Server to Control Postgres
基本信息
配置
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"Postgres_MCP_Server": {
"command": "python",
"args": [
"-m",
"venv",
".mcp"
]
}
}
}工具
未检测到工具
工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。
概览
What is PostgreSQL MCP Server?
A FastMCP-powered Model Context Protocol server that gives AI assistants (Claude, Cursor, etc.) full, structured access to a PostgreSQL database — no SQL knowledge required from the user.
How to use PostgreSQL MCP Server?
Clone the repository, create a virtual environment, install dependencies from requirements.txt, and configure a .env file with database credentials. Then connect an MCP-compatible client (e.g., Claude Desktop) by adding the provided JSON block to its MCP config file. Alternatively, run manually with python postgres_mcp_server.py.
Key features of PostgreSQL MCP Server
- Exposes database as MCP Resources (read-only) and MCP Tools (read/write)
- Parameterised queries throughout — no SQL injection
- Structured stdout logs on every tool/resource call
- Schema inspection: list tables, column definitions
- Read/write/DDL operations via tools
- Raw SQL execution via the
execute_querytool
Use cases of PostgreSQL MCP Server
- AI assistant querying database in natural language
- Automated schema exploration and data preview
- Performing insert, update, delete operations through conversational interface
- Creating and dropping tables via AI assistant
FAQ from PostgreSQL MCP Server
What transport does PostgreSQL MCP Server use?
The server uses stdio transport (MCP protocol over standard input/output).
What are the runtime requirements?
Python 3.8+ and a PostgreSQL server (local or remote) with the uv package runner (recommended) or pip.
How are database credentials configured?
Via a .env file with POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DB, POSTGRES_USER, and POSTGRES_PASSWORD, or directly in the client config's env block.
What dependencies are required?
mcp[cli], asyncpg, psycopg2-binary, python-dotenv, httpx, uvicorn, and uv.
What are the limits on data access?
The postgres://data/{table_name} resource returns only the first 100 rows as a safe preview. Other tools allow configurable limits.
数据库 分类下的更多 MCP 服务器
Neon MCP Server
neondatabase-labsMCP server for interacting with Neon Management API and databases
MCP Server for Milvus
zilliztechModel Context Protocol Servers for Milvus
Dbhub
bytebaseZero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, SQLite.
MySQL MCP Server
designcomputerA Model Context Protocol (MCP) server that enables secure interaction with MySQL databases
MongoDB MCP Server
mongodb-jsA Model Context Protocol server to connect to MongoDB databases and MongoDB Atlas Clusters.
评论