Skip to Content

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 CI

apxy 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_mark sets the mark of that workspace. wait_for_request, list_traffic_logs, and search_traffic_logs read the traffic of that workspace and untagged traffic. For these three tools, "workspace": "all" reads every workspace.
  • Every rule tool takes workspace or global, not both. Without either, a rule goes to the rules file of the server’s workspace, <worktree>/.apxy/rules.json. "global": true uses ~/.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.
ToolArgumentsUse
set_workspace_labellabel*, workspaceSay 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

ToolArgumentsUse
set_markname, workspaceCall it before triggering the code, so earlier attempts never match
wait_for_requestmatch*, expect, since, timeout_seconds, workspaceWait 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_requestid*Send a captured request again. Needs a running proxy.
diff_traffic_logsid_a, id_b, scopeCompare the record from before the fix with the one after
validate_recent_trafficlimitCheck recent traffic against imported OpenAPI schemas. It is an error when none is imported.

Read traffic

ToolArgumentsUse
list_traffic_logslimit, offset, host_filter, method_filter, status_filter, session_id, from_time, to_time, include_bodies, workspaceList records
search_traffic_logsquery*, limit, workspaceFree-text search
get_traffic_logid*, include_bodiesOne record in detail
get_ws_framesrecord_id*, limitWebSocket frames of a record
export_traffic_logid*, formatSnippet as curl, fetch, httpie, or python
get_ai_usagesince, untilLLM tokens and estimated cost
egress_summarysince, allowHosts contacted, checked against an allowlist

Proxy

ToolArgumentsUse
get_proxy_statusIs it running, and what it holds
start_proxyStart 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_proxyStop 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_recordingenabled*Pause or resume capture
list_ssl_domains, enable_ssl_domain, disable_ssl_domaindomain* (enable, disable), workspace, globalChoose which hosts are decrypted

Change traffic

Every tool in this section takes workspace and global.

ToolArgumentsUse
create_mock_rulename, url_pattern, match_type, method, response_status, response_headers, response_body, delay_ms, priority, header_conditions, file_path, dir_pathMock a response
create_redirect_rulefrom_url, to_url, name, match_typeRewrite the URL
create_filter_ruletype, patternBlock or allow hosts
set_dns_overridehost, ipConnect to another IP for a hostname
set_network_condition, clear_network_conditionlatency_ms, bandwidth_kbps, packet_loss_pctSimulate a slow network
list_mock_rules, list_redirect_rules, list_filter_rules, list_dns_overridesList rules
remove_mock_rule, remove_redirect_rule, remove_filter_ruleid*Remove a rule
remove_dns_overridehost*Remove an override

Rules files

ToolArgumentsUse
list_rulesworkspace, globalEvery 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_rulesworkspace, globalValidate 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_rulesworkspace, globalDelete every rule in one rules file. The other file keeps its rules.

Devices

ToolArgumentsUse
list_devicesBooted iOS simulators and running Android emulators
setup_deviceios_simulator, android_emulator, system_storeInstall 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_deviceandroid_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.

ToolArgumentsUse
create_breakpoint_rulename, match_expr, phase, timeout_msPause matching requests or responses
list_pending_breakpointsWhat is paused now
resolve_breakpointid*, status, headers, body, dropContinue, change, or drop it. An unresolved one continues after its timeout.
list_breakpoint_rules, remove_breakpoint_ruleid* (remove)Manage rules

Reference

match and expect use the expressions described in Wait & Verify.

Last updated on