edge-mcp
Click on "Deploy 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., "@edge-mcp open example.com and take a screenshot of the page"
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.
edge-mcp
一个让你用自然语言控制 Microsoft Edge 浏览器的 MCP(Model Context Protocol)server。
它通过 Chrome DevTools Protocol (CDP) 连接到一个已经启动好的 Edge 实例,把浏览器能力以 16 个工具的形式暴露给任何 MCP 客户端。模型可以打开网页、点击、输入、截图、读取页面内容、管理标签页。
两种运行模式
本 server 支持两种模式,覆盖所有 MCP 客户端的接入方式:
模式 | 启动方式 | 适用场景 | 地址 |
stdio(默认) |
| 客户端自己拉起子进程(ZCode / Claude Desktop 的 stdio 配置) | 无,进程间管道 |
HTTP 常驻(推荐多 agent 共享) |
| 一个 URL 让本机所有 agent 共享同一个 Edge 会话 |
|
为什么有 HTTP 模式? stdio 模式下每个客户端各自启动一个 server 进程、各自独立。HTTP 模式下,server 常驻后台,所有 agent(ZCode、Claude Desktop、Cursor、Cline 等)指向同一个 URL,共享同一个 Edge 浏览器会话——你在 A 工具里打开的标签页,B 工具也能看到和操作。
关于"Edge 扩展":浏览器扩展运行在沙箱内,不能监听端口、不能说 stdio,因此无法直接做成 MCP server。HTTP 常驻服务才是"独立地址 + 所有 agent 共享"的正确实现。
Related MCP server: octolimb
工作原理
stdio 模式: HTTP 模式:
MCP 客户端 ──spawn──> edge-mcp 进程 ──CDP──> Edge 所有 MCP 客户端 ──HTTP──> edge-mcp 常驻进程 ──CDP──> Edge
(一对一,各自独立) (多对一,共享同一 Edge 会话)Edge 由你自己启动(带调试端口),server 不负责拉起浏览器,只负责连接。
连接是懒加载的:server 启动时不连 Edge,第一次调用工具时才连。即使 Edge 没开,server 也能正常启动;调用工具时返回友好错误。
CDP 端口默认
9222,可用环境变量EDGE_CDP_PORT覆盖。
前置要求
Node.js >= 20(已在 v24 上测试)
Microsoft Edge(Chromium 内核,已测试 Edg/150)
一个 MCP 客户端(ZCode / Claude Desktop / Cursor / Cline 等)
安装
# 方式一:npm 全局安装(依赖自动装齐)
npm install -g edge-mcp
edge-mcp --http # HTTP 常驻模式
edge-mcp # stdio 模式
# 方式二:免安装直接运行
npx edge-mcp --http
# 方式三:从源码
git clone https://github.com/hualang-C/edge-mcp.git edge-mcp
cd edge-mcp
npm install第一步:启动 Edge(带调试端口)
Edge 必须先启动并开放 CDP 端口。用独立的 user-data-dir,避免和你日常浏览的 Edge 冲突:
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" \
--remote-debugging-port=9222 \
--user-data-dir="C:/Temp/EdgeMCP" \
--remote-allow-origins=* \
--no-first-run \
--no-default-browser-check
--user-data-dir指向空目录,会创建独立 profile(不影响你已登录的 Edge 会话)。
--remote-allow-origins=*允许本地 Node 进程通过 WebSocket 连接(新版 Chromium 必需)。想复用你已登录的 Edge 会话?去掉
--user-data-dir,但要先完全退出日常使用的 Edge 再用这条命令启动。
验证 Edge 已就绪:
curl http://127.0.0.1:9222/json/version
# 应返回包含 "webSocketDebuggerUrl" 的 JSON第二步(A):HTTP 模式 —— 多 agent 共享(推荐)
启动常驻服务
# 在项目根目录(package.json 所在目录)执行
node src/index.js --http
# 或: npm run start:http服务监听 http://127.0.0.1:7123/mcp。可用环境变量改地址:
PORT=8080 HOST=127.0.0.1 node src/index.js --http验证:
curl http://127.0.0.1:7123/health
# {"ok":true,"service":"edge-mcp","tools":16}想开机常驻?把这个命令设为 Windows 启动项,或用任务计划程序/PM2 守护。
各 MCP 客户端配置(指向同一 URL)
ZCode(~/.zcode/cli/config.json):
{
"mcp": {
"servers": {
"edge": {
"type": "http",
"url": "http://127.0.0.1:7123/mcp"
}
}
}
}Claude Desktop(claude_desktop_config.json):
{
"mcpServers": {
"edge": {
"url": "http://127.0.0.1:7123/mcp",
"type": "http"
}
}
}Cursor / Cline / 其他:在各自的 MCP 设置里填 URL http://127.0.0.1:7123/mcp,类型选 HTTP / streamable-http。
配置好后,所有客户端都共享同一个 Edge 浏览器会话。
第二步(B):stdio 模式 —— 客户端各自拉起
适合不想常驻后台、让客户端按需启动的场景。每个客户端各自启动一个 server 进程(彼此独立)。
ZCode(~/.zcode/cli/config.json):
{
"mcp": {
"servers": {
"edge": {
"command": "node",
"args": ["<edge-mcp 的绝对路径>/src/index.js"]
}
}
}
}Claude Desktop:
{
"mcpServers": {
"edge": {
"command": "node",
"args": ["<edge-mcp 的绝对路径>/src/index.js"]
}
}
}把
<edge-mcp 的绝对路径>替换为你机器上 clone 的实际路径(如C:/dev/edge-mcp或~/projects/edge-mcp)。路径含空格时,args 必须用数组形式(如上)而不是单个字符串,避免被错误拆分。
工具列表(16 个)
所有导航/交互/读取工具都作用于当前活动标签页。要操作特定标签页,先用 switch_tab 切换。
导航(4)
工具 | 参数 | 说明 |
|
| 跳转到 URL。 |
| — | 后退一步 |
| — | 前进一步 |
|
| 刷新当前页 |
交互(4)
工具 | 参数 | 说明 |
|
| 点击元素(CSS 选择器) |
|
| 逐字符输入(触发 keydown/keyup,适合 contenteditable) |
|
| 一次性设置 input/textarea/select 的值(清空后赋值,派发 input 事件,框架友好) |
|
| 按键,如 |
读取(4)
工具 | 参数 | 说明 |
|
| 截图,返回 base64 图片(模型可直接看到)。 |
|
| 返回元素或整页的可见文本( |
|
| 返回元素的 |
|
| 在页面上下文执行 JS 表达式,返回 JSON 结果。可用 |
标签页(4)
工具 | 参数 | 说明 |
| — | 列出所有标签页的 |
|
| 新建标签页(可带 URL),返回 |
|
| 切到指定标签页并前置(之后其他工具作用于它) |
|
| 关闭标签页(省略则关活动标签页) |
* = 必填,? = 可选。
典型用法示例
1. navigate -> url: https://www.bing.com
2. fill -> selector: "#sb_form_q", text: "MCP protocol"
3. press -> key: Enter
4. screenshot -> fullPage: false
5. get_text -> selector: "#b_results"常见问题
调用工具报错:"Could not reach Edge at http://127.0.0.1:9222"
Edge 没启动或没带调试端口。按"第一步"启动 Edge,并用 curl http://127.0.0.1:9222/json/version 验证。
HTTP 模式连不上 / 端口被占用
换端口:PORT=8080 node src/index.js --http,并相应改客户端配置里的 URL。
找不到元素
页面可能还没加载完。navigate 时用 waitUntil: "networkidle0",或先 screenshot 看当前状态。
type vs fill 怎么选
type:逐字符输入,触发完整键盘事件,适合 contenteditable、自动补全下拉。fill:直接设 DOM value,更快,适合普通 input/textarea/select。
关闭 server 会关掉 Edge 吗 不会。server 退出只断开 CDP 连接,Edge 进程继续运行。
stdio 和 HTTP 能同时用吗 能。但更推荐统一用 HTTP 模式,避免多个 server 进程争抢同一个 Edge 调试端口。
项目结构
edge-mcp/
├── package.json
├── README.md
└── src/
├── index.js # 入口:按 --http 参数分流到 stdio 或 HTTP
├── server.js # 共享的 McpServer 工厂(注册 16 个工具)
├── http.js # HTTP 常驻服务(Streamable HTTP, stateless)
├── browser.js # Edge 连接管理:单例/懒连接/重连/取活动页
└── tools/
├── navigation.js # navigate / go_back / go_forward / reload
├── interaction.js # click / type / fill / press
├── read.js # screenshot / get_text / get_html / evaluate
└── tabs.js # list_tabs / new_tab / switch_tab / close_tab安全提示
CDP 调试端口允许任意本地进程在浏览器里执行 JavaScript、读取 cookie 和敏感数据。不要把端口暴露到公网。
HTTP 服务默认绑定
127.0.0.1(仅本机)。若设HOST=0.0.0.0暴露到局域网,务必了解风险——任何能访问该端口的人都能控制你的 Edge。--remote-allow-origins=*仅用于本机开发。
License
Available Tools
16 toolsclickB
Click an element matching the CSS selector on the active tab.
Inputs: selector (required), delay, button, clickCount.
close_tabA
Close a tab. If no targetId is given, closes the active tab. If the last tab is closed, Edge's behavior depends on the user-data-dir.
Inputs: targetId.
evaluateB
Run a JavaScript expression in the active tab's page context and return the result as JSON. The expression is evaluated as the body of an async function, so you can use await. DOM globals (document, window) are available. Results must be JSON-serializable.
Inputs: expression (required).
fillA
Set the value of an input/textarea/select matching the CSS selector in one shot (no key events). Clears the field first. Faster than type for setting a known value. Sets the value via the DOM and dispatches an input event so frameworks (React, Vue, etc.) pick up the change.
Inputs: text (required), selector (required).
get_htmlA
Return the HTML of an element (outerHTML) or the whole document. Useful for inspecting structure; for visible text use get_text.
Inputs: selector.
get_textA
Return the visible text content of an element (or the whole page if no selector). Whitespace is collapsed; hidden text is excluded.
Inputs: selector.
go_backA
Go back one step in the active tab's history.
Inputs: no named parameters.
go_forwardB
Go forward one step in the active tab's history.
Inputs: no named parameters.
list_tabsA
List all open tabs in Edge with their targetId, URL, and title.
Inputs: no named parameters.
new_tabA
Open a new tab in Edge and optionally navigate it to a URL. Returns the new tab's targetId.
Inputs: url.
pressA
Press a key on the active tab (sent to the currently focused element). Accepts KeyDescriptor names like Enter, Tab, Escape, ArrowDown, or single characters like 'a'.
Inputs: key (required), hold.
reloadC
Reload the active tab.
Inputs: waitUntil.
screenshotB
Capture a screenshot of the active tab (full page or viewport) and return it as an image. The image is returned inline so the model can see it.
Inputs: format, quality, fullPage.
switch_tabA
Bring a tab to the front so it becomes the active tab. All navigation/interaction/read tools operate on the active tab, so call this first to target a specific tab.
Inputs: targetId (required).
typeA
Type text into a focusable element matching the CSS selector, simulating keystrokes (fires key events). Use for typing into inputs or contenteditable regions. For filling a form field in one shot, prefer fill.
Inputs: text (required), selector (required), delay.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool has a clearly distinct purpose: navigation, tab management, interaction, inspection, and evaluation are separated cleanly. The only closely related tools are type, fill, and press, but the descriptions explicitly distinguish simulated typing, one-shot value setting, and key presses.
All names use lower snake_case and are action-oriented, which is highly readable. However, some are single verbs (navigate, click) while others are verb_noun (get_text, list_tabs, switch_tab), so it is not a strict uniform pattern throughout.
Sixteen tools is slightly above the typical well-scoped range but remains reasonable for browser automation, covering navigation, tabs, interaction, reading, and evaluation. Each tool has a plausible role, with little obvious redundancy.
The surface covers the core browser lifecycle: navigate/reload/history, tab management, clicking, typing, screenshots, DOM text/HTML inspection, and JS evaluation. Minor gaps remain around explicit scrolling, waiting for elements/load states, hover/drag, and file upload, though evaluate can work around some of these.
Maintenance
Related MCP Connectors
Unofficial Browserless MCP — wraps the Browserless headless-Chromium REST API (browserless.io)
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Browz hosted MCP (free public beta): let an AI app drive your own Browz browser profiles from anywhere. Connect https://mcp.gobrowz.com/mcp and sign in with your Browz account (OAuth) or an agent token. Each call is relayed to the Browz app on your computer, which must be online with Remote control on and have a hardware security chip (Mac Secure Enclave or TPM 2.0). 17 tools: profiles, tabs, navigate, snapshot, act, wait, screenshot. Cookies, downloads and stored sign-ins stay on your computer.
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to control Chrome/Edge browsers via CDP, including page navigation, element interaction, snapshots, network debugging, script execution, and performance tracing.AGPL 3.0
- AlicenseAqualityCmaintenanceEnables any MCP-capable agent to drive a real Chrome browser through stdio or HTTP, supporting navigation, page reading, interaction, scrolling, JavaScript execution, and replaying saved step-by-step recipes.24Apache 2.0
- 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
- AlicenseBqualityBmaintenanceEnables MCP clients to drive the Chrome or Edge tabs you already have open and signed in, by pairing with a local browser extension instead of launching a remote debugging port or a separate automation browser. Exposes 20 tools for accessibility-tree snapshots, clicking and filling, navigation, uploads, screenshots, JavaScript evaluation, and console and network log reading.24210 npm4MIT