Skip to content
subcloakdocs

Automation and AI

MCP server for AI assistants

Connect Claude Code, Claude Desktop, Cursor or VS Code to Cloak Proxy over MCP to read traffic, set up mocks and breakpoints, and run API tests.

Cloak Proxy is a Model Context Protocol (MCP) server. Connect it to an AI assistant such as Claude Code, Claude Desktop, Cursor or VS Code, and the assistant can do what you do in the app: read, search, trace, replay and repeat captured requests, turn them into replayable flows, map where an app sends its users’ data, turn on capture and SSL proxying, mute noisy apps, create Map Local mocks, Rewrite rules and breakpoints, answer paused requests, read Insights, test authorization by replaying requests as other users, check traffic against an OpenAPI spec, compare two builds’ traffic, turn traffic into tests, read streamed responses event by event, see the tokens and cost of model calls, follow distributed traces, set up capture step by step, and use the whole API client. It offers 154 tools, 7 resources and 6 prompts, and runs entirely on your Mac.

The server is cloakctl mcp. Your assistant starts it as a local process and talks to it over standard input and output. It does nothing until the assistant calls a tool.

Kind of tool Where it runs Needs the app open
Captured traffic: list_requests, get_request, get_request_curl, replay_request The proxy’s control API The app, or cloakctl run
Everything else in the proxy: capture, SSL proxying, settings, debugging tools, breakpoints, Insights, windows The running app, through POST /api/rpc Yes
API client: collections, requests, environments, runs, mocks, specs, flows, Git and more The workspace folder, read and written directly No

Changes an assistant makes show up in the app’s windows right away, and changes to the workspace are picked up by the app if it’s open.

The Cloak Proxy app for iPhone and iPad serves the same tools over the network instead, over HTTPS with a token. See Let AI assistants control your iPhone or iPad.

You need Cloak Proxy installed in /Applications. Copy the commands from the app so the path is right for your Mac: open Settings › Advanced and look under AI assistants (MCP), or open the API client with ⇧ ⌘ M (File › MCP…) and use the Use Cloak Proxy from AI assistants card.

Since 0.5.1 Settings › AI Assistants has the same commands, and the assistant scope: limit what assistants see to one app, some hosts, a view or the requests you highlight.

The MCP page in the API client has copyable setup for each assistant and lists every tool.

  1. Use Cloak Proxy from AI assistants
  2. Copies the Claude Code command
  3. Copies the JSON for Claude Desktop, Cursor and VS Code
  4. Every tool, grouped by area
The MCP page of the API client: a Connect to an MCP server card, and a Use Cloak Proxy from AI assistants card with Copy buttons for Claude Code and for Claude Desktop, Cursor and VS Code JSON, followed by the tool list grouped by area

Run this in Terminal:

Terminal
claude mcp add cloak-proxy -- "/Applications/Cloak Proxy.app/Contents/Resources/cloakctl" mcp

Then start claude and ask about your traffic. Run claude mcp list to check that cloak-proxy is connected.

Add these after mcp in the command or args:

Option Use it when
--port N The proxy listens on a port other than the one in the app’s settings, for example a cloakctl run --port 9091.
--workspace DIR The assistant should use a different API-client workspace folder than the app’s, for example the one in your project’s repository.
--no-redact Since 0.4.0 Tool results should include credentials as captured, whatever the app’s setting. For CI jobs reading their own test traffic; see Redact sensitive data before sending to AI.
--app NAME Since 0.5.1 This connection should only see one app’s requests (repeat it for several). It narrows the assistant scope set in the app; it can’t widen it.
--host HOST Since 0.5.1 Only one host’s, or *.example.com’s.
--scope QUERY Since 0.5.1 Only requests matching a typed query.
--metadata-only Since 0.5.1 Only metadata (method, URL, status, timing, sizes, headers), never bodies.
Terminal
claude mcp add cloak-proxy -- "/Applications/Cloak Proxy.app/Contents/Resources/cloakctl" mcp --workspace ~/code/shop-api/api-workspace
Since 0.4.0

