edge-mcp
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.
edge-mcp — 让模型直接操作你的 Microsoft Edge
一个 MCP 服务器:模型能开标签、点按钮、填表单、读页面、看网络流量、改写响应、截图, 操作的就是你本机那个真实的 Edge —— 登录态、cookie、扩展、代理设置全都在,所以 「登录之后才能看的页面」也能直接看,不用再导 cookie 出来。
零第三方依赖:只用 Node 内置的 WebSocket/fetch 直连 Chrome DevTools Protocol(CDP),
唯一的 npm 依赖是 @modelcontextprotocol/sdk。拷到别的机器上 node server.js 就能跑。
快速开始
cd edge-mcp
npm install
node test/unit.test.js # 单元测试(假 CDP 端点,不需要 Edge)
node test/selftest.js # 自检:Edge 路径、profile、schema
node test/live.js # 真机测试:真拉起一个无头 Edge 跑全套动作
node test/live.js --headed # 同上,但你能肉眼看它自己点注册进任意 MCP 客户端(下面以 DSH 的 dsh-mcp 管理器为例,它不在本仓库里):
# 本机已装 dsh-mcp 管理器时
node /path/to/dsh-mcp/bin/dsh-mcp.js add --command node --arg /absolute/path/to/edge-mcp/server.js --timeout 120000
node /path/to/dsh-mcp/bin/dsh-mcp.js test edge # 连一下,列出工具没有管理器也行,任何支持 stdio MCP 的客户端(Claude Desktop、Cline、Continue…)都可以直接配:
{
"mcpServers": {
"edge": {
"command": "node",
"args": ["/absolute/path/to/edge-mcp/server.js"]
}
}
}注册完重启客户端才会加载新服务器。
DSH 用户也可以手工往 cordis.patch.yml(DSH 配置目录的 profiles/web/ 下)的 managed 块里加,
但那个块是 dsh-mcp 管理器生成的,手工改会在下次 dsh-mcp 操作时被覆盖 —— 建议走 CLI。
Related MCP server: Edge DevTools MCP
怎么用(给模型的最短路径)
edge_browser(op="connect")—— 复用你已经开着的 Edge(前提是它带--remote-debugging-port=9222启动)。连不上就
edge_browser(op="launch")—— 本服务自己拉一个 Edge(独立 profile,不动你的主 profile)。edge_tabs(op="open", url="https://example.com")开标签,edge_read看页面结构。edge_find先确认目标唯一,再edge_click/edge_type;edge_read或edge_screenshot确认结果。
让 Edge 开着调试端口
想复用「自己日常那个 Edge」,得让它带调试端口启动(Edge 默认不开):
& "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=9222注意:如果 Edge 已经在跑(没有这个参数),新命令只会把窗口交给已有进程,端口不会开 ——
要么先完全退出 Edge,要么用独立的 --user-data-dir。这也是本服务默认走
「自己 launch 一个独立 profile」的原因。
工具(21 个)
工具 | 作用 |
| 浏览器选择器:返回「选 Edge 还是 Google」的问题与选项,让 Agent 弹窗让用户决定(同时装了 google-mcp 时用) |
| connect / launch / status / quit |
| list / open / switch / close / activate |
| goto(自动补 https://)/ back / forward / reload(可强刷) |
| 读页面:outline(可交互元素+坐标+选择器)/ text / html / aria |
| 找元素:selector / text / role+name / xpath,返回选择器与落点(默认只算可见元素, |
| 真实鼠标点击(可 dry_run 先看落点、clear+with_value 先填再点) |
| 文本输入(可 clear、submit、逐字 delay_ms) |
| 按键 Enter / Tab / Escape / 方向键…(支持 ctrl/shift/alt/meta) |
| 滚动(真实 mouseWheel) |
| 视口 / 整页截图,可 save_as 落盘 |
| 页面里跑脚本(支持 |
| localStorage / sessionStorage / cookie(cookie 含 httpOnly) |
| 请求列表(filter/method/status)、响应体、清空 |
| 用 Fetch 域把请求改写成伪造响应(status/body/headers,可限命中次数) |
| 控制台消息(含异常、日志级别过滤) |
| 性能指标(堆、DOM 节点数、布局次数、监听器数) |
| 等文字 / 选择器出现 |
| 订阅 CDP 事件( |
| 处理 alert / confirm / prompt(默认会等最多 1.5s 等弹窗出现) |
| 逃生舱:直接下发任意 CDP 命令(scope=page / browser) |
所有工具都支持 tab_id 精确指定标签。
环境变量
变量 | 默认 | 说明 |
|
| CDP 端口 |
|
| CDP 主机 |
| 自动探测 |
|
|
| launch 用的 profile 目录 |
| — | profile 名( |
|
| launch 的首页 |
|
| 截图落盘目录 |
| 关 |
|
| 关 |
|
| 关 |
|
行为与边界
只杀自己拉起来的 Edge:
launch会记住 pid,edge_browser(op="quit")只杀那个进程树; 你自己的浏览器它绝不动。MCP 退出时只断开连接,不关浏览器。独立 profile:默认 profile 在
%LOCALAPPDATA%\dsh-edge-mcp\profile,登录过的站点会留在里面, 既不污染你日常的 profile,又能攒下登录态。事件只从 enable 那一刻开始记:连上标签时会自动预热
Page/Runtime/Log/Network四个域。 如果页面在你连接之前就加载完了,那之前的请求自然看不到 —— 重新edge_goto一次即可。截图会落盘:
save_as写到EDGE_SHOT_DIR,返回绝对路径。不改你的文件系统:除了截图和 profile,edge-mcp 不在磁盘上留东西。
目录结构
edge-mcp/
server.js MCP 入口(stdio,工具调度与结果格式化)
src/tools.js 21 个工具的定义(描述 / schema / handler)
src/lib/cdp.js CDP 客户端(原生 WebSocket,按 id 派发响应与事件)
src/lib/browser.js 浏览器与标签会话(attach、事件缓存、Fetch 拦截)
src/lib/env.js 端口探测、Edge 定位、launch 参数
src/lib/pages.js 页面级动作(读/找/点/输入/求值/截图/网络/存储/监听)
test/helpers.js 假 CDP 端点 + 极小 MCP stdio 客户端(单元测试用)
test/unit.test.js 协议链路测试(不需要 Edge / 不需要网络)
test/selftest.js 环境自检
test/live.js 真机集成测试(真 Edge,夹具页含表单/异步/弹窗/XHR)已知限制
无头模式下
alert/confirm由 CDP 接管,不会真弹窗;有头模式才会看到。edge_network只在内存里留最近 1000 条请求,长会话建议及时op="clear"。富文本编辑器(contenteditable 的复杂组件、CodeMirror 之类)用
Input.insertText可能不触发 框架的变更回调,必要时用edge_eval直接派发事件或调组件 API。跨域 iframe 里的元素要单独
edge_cdp(method="Target.getTargets")找到 iframe 的 target 再操作。
测试
cd edge-mcp
npm test # = node test/unit.test.js,用假 CDP,不需要 Edge
node test/selftest.js # 环境自检:Edge 路径、profile、工具 schema
node test/live.js # 真机集成测试:拉起自己的 headless Edge + 本地夹具页真机测试用独立 profile(%TEMP%\dsh-edge-mcp-live-*)和随机端口,跑完自动杀进程树;
端口被占用时用 $env:EDGE_LIVE_PORT='9447' 换一个。夹具页覆盖表单、异步出现、弹窗、
XHR 401、localStorage/cookie、Fetch 改写等场景,每条断言都走 src/tools.js 的真实 handler
(和模型调用同一条路径),不是绕过工具层直接调 CDP。
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
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Hosted browser for agents: open pages, search the web, extract data, read PDFs and take screenshots.
Playwright browser automation — navigate, click, fill forms, extract, screenshot — 17 agent tools.
A real browser for your agent: screenshots, page checks, Markdown and PDFs.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables an AI agent to drive the user's actual Microsoft Edge or Chrome profile through a browser extension using tab-scoped CDP, preserving existing cookies and logins without Selenium, Playwright, or a remote debugging port. Exposes tools for listing tabs, reading cookies, evaluating JavaScript, sending raw CDP commands, batching operations, clicking, typing, uploading files, capturing screenshots, and adjusting content settings.MIT
- AlicenseAqualityCmaintenanceEnables LLM agents to launch or attach to a Microsoft Edge session and drive it through a four-tiered tool set spanning navigation, clicking, typing, and token-efficient accessibility-tree inspection. Also exposes raw Chrome DevTools Protocol calls for network interception, cookie manipulation, console and performance telemetry, and device emulation.202MIT
- AlicenseAqualityBmaintenanceEnables AI agents and MCP clients to drive real Chrome, Edge, Brave, and Firefox browsers through native automation protocols. It exposes tools for navigation, page snapshots, form filling, clicks, screenshots, console/network inspection, and tab management.23MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to control a running Brave/Chromium browser through 33 tools for tab management, DOM inspection, form interaction, screenshots, and console/network capture without closing or relaunching the browser.510 npmMIT