MCP.so
登录

PostgreSQL MCP 服务器

@cynhardchuengc

关于 PostgreSQL MCP 服务器

暂无概览

基本信息

分类

数据库

运行时

node

传输方式

stdio

发布者

cynhardchuengc

配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

{
  "mcpServers": {
    "pg-mcp-server-cynhardchuengc": {
      "command": "node",
      "args": [
        "dist/index.js",
        "postgresql://用户名:密码@数据库地址:端口/数据库名"
      ]
    }
  }
}

工具

未检测到工具

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

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.

评论

数据库 分类下的更多 MCP 服务器