wmpf-mcp

wmpf-mcp

Connects to WMPFDebugger's CDP WebSocket to enable AI-assisted debugging of Windows WeChat Mini Programs, providing tools for JavaScript evaluation, script inspection, breakpoints, debugger control, and network inspection.

Category
访问服务器

README

wmpf-mcp

wmpf-mcp is a dependency-free MCP stdio server for AI-assisted debugging of Windows WeChat Mini Programs through WMPFDebugger.

It connects to the CDP WebSocket exposed by WMPFDebugger, normally ws://127.0.0.1:62000, and exposes MCP tools for JavaScript evaluation, script inspection, breakpoints, debugger control, and network inspection.

Requirements

  • Windows WeChat and WMPFDebugger running successfully.
  • Node.js >=22 for the built-in WebSocket implementation.
  • A mini program that you own or are authorized to inspect.

Quick Start

node .\src\server.js

Use a different local WebSocket URL with either option:

node .\src\server.js --ws ws://127.0.0.1:62000
$env:WMPF_CDP_WS="ws://127.0.0.1:62000"
node .\src\server.js

MCP Client Config

{
  "mcpServers": {
    "wmpf": {
      "command": "node",
      "args": [
        "C:\\path\\to\\wmpf-mcp\\src\\server.js"
      ],
      "env": {
        "WMPF_CDP_WS": "ws://127.0.0.1:62000"
      }
    }
  }
}

Tools

  • connect: Connect to the WMPFDebugger CDP WebSocket.
  • status: Show connection, cache, pause, and CDP domain status.
  • runtime_evaluate: Evaluate JavaScript through Runtime.evaluate.
  • cdp_call: Call a raw Chrome DevTools Protocol method.
  • list_scripts: List scripts observed from Debugger.scriptParsed.
  • get_script_source: Read source for a CDP scriptId.
  • search_scripts: Search loaded script sources by text or regular expression.
  • set_breakpoint_by_url: Set a breakpoint using a URL regex.
  • debugger_control: Pause, resume, step over, step into, or step out.
  • list_network_requests: List cached requests with sensitive data redacted by default.
  • get_response_body: Read a response body by CDP requestId.
  • last_events: Show recent raw CDP events for compatibility diagnostics.

Example network query:

{
  "limit": 100,
  "include_sensitive": false
}

Set include_sensitive to true only when the debugging task requires original authorization headers, cookies, or request bodies.

Security

  • WebSocket connections are restricted to localhost, 127.0.0.1, and ::1 by default.
  • Set WMPF_ALLOW_REMOTE=1 only when you intentionally need a remote debugger.
  • WebSocket URLs containing embedded credentials are rejected.
  • Authorization headers, cookies, and request bodies are redacted by default.
  • runtime_evaluate and cdp_call can execute code or mutate debugger state.

Configuration

Variable Default Description
WMPF_CDP_WS ws://127.0.0.1:62000 Default debugger WebSocket URL.
WMPF_CDP_TIMEOUT_MS 10000 CDP connection and request timeout.
WMPF_MAX_SCRIPT_CACHE 2000 Maximum cached script metadata entries.
WMPF_MAX_NETWORK_CACHE 1000 Maximum cached network entries.
WMPF_MAX_EVENT_CACHE 200 Maximum recent CDP events.
WMPF_ALLOW_REMOTE unset Set to 1 to allow non-local WebSocket hosts.

Invalid numeric configuration values fall back to their safe defaults.

Development

npm run check
npm test

WMPFDebugger may not implement every CDP method exactly like a full Chrome browser. Use cdp_call and last_events to diagnose protocol compatibility issues.

AI 调试优化

v0.2.0 增加了一组更适合 AI 直接操作的小程序调试工具:

断点 / 单步

  • search_scripts: 在已加载脚本里按文本或正则搜索,可返回上下文。
  • set_breakpoint_on_text: 搜索匹配文本并直接打断点,适合让 AI 用函数名、接口名、关键变量名定位。
  • set_breakpoint_by_script_id: 已知 scriptId 和行号时精确打断点。
  • list_breakpoints / remove_breakpoint: 查看和移除本次 MCP 会话设置的断点。
  • paused_info: 断住后获取命中断点、调用栈和 callFrameId。
  • evaluate_on_callframe: 在暂停栈帧里执行表达式,查看局部变量、参数、this 等。

推荐流程:

{ "query": "functionNameOrApiKeyword", "filter": "appservice", "context_lines": 2 }
{ "query": "functionNameOrApiKeyword", "filter": "appservice", "occurrence": 1 }

断住后:

{ "include_scopes": true }
{ "call_frame_id": "CALL_FRAME_ID", "expression": "JSON.stringify({ arg0, thisKeys: Object.keys(this || {}) })" }

抓包 / HAR

  • network_capture_control: 开始、停止或清空网络抓包缓存。
  • list_network_requests: 按 URL、正则、method、status、type、mime、failed 过滤请求。
  • get_request_detail: 查看单个请求,可同时拉响应体。
  • export_network_har: 导出当前缓存为 HAR-like JSON,方便交给 AI 汇总接口行为。

推荐流程:

{ "action": "start", "clear": true, "disable_cache": true }

复现小程序操作后:

{ "url_filter": "/api/", "limit": 100, "include_sensitive": false }

再查看单条响应:

{ "request_id": "REQUEST_ID", "include_body": true, "include_sensitive": false }

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选