Install Cloak Proxy’s agent skills so Claude Code, Codex and other agents know when to use these tools and in which order: Agent skills on the MCP page, or cloakctl skills install claude.

Press ⇧ ⌘ A and type mcp. MCP opens the API client’s MCP page, and AI Assistants (MCP) opens Settings › Advanced. Since 0.5.1 AI Assistants opens the settings page with the assistant scope.

Search Everything finds both places to set up the MCP server.

  1. Opens the MCP page in the API client
  2. Opens Settings › Advanced
Search Everything with the query mcp: MCP in the API Client as the top hit, AI Assistants (MCP) under Settings › Advanced, and New MCP Request entries

The tools cover the whole app. Every one is listed with its arguments in the MCP tools reference.

Area Examples of what you can ask
Captured traffic “Why did the last checkout request fail?” “Compare request 41 with 52.” “Replay request 12 with a different Authorization header.” “Send request 12 twenty times, five at once, and summarize the statuses.” “Generate TypeScript types from the response of request 30.” “Which requests contain fc68188e?” “Where did this order ID come from, and which calls use it?” “Make a replayable flow from requests 40 to 44.” “Which third parties receive ShopApp’s users’ data?”
Capture control “Start capturing macOS traffic and decrypt *.example.com.” “Pause recording.” “Stop recording Mail’s traffic.”
Debugging tools “Mock GET /v1/users to return an empty list.” “Add a 2-second delay to api.example.com.” “Block analytics hosts.” “Turn on the Payment declined rule set.” “Add an X-Debug: 1 header to every request to staging.example.com, only from Safari.”
Queries and highlights Since 0.4.1 “Show me ShopApp’s server errors slower than a second.” “Add an Order column with each response’s $.order.id.” “Color every request to the payments host red.”
Sharing and the browser Since 0.4.1 “Share ShopApp’s traffic with a colleague for an hour, without bodies.” “Which tab and script sent request 52?” “Any console errors around the failing checkout?”
Breakpoints “Pause the next login request and change the password field.” “Break on the next request like 41.”
Insights “Are any secrets leaking in this traffic?” “Which endpoints are slowest?”
Authorization “Replay ShopApp’s requests as a user with this token and as no credentials, and list any endpoints that leak the original user’s data.”
Security testing Since 0.5.1 “Is api.example.com/v2/admin in scope?” “Which tokens never expire, and where were they sent?” “Run the passive API scan and add the IDOR candidates to the findings.” “Did any tool result try to inject instructions into the agent?” “Plan a fuzz of the order id, without sending anything.” See Scope, Findings and reports and AI security.
Releases and tests Since 0.4.0 “Compare ShopApp 2.3’s traffic with 2.4’s and list what changed.” “Make a test suite from ShopApp’s checkout requests and run it.”
Streams, model calls and traces Since 0.4.0 “Show the events of the last chat stream and where it stalled.” “What did the agent’s model calls cost, and why did the prompt cache miss?” “Did the checkout request keep its trace ID through the API?”
Apps that ignore the proxy “Why isn’t my app’s traffic showing up?” The assistant can suggest domains to capture and open the capture sheet for you to confirm. From 0.5.0: “Capture everything deploy-tool sends.” It asks for App Capture, and you click Allow in Cloak Proxy. Since 0.5.0
Setup Since 0.4.0 “Set up capture for ShopApp in the iOS Simulator.” “Install the certificate on the Android emulator.” “Where do the docs explain Map Remote?”
API client “Write tests for the Login request and run them.” “Run the Shop API collection against Staging.” “Create an OpenAPI spec from this collection.” “Commit the workspace.”

Resources are read-only context an assistant can attach to a conversation.

URI What it contains
cloak://status Port, recording, macOS capture and active tools.
cloak://assistant-scope Since 0.5.1 What the assistant scope lets the assistant see.
cloak://requests/recent The last 100 captured requests.
cloak://requests/{id} Headers and bodies of one request (a template: replace {id}).
cloak://insights/report The Insights Markdown report.
cloak://rules Every debugging tool and its rules.
cloak://collections API client collections, requests and environments.

