MCP Tools
The APXY MCP server gives an AI agent 45 tools and the apxy skill. The tools share traffic, rules, and marks with the CLI. To connect a client, run apxy setup mcp. See Installation.
The apxy skill
The skill tells the agent when to reach for APXY and how to prove a change with apxy run, apxy wait, and these tools. apxy mcp serves it over MCP, so it always matches your apxy version.
Claude Code 2.1.331 or later loads it as apxy:apxy as soon as you add the APXY MCP server. There is nothing else to install.
Agents that don’t load skills over MCP need it as files. That covers Codex, Cursor, claude -p, and CI. Run apxy setup skills:
apxy setup skills # preview what it would write
apxy setup skills --client codex --write # ~/.agents/skills/apxy, read by Codex and Cursor
apxy setup skills --client claude-code --write # ~/.claude/skills/apxy, for claude -p and CIapxy setup mcp --client codex --write installs the skill files too. Installed copies update themselves when apxy’s version changes, after brew upgrade, install.sh, or apxy upgrade. apxy setup skills --refresh rewrites them on demand. A skill directory without APXY’s .apxy-installed marker is never overwritten, since it may hold your own edits.
If the skill is already installed as files, run the server as apxy mcp --no-skills to serve the tools only.
Workspaces
The MCP server runs in the workspace of the directory it started in, usually the main checkout. A subagent in another git worktree passes its own workspace in the workspace argument: the absolute path of its worktree, its workspace ID, or its name. Or it runs the CLI from inside its worktree. See Workspaces.
set_marksets the mark of that workspace.wait_for_request,list_traffic_logs, andsearch_traffic_logsread the traffic of that workspace and untagged traffic. For these three tools,"workspace": "all"reads every workspace.- Every rule tool takes
workspaceorglobal, not both. Without either, a rule goes to the rules file of the server’s workspace,<worktree>/.apxy/rules.json."global": trueuses~/.apxy/rules.json, which applies to untagged traffic and to every workspace after its own rules. - A workspace given by ID or name must have run an apxy command from its worktree before.
| Tool | Arguments | Use |
|---|---|---|
set_workspace_label | label*, workspace | Say what this workspace is doing, such as Fix checkout retries, for people watching the web UI. One line of at most 80 characters; an empty label clears it. The web UI shows the label, else the git branch, else the name. |
* marks a required argument. Traffic in the results is masked. See AI Data Redaction.
Prove a change works
| Tool | Arguments | Use |
|---|---|---|
set_mark | name, workspace | Call it before triggering the code, so earlier attempts never match |
wait_for_request | match*, expect, since, timeout_seconds, workspace | Wait for a request and check it, streams included. Read outcome, expectations, and stream. When a mock answered, mocked_by names its id, name, and source, and warning starts with passed on a mocked response. |
replay_request | id* | Send a captured request again. Needs a running proxy. |
diff_traffic_logs | id_a, id_b, scope | Compare the record from before the fix with the one after |
validate_recent_traffic | limit | Check recent traffic against imported OpenAPI schemas. It is an error when none is imported. |
Read traffic
| Tool | Arguments | Use |
|---|---|---|
list_traffic_logs | limit, offset, host_filter, method_filter, status_filter, session_id, from_time, to_time, include_bodies, workspace | List records |
search_traffic_logs | query*, limit, workspace | Free-text search |
get_traffic_log | id*, include_bodies | One record in detail |
get_ws_frames | record_id*, limit | WebSocket frames of a record |
export_traffic_log | id*, format | Snippet as curl, fetch, httpie, or python |
get_ai_usage | since, until | LLM tokens and estimated cost |
egress_summary | since, allow | Hosts contacted, checked against an allowlist |
Proxy
| Tool | Arguments | Use |
|---|---|---|
get_proxy_status | Is it running, and what it holds | |
start_proxy | Start a proxy for this workspace on 127.0.0.1, or report the running one. It never turns on the system proxy or changes the trust store. The proxy stops after the MCP session ends, unless an apxy run or apxy browser still uses it. The result has owner and, on the Free plan, session_ends_at. | |
stop_proxy | Stop the proxy only if this workspace started it and no other workspace’s apxy run, apxy browser, or MCP session still uses it. Otherwise it fails with stop_refused and says who started the proxy. | |
set_recording | enabled* | Pause or resume capture |
list_ssl_domains, enable_ssl_domain, disable_ssl_domain | domain* (enable, disable), workspace, global | Choose which hosts are decrypted |
Change traffic
Every tool in this section takes workspace and global.
| Tool | Arguments | Use |
|---|---|---|
create_mock_rule | name, url_pattern, match_type, method, response_status, response_headers, response_body, delay_ms, priority, header_conditions, file_path, dir_path | Mock a response |
create_redirect_rule | from_url, to_url, name, match_type | Rewrite the URL |
create_filter_rule | type, pattern | Block or allow hosts |
set_dns_override | host, ip | Connect to another IP for a hostname |
set_network_condition, clear_network_condition | latency_ms, bandwidth_kbps, packet_loss_pct | Simulate a slow network |
list_mock_rules, list_redirect_rules, list_filter_rules, list_dns_overrides | List rules | |
remove_mock_rule, remove_redirect_rule, remove_filter_rule | id* | Remove a rule |
remove_dns_override | host* | Remove an override |
Rules files
| Tool | Arguments | Use |
|---|---|---|
list_rules | workspace, global | Every rule that applies to the workspace, of every kind: its own rules first, then the global rules. Each file says whether the running proxy applies it, or carries its error. |
apply_rules | workspace, global | Validate the rules file and push it to the proxy now, after an edit by hand or a git checkout. An invalid file is an error with the line and column or the rule, and nothing is pushed. |
clear_rules | workspace, global | Delete every rule in one rules file. The other file keeps its rules. |
Devices
| Tool | Arguments | Use |
|---|---|---|
list_devices | Booted iOS simulators and running Android emulators | |
setup_device | ios_simulator, android_emulator, system_store | Install the APXY CA. iOS simulator traffic is untagged, so mocks for it need global: true. For an Android emulator, also point its HTTP proxy at the host: with a proxy running, at this workspace’s port, which tags the traffic and stays open for 8 hours (call again to hold it longer); with none, at the plain port, untagged (untagged_because says why; call again after start_proxy). |
teardown_device | android_emulator* | Clear the HTTP proxy that setup_device set on an Android emulator and release its workspace port |
Breakpoints
create_breakpoint_rule, remove_breakpoint_rule, and list_breakpoint_rules take workspace and global.
| Tool | Arguments | Use |
|---|---|---|
create_breakpoint_rule | name, match_expr, phase, timeout_ms | Pause matching requests or responses |
list_pending_breakpoints | What is paused now | |
resolve_breakpoint | id*, status, headers, body, drop | Continue, change, or drop it. An unresolved one continues after its timeout. |
list_breakpoint_rules, remove_breakpoint_rule | id* (remove) | Manage rules |
Reference
match and expect use the expressions described in Wait & Verify.