Keil / Proteus MCP
Enables opening existing Proteus projects, checking windows, taking screenshots, locating components, loading verified firmware, controlling simulation, reading accessible logs, and backing up and saving projects.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Keil / Proteus MCP(Windows)
两个独立的本地 stdio MCP 服务,让 Codex 修改 C51 程序、调用 Keil 构建、将本次生成的 HEX 加载到 Proteus 并控制仿真。针对本机 Keil 5.29 和 Proteus 8.13;不包含硬件烧录、断点调试、从零画电路或 PCB 布线。
安装和接入
需要 Windows 交互桌面、Node.js 22+、已安装且能使用的 Keil C51 和 Proteus。无需 Python。当前工作区已包含源码、锁文件和安装脚本。
cd 'D:\codex-学习软件mcp'
npm install
npm run build
node scripts/configure.mjs
powershell -ExecutionPolicy Bypass -File scripts/install.ps1 -Register注册脚本备份现有 Codex 配置,通过 codex mcp add 添加两个条目,保留其他设置。修改后重新加载 MCP 连接或重启 Codex。手动配置示例见 codex-config.example.toml,建议 tool_timeout_sec = 180(编译默认最多 120 秒)。
首次安装时,node scripts/configure.mjs 创建本机 config.json 和示例目录;已有配置会保留。请检查其中的软件路径和 allowedRoots。config.json 属于本机配置,不随仓库提交。
config.json 配置软件路径、工程目录白名单和超时。默认只能访问本项目 examples 下的工程。使用自己的工程时,把其目录加入 allowedRoots 后重启服务。配置可通过环境变量 EDA_MCP_CONFIG 指定绝对路径。
MCP 必须由当前 Windows 登录用户在交互桌面启动。锁屏、服务会话、沙箱隔离桌面无法保证截图和输入正常。自动操作时暂勿移动窗口或使用键鼠。界面操作串行执行,不要同时用其他桌面代理操作这两个应用。
Related MCP server: Proteus MCP
推荐流程
keil_read_project获取目标;keil_read_source获取源码和 SHA256。keil_replace_source指定唯一旧文本、新文本和读到的 SHA256,自动备份并保留编码。无 BOM 的非 UTF-8 文件需显式指定encoding: "gbk"等;不猜测编码。keil_build使用rebuild: true;检查success与artifactVerified,保留返回的buildId。proteus_open_project打开已有工程;proteus_simulation(action: "stop")停止仿真。proteus_set_firmware传入projectFile、元件reference(例如 U1)、buildId、可选的clockHz。工具按元件位号查找属性,加载并重新打开校验;支持 Proteus 自动转换的相对路径。proteus_simulation(action: "start")运行,检查返回的状态和截图;需要时proteus_screenshot查看显示结果。修改代码后重复构建和加载;最后停止仿真,调用
proteus_save_project保存,原工程自动备份。
可直接告诉 Codex:
使用 keil-mcp 和 proteus-mcp,打开 examples 下的数码管测试工程,把显示内容改为 5678。重新编译,确认新 HEX 后加载到 U1,运行仿真并检查截图。
工具与返回值
服务 | 工具 |
Keil | installation_check、read_project、open_project、read_source、replace_source、build、build_result(均加 |
Proteus | installation_check、open_project、inspect、screenshot、click、keys、type、control、open_component、set_firmware、simulation、read_logs、save_project(均加 |
截图返回 MCP 原生图片和 snapshotId。点击要求同一服务会话内、60 秒以内、未使用的截图 ID,窗口位置尺寸变化会拒绝执行。低层点击与输入仅表示输入已发送,返回 verified: false,需要随后观察。
proteus_control 使用 inspect 得到的名称、automationId 和窗口类名定位唯一控件。优先使用高层 set_firmware、simulation。出现意外对话框时先 inspect / screenshot,不自动点击未知确认按钮。
构建错误、超时、没有构建完成摘要、未启用 HEX、HEX 没有更新,都不会产生可加载的新固件凭证。构建成功但没有新 HEX 时使用重新编译。固件加载时再次核对 SHA256。
仿真状态根据原生菜单启用状态判断,不能代替对电路功能的验证。结果画面仍需 AI 查看。日志工具只返回可访问文本,不承诺能读到所有自绘日志或示波器数据。截图可能包含窗口遮挡区域,必要时最大化并重新截图。
测试与示例
npm.cmd test
npm.cmd run doctor
node scripts/acceptance.mjs 1234
node scripts/acceptance.mjs 5678验收脚本通过官方 MCP 客户端调用两个服务,保存 artifacts/acceptance-1234.png、acceptance-5678.png 和 JSON 操作记录。脚本本身不声称识别数码管,截图需另外检查。脚本针对本机最大化的 Proteus 8.13 标签位置;通用服务不依赖该固定坐标。
本机官方示例目录名虽为 8051 Timer with LCD,实际使用四位共阴数码管、AT89C51RD2、12 MHz 晶振。测试 C51 程序使用 P1 驱动段线、P0.0–3 选位、P2.7 保持低电平关闭报警。原始安装目录中的工程未修改。测试工程在 examples/8051 Timer.pdsprj,C51 工程在 examples/c51-display/display.uvproj。
scripts/setup-example.mjs 从本机 Keil HELLO 模板创建 C51 示例,已有输出时拒绝覆盖。Proteus 示例从安装目录复制使用,不随本项目重新分发第三方库。所有构建日志、截图、固件凭证存于 artifacts;源码和工程备份为同目录 .bak.*。
若服务异常退出留下 artifacts/*.lock,先确认对应进程确已退出再移除该锁。不要在另一服务正在操作时删锁。
实现依据
Keil 官方命令行:https://www.keil.com/support/man/docs/uv4cl/uv4cl_commandline.htm
Proteus 固件格式支持:https://www.labcenter.com/compilers/
MCP 官方 TypeScript SDK:https://github.com/modelcontextprotocol/typescript-sdk
界面桥接使用 Windows UI Automation、原生控件消息和限定应用窗口的输入;没有修改 Proteus 的私有二进制工程格式,没有依赖其自带 Python,也没有启用网络监听服务。
点击返回值(2026-12-02 更新)
proteus_click 的 inspectAfter 默认值为 false,减少一次控件检查;需要控件列表时显式传 true。截图令牌、焦点、遮挡、窗口矩形及对话框校验仍然执行。输入已发送不代表电路连接正确。
0.3.0 新增能力
proteus_export_netlist({pid, output?}):通过导出/编译网络表菜单导出 GBK SDF,默认写 artifacts 的唯一文件。指定 output 必须是 allowedRoots 下绝对 .SDF 路径,已有文件先备份。返回 parts、nets、sdfPath、sha256;支持电源/标签行。proteus_verify_connections({pid, expected:[{pins:["U1.P0.0","R1.1"]}]}):先导出新网表,再校验。missing 表示元件缺失;unknownPins 表示引脚未导出或匹配歧义;wrongNet 表示已找到的整组引脚分属不同网络;isolatedPins 仅检查 expected 涉及的孤立引脚,不将 MCU 其他未用引脚一律视为故障。引脚名大小写不敏感,P0.0 可唯一匹配 P0.0/AD0;复合名必须整段匹配,不能用前缀模糊匹配。
proteus_screenshot({pid, captureMode:"window"})使用 PrintWindow,失败或全黑回退屏幕截图。默认 screen;capture 标明实际来源,dpiAware 表示 DPI 初始化结果。仍保留前台焦点验证,不代表后台隔离操作。构建锁可回收已经退出进程留下的文件;活进程、权限不明或损坏的锁不会擅自删除。固件加载最多等待构建锁 130 秒;耗时工作流建议客户端 tool_timeout_sec 至少 300 秒。
node scripts/clean-artifacts.mjs只预览超过 14 天的 screen-.png / build-.json / build-*.log;加 --delete 才删除。有工作锁时跳过,不处理其他文件或子目录。node scripts/package-review.mjs通过白名单打包,明确排除 tia-portal/artifacts/admin-token.txt;--list 仅显示清单。目标审查包已存在时拒绝覆盖。状态栏坐标在本机 UIA/WM_GETTEXT 中不可读取,暂未提供原理图坐标点击工具。
详细验证范围及限制见 UPGRADE-REPORT-2026-12-02.md。scripts/create-sequence-sources.ps1 是历史 TIA 临时命令的修复替代脚本,依赖本工作区 TIA 模板;审查包不包含这些个人模板。
0.4.0 常驻辅助进程与等待策略
默认使用一个常驻 powershell.exe -STA 辅助进程,每个请求重新查找进程/窗口,并按请求获取、释放桌面互斥锁。需要一次性兼容模式时设置环境变量 EDA_MCP_HELPER=oneshot。对象结果包含 helperMode 和 helperElapsedMs;menus 数组返回结构保持不变。
发生超时、辅助进程退出或协议错误时,该请求报错,不自动重放;下一条请求重建辅助进程。超时错误为 Desktop operation timed out; helper restarted; UI state unknown,其中重启为下次请求惰性启动。应先检查当前 UI 再决定后续动作。
批量 settleMs 现在表示最短稳定等待,默认 60 ms、范围 20–1000 ms。同键、双击判定矩形内的相邻点击还会等到双击时间窗结束。等待期间检查目标进程输入空闲;不支持时退回最短等待。安全检查未省略。
node scripts/bench-helper.mjs 只运行两种模式各 20 次 dpi_probe。只有用户明确确认并行开发者已完成后,才可执行 node scripts/bench-helper.mjs --inspect --claude-complete --pid=实际Proteus进程号。标志只是防误操作,不代替用户确认。本轮未运行 GUI 基准。
完整范围、测试及实测数据见 UPGRADE-REPORT-4-5.md。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Remote desktop control, files, and terminal tools for AI assistants on paired Windows PCs.
Design circuits, simulate and verify embedded firmware, and lay out PCBs with AI agents.
Run, build, and validate firmware on virtual hardware from your AI agent. Hardware knowledge corpus.
Related MCP Servers
- AlicenseCqualityCmaintenanceEnables AI agents to build, flash, and debug STM32 projects compiled with Keil MDK-ARM on Windows, returning structured UV4 build diagnostics and evidence-based results. It also provides pyOCD/ST-Link debugging operations such as run control, breakpoints, register/PC reads, and global/static variable inspection.291MIT
- AlicenseBqualityBmaintenanceEnables MCP-capable AI clients to query local Proteus component libraries, edit schematics and constrained PCB routing, build 8051 firmware, run simulations, and read verified pin and network states.537MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to open Proteus 8.6 projects, edit schematics and wiring, assemble 8086 firmware, run simulations, inspect netlists, and capture screenshots for lab verification.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents and harnesses to directly operate Proteus 8 for circuit-spec validation, layout planning, simulation execution, and screenshot-guided step-by-step design and debugging workflows.MIT