Prompts are ready-made tasks. In clients that support them, they appear as slash commands or in a prompt menu.

Prompt Arguments What it asks the assistant to do
debug_request id (required) Find out why a captured request failed, compare it with a successful one, and suggest or try a fix.
mock_endpoint id (required), change Make a Map Local rule from a request, change the response as described, and confirm by replaying.
write_tests collection, request (both required) Add pm.test assertions to a saved request, run it, and report.
security_review None Review leaked secrets, weak headers and risky cookies, with fixes.
app_traffic_summary app (required) Summarize one app’s API calls, and check whether it bypasses the proxy.
setup_capture Since 0.4.0 target (required), app Get an app’s or device’s traffic into Cloak Proxy step by step with capture_setup, then check it arrives.

The MCP server gives an assistant the same power over Cloak Proxy that you have. Set it up knowing what that means.

  • It stays on your Mac. The server is a local process. It talks to the app only on 127.0.0.1, and the app’s API refuses other machines.
  • It uses the API token. The server reads the token from ~/Library/Application Support/CloakProxy/api-token. Any program you let run cloakctl mcp can read your captured traffic. See Control API.
  • Captured data goes to your assistant’s model. When a tool returns a request, its headers and body become part of the conversation, which your assistant sends to its model provider. Redact sensitive data before sending to AI, on by default, replaces tokens, cookies, API keys, passwords and card numbers with REDACTED first; personal data such as names and emails still comes through. See Redact sensitive data before sending to AI, and don’t point an assistant at traffic you aren’t allowed to share.
  • Team vault values aren’t filled in. Since 0.7.0 MCP tools never get team vault values: a request an assistant sends that uses one isn’t sent, with “Team vault values aren’t filled in for MCP tools and AI assistants”. Shared team MCP servers get their secrets through cloakctl mcp-exec when they start, never in an agent’s config file. See Shared agent setups.
  • Keep it to the traffic you’re working on. Since 0.5.1 The assistant scope limits what every tool returns to the apps, hosts or requests you choose, with bodies or as metadata only. Other apps’ requests stay out of the conversation, and the assistant can’t change the scope.
  • Assistants are told to ask first. The server’s instructions tell the assistant to ask before deleting things or turning macOS capture off. Each tool is also marked read-only or destructive, so clients that support those hints can ask for confirmation. Tools are marked destructive when they delete something, change the Mac’s or the app’s settings, or share traffic: clear_session, delete_rule, delete_extract_rule, delete_request, delete_collection, delete_variable, restore_deleted, import_session, set_macos_proxy, ssl_proxying, update_settings, set_tool_enabled, toxiproxy_api, install_certificate, git_commit, start_live_share, stop_live_share, from 0.5.0, set_app_capture and, from 0.5.1, update_scope, configure_ai_guard and add_finding. Widening the scope, approving an MCP server’s changed tools, loosening the AI Guard and saving a finding always wait for you to click in Cloak Proxy.
  • Some actions always need you. Trusting or removing the certificate and capturing an app that ignores the proxy need your Mac password, so the assistant can only open the right screen for you to confirm. capture_setup marks these steps needs_user.
  • Lock assistants out when you need to. Since 0.4.0 With cloakctl mcp off, every tool call answers MCP access to Cloak Proxy is turned off until you run cloakctl mcp on. See cloakctl.
  • Review tool calls. Keep your client’s approval prompts on for tools that change things, such as update_settings, set_macos_proxy, upsert_rule and git_commit.
Problem What to do
Traffic tools say “Couldn’t reach Cloak Proxy on port 9090” Open Cloak Proxy, or start cloakctl run. If the proxy uses another port, add --port N to the server command.
A tool says it “needs the Cloak Proxy app” The proxy is cloakctl run, which only serves traffic tools. Open the app for the rest.
Collection tools don’t see your collections The server uses the app’s workspace folder. If yours is elsewhere, add --workspace DIR.
The client doesn’t list the server Check the path to cloakctl (it contains a space, so it must be quoted in shell commands), then restart the client.