Skip to main content
Glama

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) and WebView (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: MCP JS Debugger

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):

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 | sh

Windows:

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: command

  • Name: miniapp-cdp

  • Command: 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 sync

Then 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_targets

List all available targets in the debugger (AppService thread, WebView thread, etc.)

switch_target

Switch CDP connection to a different target thread for debugging context switching

Network and WebSocket

Tool

Description

list_network_requests

List MiniApp network requests (supports pagination), or get details for a single request

get_request_initiator

Get the JavaScript call stack that initiated the network request

get_response_body

Get the full response body of a network request

get_websocket_messages

List WebSocket connections or get message details for a specific connection

Script Analysis

Tool

Description

list_scripts

List all JavaScript scripts loaded in the current page

get_script_source

Get script source code snippets, supports line ranges or character offsets

save_script_source

Save the full script source code to a local file (suitable for extracting full packages or core risk control code)

search_in_sources

Search for strings or regular expressions across all scripts

Breakpoints and Execution Control

Tool

Description

set_breakpoint_on_text

Automatically set breakpoints by searching code text (do not set breakpoints directly on anonymous function declarations)

break_on_xhr

Set XHR/Fetch breakpoints by URL pattern

remove_breakpoints

Remove specified breakpoints, or clear all breakpoint environments instantly with clear_all=True

list_breakpoints

List all active breakpoints

get_paused_info

Get pause status, call stack, and scope variables

resume_execution

Release breakpoints and resume code execution

step

Step debugging (over/into/out), returns position and source code context

Inspection Tools

Tool

Description

evaluate_script

Execute JavaScript expressions in the current context (supported while paused at a breakpoint)

Usage Examples

Basic MiniApp Reverse Engineering Workflow

  1. Connection and Target Switching

列出所有小程序目标,并切换到 AppService (逻辑层) 线程
  1. Finding Target Functions and Code

在所有脚本中搜索包含 "encrypt" 的代码,并获取相关脚本的上下文源码
  1. Setting Breakpoints

在加密函数的具体执行语句(如 return 处)设置断点
  1. 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

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Enables 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.
    18
    14
    2
    Apache 2.0
  • A
    license
    A
    quality
    A
    maintenance
    Enables 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.
    24
    946
    2,461
    Apache 2.0
  • A
    license
    B
    quality
    C
    maintenance
    Enables AI agents to debug code and automate browsers using Chrome DevTools Protocol, supporting breakpoints, variable inspection, and replayable interaction recording.
    35
    860
    16
    MIT

View all related MCP servers

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,

  • Reasoning, code, anti-deception, memory harness MCP tools. Stdio or HTTPS api.ejentum.com/mcp

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhizhuodemao/miniapp-cdp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server