Back to MCP directory
publicPublicdnsLocal runtime

simple-postgres-mcp

一个简单的PostgreSQL MCP服务器,用于执行SQL查询并支持可配置的读写权限。

article

README

🚀 简单的PostgreSQL MCP服务器

这是一个轻量级的模型上下文协议(MCP)服务器,用于在PostgreSQL数据库上执行SQL查询,并且具备可配置的权限。

✨ 主要特性

  • 可执行SQL查询,支持可选的只读或写入访问。
  • 可通过命令行配置服务器级别的模式(只读/写入)。
  • 返回带有元数据的结构化结果。
  • 使用PostgreSQL连接字符串即可轻松完成设置。

🚀 快速开始

📦 安装指南

  1. 克隆仓库
    git clone https://github.com/perrypixel/Simple-Postgres-MCP
    cd Simple-Postgres-MCP
    
  2. 安装依赖
    npm install
    
  3. 构建项目
    npm run build
    

📚 详细文档

MCP配置

将以下内容添加到您的MCP客户端配置文件(mcp.json)中:

写入模式(默认)
{
  "mcpServers": {
    "simple-postgresql-mcp": {
      "command": "node",
      "args": [
        "/path/to/build/index.js",
        "postgresql://username:password@localhost:5432/database_name",
        "write"
      ]
    }
  }
}
只读模式
{
  "mcpServers": {
    "simple-postgresql-mcp": {
      "command": "node",
      "args": [
        "/path/to/build/index.js",
        "postgresql://username:password@localhost:5432/database_name",
        "readonly"
      ]
    }
  }
}

⚠️ 重要提示

请更新配置中的路径,使其指向您build文件夹内的index.js文件。

💻 使用示例

  1. 将合适的MCP配置(只读或写入模式)复制到您工具的mcp.json文件中(例如Cursor、Windsurf、Copilot等)。
  2. 启动您的MCP客户端,此时服务器即可使用!

🤝 支持项目

如果您觉得这个工具很有用,可以通过以下方式支持开发:

  • 在https://ko-fi.com/perrypixel 请我喝杯咖啡。
  • 通过UPI转账至kevinp@apl。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client