PostgreSQL MCP 服务器
@cynhardchuengc
About PostgreSQL MCP 服务器
No overview available yet
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"pg-mcp-server-cynhardchuengc": {
"command": "node",
"args": [
"dist/index.js",
"postgresql://用户名:密码@数据库地址:端口/数据库名"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is PostgreSQL MCP 服务器?
PostgreSQL MCP 服务器 is a database access server built on the Model Context Protocol (MCP) that enables AI assistants to safely execute PostgreSQL operations. It supports read-only SQL queries, data modification statements (INSERT, UPDATE, DELETE), table listing, and schema inspection through a standardized MCP tool interface. Designed for developers and AI agents, it acts as a secure bridge between an MCP-compatible client (e.g., Cursor) and a PostgreSQL database.
How to use PostgreSQL MCP 服务器?
Install Node.js 18+, clone the repository, run npm install and npm run build, then configure the MCP client with a connection string like postgresql://user:password@host:port/dbname. Start the server via node dist/index.js <connection_string> or through a Cursor mcp.json configuration. Environment variables control behavior such as transaction timeout, max concurrent transactions, and pool size.
Key features of PostgreSQL MCP 服务器
- Execute read-only SQL queries (SELECT statements)
- Perform data modifications with explicit commit or rollback
- List all tables in the connected database
- Describe table structure (columns, types, constraints)
- Manage database transactions with configurable timeout
- Configure connection pooling and statement timeouts via environment variables
Use cases of PostgreSQL MCP 服务器
- Let an AI assistant query production data for analysis without granting full SQL access
- Enable natural-language database exploration and schema discovery
- Automate data entry or updates under human review and confirmation
- Integrate PostgreSQL operations into AI-driven workflow automation tools
FAQ from PostgreSQL MCP 服务器
How do read-only queries differ from data modification operations?
Read-only queries (SELECT) execute immediately. DML operations (INSERT, UPDATE, DELETE) are wrapped in a transaction and require the user to reply "yes" to commit or "no" to rollback. Unconfirmed or timed-out transactions are automatically rolled back.
What are the runtime requirements?
Node.js 18.x or later and a running PostgreSQL database instance. The server uses npm and TypeScript and requires the @modelcontextprotocol/sdk package.
Where does the server store data or state?
It does not store any data locally. All data remains in the connected PostgreSQL database. Transaction state is tracked in memory and released after commit, rollback, or timeout.
What transport protocol is supported?
The server connects to the MCP client via stdio (StdioServerTransport). There is no HTTP or WebSocket transport described.
Are there any security or production deployment warnings?
The README advises against using production credentials in configuration files and recommends using read-only query capabilities instead of direct modifications on production databases. Sensible timeout and connection pool limits should be configured for production use.
Frequently asked questions
How do read-only queries differ from data modification operations?
Read-only queries (SELECT) execute immediately. DML operations (INSERT, UPDATE, DELETE) are wrapped in a transaction and require the user to reply "yes" to commit or "no" to rollback. Unconfirmed or timed-out transactions are automatically rolled back.
What are the runtime requirements?
Node.js 18.x or later and a running PostgreSQL database instance. The server uses npm and TypeScript and requires the `@modelcontextprotocol/sdk` package.
Where does the server store data or state?
It does not store any data locally. All data remains in the connected PostgreSQL database. Transaction state is tracked in memory and released after commit, rollback, or timeout.
What transport protocol is supported?
The server connects to the MCP client via stdio (StdioServerTransport). There is no HTTP or WebSocket transport described.
Are there any security or production deployment warnings?
The README advises against using production credentials in configuration files and recommends using read-only query capabilities instead of direct modifications on production databases. Sensible timeout and connection pool limits should be configured for production use.
Basic information
More Databases MCP servers
Dbhub
bytebaseZero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, SQLite.
ClickHouse MCP Server
ClickHouseConnect ClickHouse to your AI assistants.
PostgreSQL Model Context Protocol (PG-MCP) Server
stuzeroMulti Database MCP Server
FreePeakA powerful multi-database server implementing the Model Context Protocol (MCP) to provide AI assistants with structured access to databases.
Redis MCP Server
redisThe official Redis MCP Server is a natural language interface designed for agentic applications to manage and search data in Redis efficiently
Comments