cursor + mcp + mysql以及postgresql

1. mysql 在cursor mcp直接配置:

"mysql2": {
      "command": "powershell",
      "args": [
        "-Command",
        "npx -y @f4ww4z/mcp-mysql-server"
      ],
      "env": {
        "MYSQL_HOST": "172.38.xxx.xxx",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "Ehl@123~",
        "MYSQL_DATABASE": "ehl_security"
      }
    }

2.配置postgresql有些复杂

首先需要python环境:https://www.python.org/downloads/windows/

其次下载visualstudio:https://visualstudio.microsoft.com/zh-hans/downloads/

安装:npm install -g @bytebase/dbhub@0.11.2

执行测试:npx -y @bytebase/dbhub --transport stdio --dsn postgres://gpadmin:gpadmin@172.38.xxx.xxx:5432/ehl_yantai?sslmode=disable

"dbhub-postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub",
        "--transport",
        "stdio",
        "--dsn",
        "postgres://gpadmin:gpadmin@172.38.xxx.xxx:5432/ehl_yantai?sslmode=disable"
      ]
    }

最后测试cursor:

image

 

posted @ 2025-08-09 23:13  蔡徐坤1987  阅读(500)  评论(0)    收藏  举报