EN
v2.5
WPE_TUTORIAL_V2 // 08_MCP

Local AI Automation

Tutorial Rev · MCP

Since 2.3, WPE can hand its existing features to an AI client on the same machine that speaks MCP: read packets, look at logs, write filters, create accounts, run senders and robots — all by conversation. This chapter covers the connection path, client setup, practical workflows, and WPE's switches and audit trail.

Quick start // four steps to hand WPE to an AI

MCP is a local channel: the AI client and the server both run on this computer, and neither starts the other.

  1. Start WPE first. The connector never starts WPE, the proxy, injection or Remote Management — it only talks to a WPE that is already running.
  2. Home screen → MCP Settings: make sure Enable MCP service is on (it is by default), then decide about MCP operations need confirmation.
  3. Check the MCP status lamp at the right-hand end of the status bar: as long as it is not grey, the service is up.
  4. Add a stdio server to your AI client's MCP configuration pointing at C:\WPE64DB\McpServer\WPEMcpServer.exe, then connect once.

01 · What this is

MCP (Model Context Protocol) is a common interface between AI clients and programs on the same machine. WPE 2.3 implements the server side: it wraps its own features into named "tools" that a connected AI client can call — so instead of clicking through menus you can say "change the third byte of that packet to 0x10 and send it again".

  • It is local: the service runs alongside WPE on this computer and serves the current Windows user only. No internet, no account.
  • WPE has to be running: the connector presses WPE's buttons for you; it never starts anything. Close WPE and the AI client reports the service offline.
  • WPE is the only source of truth: every read and write goes through WPE's own entry points — the AI client never edits your configuration files or database behind its back.
  • Who uses it: you. Whoever runs WPE can drive it over MCP, so this has to be your own, trusted machine.
// The connection path

Your AI client starts the fixed-path WPEMcpServer.exe and exchanges MCP messages over its stdio input and output. That small program then talks to the running WPE through a local named pipe for the current user. There is no TCP listening port, cloud relay, or extra .NET runtime to install. When WPE exits the connector loses its local target; after WPE is open again, reconnect the client.

02 · MCP Settings

The entry is the second narrow row on the home screen (the one labelled MCP), with the number of available tools on the right. It opens a sectioned dialog like every other setting: two switches and one list.

SwitchDefaultWhat it does
Enable MCP serviceOnOnce off, an AI client on this machine can neither discover nor reach WPE's MCP service, and any session already connected ends with it
MCP operations need confirmationOffOn: every call that would change WPE asks for confirmation inside WPE first and only runs once you approve it. Off: such calls execute straight away. The switch only decides whether you are asked — every call is written to the MCP log either way

The MCP tool list below shows every tool actually registered, grouped as proxy / inject / packet / proxy accounts / filter / send / robot / warehouse / decoders / extractors / settings / other, each with its name and a one-line description — this list matches what the AI client sees one for one. Write tools are marked according to the confirmation switch above. This tutorial also carries the list on the web — see Chapter 9 · MCP Tool Reference.

// Turning the master switch off keeps MCP Settings reachable

The MCP Settings entry stays on the home screen when the master switch is off (otherwise there would be no way back in), so you can come back and enable it again at any time.

03 · State and logs

  • The MCP status lamp (right-hand end of the status bar, right after the proxy state): grey = MCP service off; amber = running, writes need your confirmation; green = running, writes can execute automatically. One lamp tells you which state you are in
  • The MCP log (Proxy / Inject Mode → System Log, the fourth tab — see Tools, section 07): every tool call, the write-audit verdict and any error. The module column carries the tool name, so this is the page to read when you want to know what the AI actually touched

04 · Connecting an AI client

The WPE release ships a self-contained connector, WPEMcpServer.exe (no extra runtime needed). The launcher syncs it to a fixed path on every start:

C:\WPE64DB\McpServer\WPEMcpServer.exe

  1. Add a stdio server to your AI client's MCP configuration with that path as the command (if the client wants a full command line, this exe on its own, with no arguments).
  2. Keep WPE running and let the client connect once: it discovers the WPE instance running under the current user and pulls the tool list.
  3. Close WPE and the client reports the service offline; connect again next time WPE is up. Nothing in the configuration changes.
// The path is fixed, so upgrades need no config change

The connector does not live in the per-version folder that changes on every start; it is synced to a fixed path, so upgrading WPE does not touch the AI client's configuration.

Using VS Code

VS Code puts MCP inside GitHub Copilot Chat — MCP servers are used through Copilot's agent mode, so install the Copilot extension and sign in first (with Copilot unavailable, the server in your configuration will not start), then connect WPE in three steps.

  1. Open the configuration file: run MCP: Open User Configuration from the Command Palette (Ctrl+Shift+P) — that is the user-level file, configured once and available in every workspace; to scope it to one project, open that project's .vscode/mcp.json. You can also run MCP: Add Server and pick Workspace or Global, which writes the block below for you.
  2. Paste this in. Note that backslashes in a Windows path must be doubled; the file has completion and validation, so a misspelled key is flagged as you type:
    mcp.json
    { "servers": { "wpe": { "type": "stdio", "command": "C:\\WPE64DB\\McpServer\\WPEMcpServer.exe" } }}
  3. Start it and trust it: once saved, a Start link appears in the file — click it. The first start asks you to confirm that you trust the server; once confirmed, VS Code discovers the tools and exposes them in chat. If the tool list goes stale (after a WPE upgrade, say), run MCP: Reset Cached Tools.

