Cursor Code
FreeNot checkedConnects Windows-based Codex to the Cursor Agent CLI in WSL, providing a run_cursor tool to execute tasks in specified working directories and resume sessions p
About
Connects Windows-based Codex to the Cursor Agent CLI in WSL, providing a run_cursor tool to execute tasks in specified working directories and resume sessions per directory.
README
该服务将运行在 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(微软操作系统)中可能同名的其他命令。
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(版本控制)提交。
Installing Cursor Code
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/guheng-re/cursor-code-mcpFAQ
Is Cursor Code MCP free?
Yes, Cursor Code MCP is free — one-click install via Unyly at no cost.
Does Cursor Code need an API key?
No, Cursor Code runs without API keys or environment variables.
Is Cursor Code hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Cursor Code in Claude Desktop, Claude Code or Cursor?
Open Cursor Code on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectAmap Maps Mcp Server
MCP server for using the AMap Maps API
by duxiaohuiSupabase
Database, auth and storage
by SupabaseEverything
Reference / test server with prompts, resources, and tools.
Git
Tools to read, search, and manipulate Git repositories.
Sequential Thinking
Dynamic and reflective problem-solving through thought sequences.
Time
Time and timezone conversion capabilities.
Compare Cursor Code with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
