MiniApp CDP MCP
The MiniApp CDP MCP server enables AI coding assistants to debug and reverse-engineer WeChat Mini Programs via the Chrome DevTools Protocol (CDP).
Target Management: List and switch between debugging targets (AppService logic layer / WebView rendering layer).
Network Monitoring: List, filter, and paginate XHR/Fetch requests; retrieve full response bodies and the JavaScript call stack that initiated each request.
WebSocket Analysis: Monitor WebSocket connections and inspect messages with pagination and direction filtering.
Script Management: List all loaded scripts, retrieve source code by URL/script ID (with line range or character offset support), and save full sources to local files.
Code Search: Search for strings or regex patterns across all loaded JavaScript sources, with options for case sensitivity, minified file exclusion, and result limits.
Breakpoint Debugging: Set breakpoints by text search or XHR/Fetch URL pattern, list all active breakpoints, and remove specific or all breakpoints.
Execution Control: Pause/resume execution and step through code (over/into/out).
Runtime Inspection: Evaluate JavaScript expressions in the current or paused context, inspect call stacks, and examine scope variables at breakpoints.
Provides debugging and analysis tools for WeChat Mini Programs, enabling AI assistants to inspect JavaScript code, intercept network requests, set breakpoints, and analyze runtime behavior through Chrome DevTools Protocol.
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., "@MiniApp CDP MCP list all network requests from the last 5 minutes and show me the ones with encrypted parameters"
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.
MiniApp CDP MCP
English | Chinese
WeChat MiniApp reverse engineering MCP server, allowing your AI coding assistant (such as Claude, Cursor, Antigravity) to directly debug and analyze JavaScript code in WeChat MiniApps (including WeChat DevTools or PC WeChat MiniApps) via the Chrome DevTools Protocol (CDP).
Features
Multi-target Debugging: Seamlessly switch between
AppService(logic layer) andWebView(rendering layer) targets.Network Interception: Capture, monitor, and filter XHR/Fetch requests initiated by the MiniApp.
Breakpoint Debugging: Set/remove code breakpoints and XHR breakpoints, with support for precise positioning in minified/obfuscated code.
Execution Control: Pause/resume execution, step debugging (over/into/out), and return source code context.
Script Analysis: List all loaded JS scripts, search code, and retrieve/save source code.
Runtime Inspection: Evaluate expressions at breakpoints, and inspect call stacks and scope variables.
WebSocket Analysis: Monitor WebSocket connections and message patterns.
Related MCP server: JS Reverse MCP
System Requirements
Python 3.11 or newer
uv (Required, ultra-fast Python package and environment manager)
Running WeChat DevTools (with debug port enabled) or PC WeChat MiniApp (with remote debugging mechanism enabled)
Prerequisite 1: Enable MiniApp Debug Port
Before using this MCP, you need to expose the WeChat MiniApp's CDP debug port using an injection tool. Depending on your OS and WeChat version, you can choose one of the following open-source tools to perform the Hook and port exposure (usually exposed on port 62000):
WMPFDebugger-arm (For macOS ARM architecture)
Prerequisite 2: Install uv
This project achieves zero-configuration "out-of-the-box" usage via uvx. If you haven't installed uv yet, please execute the following command based on your system:
macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Quick Start (uvx zero-install)
No need to clone the code locally; you can directly leverage uv's capabilities by adding the following to your AI assistant's MCP configuration file:
{
"mcpServers": {
"miniapp-cdp": {
"command": "uvx",
"args": ["--from", "miniapp-cdp", "miniapp-cdp-mcp"]
}
}
}Claude Desktop
Modify ~/Library/Application Support/Claude/claude_desktop_config.json and add the configuration above.
Cursor
Go to Cursor Settings -> Features -> MCP -> Add new MCP server:
Type:
commandName:
miniapp-cdpCommand:
uvx --from miniapp-cdp miniapp-cdp-mcp
Local Installation (Optional)
If you want to modify or develop locally:
git clone https://github.com/yourusername/miniapp-cdp-py.git
cd miniapp-cdp-py
uv syncThen use the local execution method in your MCP configuration:
{
"mcpServers": {
"miniapp-cdp": {
"command": "uv",
"args": ["run", "run_mcp_server.py"],
"cwd": "/你的路径/miniapp-cdp-py"
}
}
}Tool List
Target and Context Management
Tool | Description |
| List all available targets in the debugger (AppService thread, WebView thread, etc.) |
| Switch CDP connection to a different target thread for debugging context switching |
Network and WebSocket
Tool | Description |
| List MiniApp network requests (supports pagination), or get details for a single request |
| Get the JavaScript call stack that initiated the network request |
| Get the full response body of a network request |
| List WebSocket connections or get message details for a specific connection |
Script Analysis
Tool | Description |
| List all JavaScript scripts loaded in the current page |
| Get script source code snippets, supports line ranges or character offsets |
| Save the full script source code to a local file (suitable for extracting full packages or core risk control code) |
| Search for strings or regular expressions across all scripts |
Breakpoints and Execution Control
Tool | Description |
| Automatically set breakpoints by searching code text (do not set breakpoints directly on anonymous function declarations) |
| Set XHR/Fetch breakpoints by URL pattern |
| Remove specified breakpoints, or clear all breakpoint environments instantly with |
| List all active breakpoints |
| Get pause status, call stack, and scope variables |
| Release breakpoints and resume code execution |
| Step debugging (over/into/out), returns position and source code context |
Inspection Tools
Tool | Description |
| Execute JavaScript expressions in the current context (supported while paused at a breakpoint) |
Usage Examples
Basic MiniApp Reverse Engineering Workflow
Connection and Target Switching
列出所有小程序目标,并切换到 AppService (逻辑层) 线程Finding Target Functions and Code
在所有脚本中搜索包含 "encrypt" 的代码,并获取相关脚本的上下文源码Setting Breakpoints
在加密函数的具体执行语句(如 return 处)设置断点Triggering and Analysis
在小程序上点击触发网络请求,断点命中后,检查参数、调用栈以及密钥的生成逻辑Intercepting and Analyzing Network Requests
抓取最新发出的网络请求列表,并找出特定的加密请求(如带有 mina_edata 参数的请求),
随后获取该请求的发起者调用栈 (Initiator) 定位加密入口。Practical Cases
The examples/ directory in the project contains some practical scripts derived from reverse engineering using this tool (e.g., vipshop_decrypt_demo.py), demonstrating how to analyze complex multi-layer encryption algorithms of MiniApps via MCP and perfectly restore them in Python.
Security Notice
This tool exposes the underlying runtime context of the MiniApp to the MCP client, allowing for the inspection, debugging, and modification of any data in the application's memory. Do not use this tool for illegal purposes; it is intended solely for personal learning, security research, and legally authorized reverse engineering analysis.
Acknowledgments
This project is built on cdp-use. cdp-use provides a low-level WebSocket interaction layer that is highly optimized and abstracted for Agent scenarios, greatly simplifying the communication complexity of the raw CDP protocol.
License
MIT License
Available Tools
19 toolsbreak_on_xhrA
Sets a breakpoint that triggers when an XHR/Fetch request URL contains the specified string.
Inputs: url (required). Returns: result
evaluate_scriptC
Evaluates a JavaScript expression in the current context. If execution is paused, it automatically evaluates in the paused call frame context.
Inputs: expression (required), return_by_value, await_promise, context_id, +1 more. Returns: result
get_paused_infoA
Gets information about the current paused state including call stack, current location, and scope variables. Use this after a breakpoint is hit to understand the execution context.
Inputs: include_scopes, max_scope_depth, frame_index. Returns: result
get_request_initiatorB
Gets the JavaScript call stack that initiated a network request. This helps trace which code triggered an API call.
Inputs: request_id (required). Returns: result
get_response_bodyA
Get the response body for a request returned by list_network_requests. If session_id is omitted, it is inferred from the monitored request cache.
Inputs: request_id (required), session_id. Returns: result
get_script_sourceB
Gets a snippet of a JavaScript script source by URL (recommended) or script ID. Supports line range (for normal files) or character offset (for minified single-line files).
Inputs: script_id, url, start_line, end_line, +2 more. Returns: result
get_websocket_messagesB
Lists WebSocket connections or gets messages for a specific connection. Without wsid, lists all connections. With wsid, gets messages.
Inputs: wsid, direction, show_content, page_size, +1 more. Returns: result
list_breakpointsB
Lists all active XHR and code breakpoints.
Inputs: no named parameters. Returns: result
list_network_requestsA
List network requests for the currently selected miniapp target/session since MCP started monitoring it. Results are sorted newest-first. By default returns the 20 most recent requests; use page_size/page_idx to paginate. Pass reqid to get a single request's full details. On first call it automatically connects to the endpoint, infers the target, attaches only that target, enables Network on that target session, and starts collecting XHR/Fetch requests.
Inputs: endpoint, reqid, page_size, page_idx, +5 more. Returns: result
list_scriptsA
Lists all JavaScript scripts loaded in the current page. Returns script ID, URL, and source map information. Use this to find scripts before setting breakpoints or searching.
Inputs: url_filter. Returns: result
list_targetsB
Lists all available targets (WebView threads, AppService threads, etc.) in the connected debugger.
Inputs: no named parameters. Returns: result
pause_or_resumeB
Toggles JavaScript execution. If paused, resumes execution. If running, pauses execution.
Inputs: no named parameters. Returns: result
remove_breakpointB
Removes a breakpoint by its ID.
Inputs: breakpoint_id (required). Returns: result
remove_xhr_breakpointC
Removes an XHR/Fetch breakpoint.
Inputs: url (required). Returns: result
save_script_sourceC
Saves the full source code of a JavaScript script to a local file.
Inputs: file_path (required), script_id, url. Returns: result
search_in_sourcesB
Searches for a string or regex pattern in all loaded JavaScript sources. Returns matching lines with script ID, URL, and line number.
Inputs: query (required), case_sensitive, is_regex, max_results, +3 more. Returns: result
set_breakpoint_on_textA
Finds a text string in all loaded scripts and sets a breakpoint at that location. CRITICAL AI WORKFLOW WARNING: Do NOT set breakpoints on function names or assignment statements (e.g., 'funcName = function'). In minified code, this will break on the one-time assignment rather than the execution. Instead, ALWAYS use get_script_source to read the function body first, then set the breakpoint on a specific statement INSIDE the function body (e.g., 'var x=', 'return').
Inputs: text (required), case_sensitive, condition. Returns: result
stepB
Controls execution when paused. action must be one of: 'over', 'into', 'out'.
Inputs: action (required). Returns: result
switch_targetB
Switches the CDP connection to a different target thread (e.g. from WebView to AppService) to debug different parts of the miniapp.
Inputs: target_id (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools have distinct purposes with clear boundaries, such as break_on_xhr for XHR breakpoints versus set_breakpoint_on_text for code breakpoints. However, some overlap exists between list_breakpoints and remove_breakpoint/remove_xhr_breakpoint, as they all manage breakpoints but with different granularities, which could cause minor confusion in selection.
Tool names follow a highly consistent verb_noun or verb_noun_noun pattern throughout, such as list_network_requests, get_paused_info, and remove_xhr_breakpoint. There are no deviations in style or convention, making the set predictable and easy to navigate.
With 19 tools, the count is slightly high but reasonable for a comprehensive debugging and monitoring server for miniapps. It covers various aspects like breakpoints, network requests, and script analysis without feeling excessively bloated, though it might be borderline for some use cases.
The toolset provides complete coverage for debugging miniapps, including breakpoint management, network monitoring, script inspection, and execution control. There are no obvious gaps; tools like step, pause_or_resume, and switch_target ensure full lifecycle support for debugging workflows.
Maintenance
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Cloud browser, web extraction, screenshots, and remote CDP tools for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to debug JavaScript and TypeScript applications by connecting to Chrome DevTools Protocol-compatible debuggers, allowing them to set breakpoints, step through code, inspect variables, and evaluate expressions with full source map support.1810 npm2Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI coding assistants to debug and analyze JavaScript code in web pages through breakpoint debugging, function hooking, network analysis, and runtime inspection of scripts including minified code.241,064 npm3,072Apache 2.0
- AlicenseBqualityDmaintenanceConnects 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.211MIT
- AlicenseNot gradedqualityCmaintenanceEnables dynamic reverse engineering and debugging of WeChat MiniProgram JavaScript through the Chrome DevTools Protocol, letting AI agents enumerate and search scripts, set breakpoints, step through paused frames, trace function calls, hook miniprogram APIs such as wx.request, and capture network requests to analyze encryption, signing, and anti-scraping logic. It also works against Chrome, Node.js, and Electron runtimes, with tools for extracting code bundles and page business logic.31 npm1MIT