Then open the Chat view (Ctrl+Alt+I), switch to agent mode and just ask in plain language — "read me the current packet list", for instance. The Configure Tools button next to the chat input lists every WPE tool and lets you enable or disable them one by one.

In VS CodeWhat to do
The server is missing, or its tools never show up in chatCheck in order: WPE is running · the master switch in MCP Settings is on · the server has been started · you confirmed the trust prompt (a server you have not trusted is never started)
You want to be asked againCommand Palette → MCP: Reset Trust; the next start asks once more
A call fails and you want the server's own errorCommand Palette → MCP: List Servers, pick the wpe entry → Show Output

Using Trae

Trae can use WPE through an MCP configuration in your project too. Keep WPE running first; create a .vscode folder at the project root, then add mcp.json with the following content. Backslashes in a Windows path must be doubled:

.vscode/mcp.json
{ "mcpServers": { "wpe": { "command": "C:\\WPE64DB\\McpServer\\WPEMcpServer.exe" } }}

Save the file, then start or refresh the wpe service in Trae's AI / MCP management view and ask directly — for example, “show the current capture state” or “list the latest 20 packets but do not modify anything”. WPE's connector already exposes MCP over stdio, so do not add --mcp, --pipe, or --mcp-full arguments found in examples for other products; it automatically discovers the WPE running for the current Windows user.

Using Claude Code

Claude Code can use WPE as a local stdio MCP server too. Keep WPE running, then execute this command in a terminal; the quoted path prevents the shell from splitting a path containing spaces or special characters:

PowerShell
claude mcp add wpe -- "C:\WPE64DB\McpServer\WPEMcpServer.exe"

Run claude mcp list afterwards to check that wpe appears, then ask Claude Code directly. If it offers a project-level or user-level scope, choose project-level for one project only or user-level for all your projects. The path survives WPE upgrades; if the tool count or descriptions still look old, reconnect the service so the client refreshes its tool list.

05 · What it can do

Tools come in read-only and write flavours. Read tools let the AI look; write tools let it change things — the latter are governed by "MCP operations need confirmation".

KindGroupWhat it does
ReadPackets and connectionsList packets, read one packet's full bytes (both the current and the original payload), filter by condition, inspect connections and statistics
State and logsRead the proxy and inject runtime state, the account list, all four logs, the WPC servers and notices, and the current settings
WriteRules and dataFilters (add / edit / enable / reorder), proxy accounts (including batch and import), warehouses, auto-store, WPC servers
AutomationSend lists and robots (create / edit / start / stop), plus an emergency stop that halts running senders and robot executors. It only stops; it never starts a task
Capture and editEditing and replaying a single packet; triggering an existing injection flow (choosing the target still works exactly as it does in the UI)
Network and controlProxy settings, mihomo Process Settings, the firewall lists, Map Local and Map Remote, and backup export / import
  • One extra thing on the start page: while you are still on the home screen and have not entered a mode, the AI can pick Proxy or Inject Mode for you. That is only a choice between the two modes — it starts no listener and injects nothing — and the ability disappears once you leave the home screen (picking the mode you are already in just reports that nothing needs doing)
  • Two things are not offered: arbitrary file and clipboard access, and injection that runs without confirmation

06 · A steadier way to work with AI

MCP works especially well when one conversation follows “inspect → propose → apply → verify”. Tell the AI both your goal and your boundaries, then let the tools follow that order instead of turning a guess straight into a write.

GoalTry sayingRecommended order
Find a conversation“Read the newest 20 packets and group them by destination and length; do not modify or send anything.”Read state → list packets → get full bytes only for the selected packet
Make a filter“From this packet, draft a filter that matches but does not change data; create it only after I confirm.”Read packet → explain match → create / enable → read back to verify
Tidy automation“List send tasks and robots, identify disabled or duplicate entries, and report first; do not delete anything.”List → report differences → write with your approval → list again
Diagnose a proxy issue“Read proxy state and the newest 50 proxy and system log lines; explain the likely failure without changing settings.”Read runtime state → read logs → explain; change settings only with approval
// A useful habit: read, write, verify

For filters, accounts, maps, send tasks and robots — anything that changes state — first have the AI identify the exact name or ID and describe its intended change. Approve the write, then have it read the result again. It catches the wrong target early and leaves a complete, traceable MCP log.

07 · Using it, and troubleshooting

MCP hands WPE's controls to an AI, so keep these in mind:

  • Only enable it on your own computer: the service and its discovery record are visible to the current Windows user only, so other users on the same machine cannot see them. Turning the master switch off when you are done is the simplest habit
  • When in doubt, keep confirmation on: with it on, every write asks inside WPE — the decision to execute stays with you
  • Read tools return complete data: packet contents and account passwords are handed to the client as they are. Connect only clients you trust
SymptomWhat to check first
The client cannot connect, or reports WPE offline① Is WPE running? ② Is the master switch still on in MCP Settings on the home screen? ③ Is the MCP status lamp on the status bar grey?
The tools are listed but every call failsRead the MCP log tab: it carries the tool name and the reason it failed. Some tools only work under certain conditions — "pick a mode" needs you to still be on the home screen, and the send / robot tools need a target process attached
The AI says it changed something and the UI does not show itList-type changes apply immediately; settings that concern a running service (listening ports, the system proxy) still follow the old rule — stop the service before changing them
You want it to stop writingTurn on "MCP operations need confirmation", or switch the master switch off (an already-connected session ends with it)