cursor配置mcp并使用
确保在本地安装了Node.js(包含 npm),下载地址:Node.js — Run JavaScript Everywhere
检查是否安装成功
node -v
npm -v
项目配置:
在项目目录中创建一个 .cursor/mcp.json文件
server与clients的地址:MCP Servers
在cursor中配置
方法一:直接在设置里配置
npx @modelcontextprotocol/server-sequential-thinking
方法二:
在.cursor/mcp.json添加配置
{"mcpServers": {"sequential-thinking": {"command": "npx","args": ["-y","@modelcontextprotocol/server-sequential-thinking"]},"playwright": {"command": "npx","args": ["-y","@playwright/mcp@latest","--headless"]}}
}
显示绿色说明连接成功
使用:
以sequential-thinking为例
sequential-thinking
的作用:
-
启用 多步思考策略(Chain-of-Thought prompting)。
-
适用于复杂任务分解场景,比如:
-
多步逻辑代码生成
-
链式调用接口组合
-
思维导图式规划代码结构
-
cursor会自动调用sequential-thinking,例如:
分析一下最短路径问题,会自动调用sequential-thinking