cursor-code-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cursor-code-mcpIn D:\code\myapp, have Cursor fix the failing tests"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Cursor Code(代码编辑器)MCP(模型上下文协议)
该服务将运行在 Windows(微软操作系统)上的 Codex(代码智能体)连接到 WSL(适用于 Linux 的 Windows 子系统)中的官方 Cursor Agent(Cursor 代理)CLI(命令行工具)。它只提供 run_cursor 工具,并按规范化后的 Windows(微软操作系统)cwd 自动保存与恢复 Cursor(代码编辑器)会话。
安装
先在 Windows(微软操作系统)PowerShell(微软命令行环境)中安装 Cursor Agent(Cursor 代理)CLI(命令行工具):
wsl -d Ubuntu -- bash -lc 'curl -fsS https://cursor.com/install | bash'
wsl -d Ubuntu -- bash -lc 'export PATH="$HOME/.local/bin:$PATH"; agent --version'再完成一次 Cursor(代码编辑器)账号登录:
wsl -d Ubuntu -- bash -lc 'export PATH="$HOME/.local/bin:$PATH"; agent login'安装 Python(编程语言)依赖:
python -m pip install -r requirements.txt服务会将 Windows(微软操作系统)工作目录转换为 WSL(适用于 Linux 的 Windows 子系统)挂载路径,例如 D:\\project\\demo 转为 /mnt/d/project/demo。Cursor Agent(Cursor 代理)在无交互模式下使用 -p --force --output-format json,因此可以直接修改指定工作目录。
服务会在每次 WSL(适用于 Linux 的 Windows 子系统)调用前将 ~/.local/bin(用户本地命令目录) 放到 PATH(环境变量搜索路径) 首位,确保运行官方 Cursor Agent(Cursor 代理)agent 命令,而不误用 Windows(微软操作系统)中可能同名的其他命令。
Related MCP server: Cursor Agent MCP Server
Codex(代码智能体)配置
在 ~/.codex/config.toml 中添加:
[mcp_servers.cursor_code]
command = "python"
args = ["/absolute/path/to/cursor_code_mcp.py"]
startup_timeout_sec = 30
tool_timeout_sec = 21600
enabled_tools = ["run_cursor"]
default_tools_approval_mode = "auto"
[mcp_servers.cursor_code.env]
CURSOR_WSL_DISTRIBUTION = "Ubuntu"
CURSOR_COMMAND = "agent"
# 可选:指定 Cursor(代码编辑器)模型;此示例为 Grok 4.6(Grok 4.6 模型)的最高推理强度快速档。
CURSOR_MODEL = "cursor-grok-4.6-xhigh-fast"Windows(微软操作系统)示例可写为:
[mcp_servers.cursor_code]
command = "D:\\anaconda\\python.exe"
args = ["D:\\project\\cursor-code-mcp\\cursor_code_mcp.py"]
startup_timeout_sec = 30
tool_timeout_sec = 21600
enabled_tools = ["run_cursor"]
default_tools_approval_mode = "auto"
[mcp_servers.cursor_code.env]
CURSOR_WSL_DISTRIBUTION = "Ubuntu"
CURSOR_COMMAND = "agent"
CURSOR_MODEL = "cursor-grok-4.6-xhigh-fast"可选环境变量 CURSOR_MODEL 会传递为 --model(模型参数)。cursor-grok-4.6-xhigh-fast 是当前 CLI(命令行工具)列出的 Grok 4.6(Grok 4.6 模型)最高推理强度快速档;可通过 agent --list-models(列出模型)查看本账号可用的最新标识。若使用 API(接口)密钥而不是浏览器登录,请在 WSL(适用于 Linux 的 Windows 子系统)环境中设置 CURSOR_API_KEY,不要将密钥提交到仓库。
工具
run_cursor 只接收两个必填参数:
prompt:交给 Cursor Agent(Cursor 代理)的完整任务。cwd:目标项目的 Windows(微软操作系统)绝对工作目录。
首次调用创建 Cursor(代码编辑器)会话;同一目录后续调用自动使用 --resume(恢复会话)。仅在任务成功完成后,服务才写入 state/sessions.json(会话映射)。每次调用会阻塞至 Cursor Agent(Cursor 代理)结束,并返回状态、退出码、最终 JSON(数据格式)结果与日志路径。日志保存在 logs,会话映射保存在 state/sessions.json,两者均不会被 Git(版本控制)提交。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceFacilitates integration with the Cursor code editor by enabling real-time code indexing, analysis, and bi-directional communication with Claude, supporting concurrent sessions and automatic reconnection.1439MIT
- AlicenseCqualityCmaintenanceWraps the cursor-agent CLI to provide cost-effective tools for repository analysis, code search, planning, and editing. Offloads heavy thinking tasks from the host AI to reduce token usage while maintaining precise, scoped workspace operations.75MIT
- AlicenseAqualityDmaintenanceProvides workspace-scoped file operations and command execution tools for building Cursor-style agents, along with system prompts and tool definitions for LLM integration.5MIT
- Alicense-qualityBmaintenanceEnables MCP clients like Claude Code to delegate coding tasks to the local Cursor Agent CLI, with persistent per-workspace sessions that resume across calls.12MIT
Related MCP Connectors
Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.
Securely search and manage workspace context files for AI agents and teams.
Coding agents from Claude Code, Cursor and Codex claim jobs and lock files on one shared board.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/guheng-re/cursor-code-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server