Skip to main content
Glama
Edge DevTools MCP

Edge DevTools MCP

by syunnrai123

Edge DevTools MCP

一个用于与 Microsoft Edge 浏览器 DevTools 协议集成的 MCP (Model Context Protocol) 服务器。

功能特性

  • 🌐 连接和控制 Microsoft Edge 浏览器

  • 🔧 完整的 DevTools 协议支持

  • 📸 页面截图功能

  • 🎯 DOM 操作和查询

  • ⚡ JavaScript 代码执行

  • 🌍 网络请求监控

  • 🔍 页面元素自动化操作

Related MCP server: edge-connect-mcp

安装

npm install edge-devtools-mcp

使用方法

环境变量配置

可以通过以下环境变量配置连接参数:

  • EDGE_DEBUG_PORT: Edge 调试端口(默认:9222)

  • EDGE_DEBUG_HOST: 调试主机(默认:localhost)

  • EDGE_HEADLESS: 是否无头模式(默认:false)

  • EDGE_BROWSER_PATH: Edge 浏览器可执行文件路径

启动 Edge 调试模式

在使用前,需要以调试模式启动 Edge 浏览器:

Windows:

msedge.exe --remote-debugging-port=9222 --user-data-dir="C:\edge-dev-debug"

macOS:

/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge --remote-debugging-port=9222 --user-data-dir="/tmp/edge-dev-debug"

Linux:

microsoft-edge --remote-debugging-port=9222 --user-data-dir="/tmp/edge-dev-debug"

MCP 配置

在 Claude Desktop 的配置文件中添加:

{
  "mcpServers": {
    "edge-devtools": {
      "command": "node",
      "args": ["path/to/edge-devtools-mcp/dist/index.js"]
    }
  }
}

可用工具

浏览器连接

  • edge_connect: 连接到 Edge 浏览器

  • edge_disconnect: 断开连接

  • edge_get_targets: 获取所有可用目标

页面操作

  • edge_navigate: 导航到指定 URL

  • edge_screenshot: 截取页面截图

  • edge_get_page_content: 获取页面 HTML 内容

DOM 操作

  • edge_get_element: 获取元素信息

  • edge_click_element: 点击元素

  • edge_type_text: 在输入框中输入文本

  • edge_wait_for_selector: 等待元素出现

JavaScript 执行

  • edge_evaluate: 执行 JavaScript 表达式

DevTools 协议

  • edge_enable_devtools: 启用 DevTools 会话

  • edge_dom_query: 查询 DOM 节点

  • edge_get_attributes: 获取元素属性

使用示例

基本网页操作

// 连接到浏览器
await edge_connect();

// 导航到网页
await edge_navigate({ url: "https://example.com" });

// 等待页面加载
await edge_wait_for_selector({ selector: "body" });

// 获取页面内容
const { content } = await edge_get_page_content();

// 截取截图
const { screenshot } = await edge_screenshot({ format: "png" });

// 断开连接
await edge_disconnect();

表单填充示例

// 导航到登录页面
await edge_navigate({ url: "https://example.com/login" });

// 等待用户名输入框
await edge_wait_for_selector({ selector: "#username" });

// 填写表单
await edge_type_text({ selector: "#username", text: "myusername" });
await edge_type_text({ selector: "#password", text: "mypassword" });

// 点击登录按钮
await edge_click_element({ selector: "#login-button" });

JavaScript 执行示例

// 执行简单表达式
const { result } = await edge_evaluate({ expression: "document.title" });

// 执行复杂脚本
const { result } = await edge_evaluate({
  expression: `
    const links = Array.from(document.querySelectorAll('a')).map(a => a.href);
    return links.slice(0, 10);
  `
});

DevTools 协议示例

// 获取目标列表
const { targets } = await edge_get_targets();

// 启用 DevTools 会话
const { sessionId } = await edge_enable_devtools({ targetId: targets[0].id });

// 查询 DOM 节点
const { nodeId } = await edge_dom_query({
  sessionId,
  selector: "h1"
});

// 获取节点属性
const { attributes } = await edge_get_attributes({
  sessionId,
  nodeId
});

开发

构建项目

npm run build

开发模式

npm run dev

测试

npm test

代码检查

npm run lint

依赖项

  • @modelcontextprotocol/sdk: MCP SDK

  • puppeteer-core: 浏览器自动化

  • ws: WebSocket 客户端

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

相关链接

Available Tools

14 tools
edge_click_elementC

点击页面元素

Inputs: selector (required).

edge_connectB

连接到Edge浏览器

Inputs: port, headless, browserPath.

edge_disconnectB

断开与Edge浏览器的连接

Inputs: no named parameters.

edge_dom_queryC

查询DOM节点

Inputs: selector (required), sessionId (required).

edge_enable_devtoolsC

启用DevTools会话

Inputs: targetId (required).

edge_evaluateC

在页面中执行JavaScript表达式

Inputs: expression (required), sessionId.

edge_get_attributesC

获取元素属性

Inputs: nodeId (required), sessionId (required).

edge_get_elementC

获取页面元素信息

Inputs: selector (required).

edge_get_page_contentB

获取页面HTML内容

Inputs: no named parameters.

edge_get_targetsC

获取所有可用的DevTools目标

Inputs: no named parameters.

edge_navigateC

导航到指定URL

Inputs: url (required), sessionId.

edge_screenshotC

截取页面截图

Inputs: format, quality, sessionId.

edge_type_textC

在输入框中输入文本

Inputs: text (required), selector (required).

edge_wait_for_selectorC

等待元素出现

Inputs: selector (required), timeout.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 14 tools

    Disambiguation3/5

    Most tools map to a clear action (navigate, click, type, screenshot), but the element-inspection cluster overlaps heavily: edge_get_element, edge_dom_query, and edge_get_attributes all read as ways to fetch element/DOM information, and edge_connect / edge_enable_devtools / edge_get_targets all sit in the session-setup space. Descriptions help somewhat but an agent could easily misselect among the inspection tools.

    Naming Consistency4/5

    All names use a consistent edge_ prefix with snake_case verb_noun structure (edge_click_element, edge_get_page_content, edge_type_text). Minor deviations: edge_screenshot is noun-only with no verb, and edge_wait_for_selector inserts a preposition, but the pattern remains predictable.

    Tool Count4/5

    14 tools is well within a reasonable scope for browser automation and each major capability (connect, navigate, interact, inspect) has representation. A few slots feel redundant, notably edge_enable_devtools alongside edge_connect, and the three overlapping inspection tools.

    Completeness3/5

    Core flows are covered — connection, navigation, JS evaluation, screenshots, click/type, waiting, and DOM inspection. However, key DevTools-domain operations are missing: no keyboard key presses, hover/scroll or select-option handling, and critically no console log or network request retrieval, which are central to a DevTools server's stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables remote agents to control a local Chrome/Edge browser via MCP, supporting navigation, snapshots, clicks, typing, screenshots, and script execution.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients like Codex, Claude Code, and Cursor to connect to Microsoft Edge through automatic browser discovery and the official Chrome DevTools MCP server, preserving cookies, sessions, and extensions.
      11 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables 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
    • A
      license
      A
      quality
      C
      maintenance
      Enables MCP clients to drive a running Microsoft Edge browser over the Chrome DevTools Protocol, exposing 16 tools for navigation, clicking, typing, screenshots, page-content reading, and tab management. Runs in stdio mode for per-client processes or as a shared HTTP endpoint so multiple agents can operate the same browser session.
      16
      MIT