cursor_admin_mcp

cursor_admin_mcp

A cross-platform MCP server providing secure, user-approved privilege escalation for Cursor agents, with tools for running commands as admin on Windows and root on Linux.

Category
访问服务器

README

cursor_admin_mcp

Cross-platform secure MCP server for Cursor agents. Exposes elevated execution tools with mandatory human approval before privilege escalation:

  • Windows: run_as_admin — PowerShell with WPF approval dialog and UAC
  • Linux: run_as_root — bash with zenity approval dialog and sudo

Requirements

All platforms

  • Node.js 20 or later

Windows (run_as_admin)

  • Windows 10 or later
  • Windows PowerShell 5.1 (default powershell on Windows)
  • WPF (PresentationFramework) for the approval dialog

Linux (run_as_root)

  • bash
  • sudo (user must have sudo privileges)
  • zenity for approval and password dialogs
  • DISPLAY or WAYLAND_DISPLAY set (GUI session required)

Install example (Debian/Ubuntu):

sudo apt install zenity

Security model

Both tools follow the same pattern: payload isolation, visual approval, privilege escalation, log capture, cleanup.

Windows — run_as_admin

  1. The agent sends a PowerShell command string.
  2. The server writes the command to an isolated temporary .ps1 file.
  3. A wrapper script shows a WPF MessageBox with the exact command payload.
  4. If the user clicks Yes, UAC prompts for elevation and the payload runs elevated.
  5. If the user clicks No, execution stops and the tool returns Execution denied by user.
  6. stdout/stderr are captured to a temporary log file and returned to the agent.
  7. All temporary files are deleted after each invocation.

Linux — run_as_root

  1. The agent sends a bash command string.
  2. The server writes the command to an isolated temporary .sh file.
  3. A wrapper script shows a zenity question dialog with the exact command payload.
  4. If the user clicks Yes, sudo -A runs the payload using a temporary SUDO_ASKPASS script (zenity --password).
  5. If the user clicks No, execution stops and the tool returns Execution denied by user.
  6. stdout/stderr are captured to a temporary log file and returned to the agent.
  7. All temporary files are deleted after each invocation.

The agent cannot bypass approval or elevation on either platform. Use the tool that matches the current OS.

Build and run

npm install
npm run build
npm start

Other scripts:

  • npm run typecheck — TypeScript check without emit
  • npm test — run unit tests

Branching and releases

Branch Purpose
develop Day-to-day development; open PRs here
main Stable releases only; merge from develop when ready

Workflow:

  1. Branch from develop for features and fixes.
  2. Open pull requests targeting develop. CI runs on every push and PR.
  3. When ready to ship, merge develop into main (via PR or fast-forward merge).
  4. Each push to main runs the Release workflow: build, test, then create a GitHub release tagged v{version} from package.json.
  5. Bump version in package.json before merging to main so each release gets a unique tag. If the tag already exists, the release job skips creation and logs a reminder to bump the version.

To start using develop:

git checkout -b develop
git push -u origin develop

Set develop as the default branch in GitHub repository settings if you want new PRs to target it by default.

Cursor MCP configuration

Add this server in Cursor → Settings → Features → MCP Servers (adjust the path if your clone location differs):

{
  "mcpServers": {
    "cursor-admin-mcp": {
      "command": "node",
      "args": ["C:\\dev\\repos\\others\\cursor_admin_mcp\\dist\\index.js"]
    }
  }
}

On Linux, use the appropriate absolute path to dist/index.js.

After changing MCP settings, reload MCP servers in Cursor.

Manual smoke test

Windows

  1. Build the project: npm run build
  2. Register the MCP server in Cursor using the config above.
  3. Ask the agent to call run_as_admin with: Write-Output "hello"
  4. Confirm the WPF dialog shows the exact command.
  5. Click Yes, approve UAC, and verify output contains hello.
  6. Run again and click No — verify the tool returns Execution denied by user. without a UAC prompt.
  7. Confirm no leftover temp files remain under %TEMP%.

Linux

  1. Build the project: npm run build
  2. Register the MCP server in Cursor.
  3. Ask the agent to call run_as_root with: echo "hello"
  4. Confirm the zenity dialog shows the exact command.
  5. Click Yes, enter your sudo password in the zenity prompt, and verify output contains hello.
  6. Run again and click No — verify the tool returns Execution denied by user. without a sudo prompt.
  7. Confirm no leftover temp files remain under /tmp.

Calling run_as_admin on Linux or run_as_root on Windows returns a clear platform error without elevation.

SDK note

This project uses @modelcontextprotocol/server@2.0.0-alpha.2 (MCP TypeScript SDK v2 alpha). The v2 API may change before stable release.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选