Cursor 配置 MCP Server 完整教程

cursor-mcp-setup MCPAI编程Cursor
# Cursor 配置 MCP Server 完整教程 Cursor 是最受欢迎的 AI IDE 之一。本文将教你如何配置 MCP Server,让 Cursor 拥有网页搜索、文件操作等超能力。 ## Cursor 的 MCP 配置入口 在 Cursor 中配置 MCP Server 有两种方式: ### 方式一:项目级配置(推荐) 在项目根目录创建 `.cursor/mcp.json`: ```json { "mcpServers": { "hermes-mcp": { "command": "hermes-mcp", "args": [] } } } ``` ### 方式二:全局配置 编辑 `~/.cursor/mcp.json`,对所有项目生效。 ## 安装 Hermes MCP Server ```bash # 全局安装 npm install -g hermes-mcp-server # 设置授权 Key mkdir -p ~/.hermes-mcp echo "YOUR_LICENSE_KEY" > ~/.hermes-mcp/license.key ``` > 💡 还没有 Key?[点这里购买 Pro 版](/pro),¥29 永久授权。 ## 测试配置 1. 重启 Cursor 2. 打开 Command Palette(`Cmd+Shift+P` / `Ctrl+Shift+P`) 3. 输入 "MCP: List Servers" 4. 你应该能看到 `hermes-mcp` 出现在列表中 然后在 Chat 中试试: ``` 搜索最新的 Tailwind CSS 4.0 新特性 ``` 如果配置正确,Cursor 会自动调用 MCP Server 的网页搜索工具。 ## 进阶技巧 ### 故障排查 如果 MCP Server 没有启动,检查: 1. Cursor 日志:`~/.cursor/logs/` 2. 确认 `hermes-mcp` 命令可用:`which hermes-mcp` 3. 确认授权 Key 文件存在:`cat ~/.hermes-mcp/license.key` ### 多个 MCP Server 共存 ```json { "mcpServers": { "hermes-mcp": { "command": "hermes-mcp", "args": [] }, "playwright": { "command": "npx", "args": ["@anthropic/mcp-playwright"] }, "filesystem": { "command": "npx", "args": ["@anthropic/mcp-filesystem"] } } } ``` ## 总结 配置 MCP Server 是提升 Cursor 能力上限的关键一步。有了网页搜索和执行命令的能力,Cursor 从"智能补全工具"变成了真正的"AI 编程搭档"。
← 返回博客列表