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
Visit Server

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 }

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured