文章

AI接入mcp

安装mysql-mcp-server
npm install -g @benborla29/mcp-server-mysql

项目下新建 .mcp.json

{
  "mcpServers": {
    "mysql": {
      "command": "node",
      "args": ["C:/Users/41597/mysql-mcp-server/dist/index.js"],
      "env": {
        "DB_HOST": "localhost",
        "DB_USER": "root", 
        "DB_PASSWORD": "root",
        "DB_PORT": "3306"
      }
    }
  }
}
# 安装playwright相关包
npm install -g @playwright/test
npm install -g @executeautomation/playwright-mcp-server
 
# 安装浏览器(会下载Chrome、Firefox等,比较大,需要等一会)

npx playwright install

claude mcp remove playwright -s local


# windows 方法
claude mcp add-json playwright "{\"command\": \"cmd\", \"args\": [\"/c\", \"npx\", \"@executeautomation/playwright-mcp-server\"]}"
 
这一步的意思是:告诉Claude Code要先启动Windows命令行(cmd),然后在命令行里执行npx命令。
 
# mac方法
 
claude mcp add-json playwright '{"command": "/bin/bash", "args": ["-c", "npx @executeautomation/playwright-mcp-server"]}'