# Debug with Claude

> Connect Claude Code or another AI assistant to Cloak Proxy over MCP, ask it to investigate traffic, and review its tool calls safely.

Source: https://docs.subcloak.com/cloak-proxy/guides/debug-with-claude/

Cloak Proxy is a Model Context Protocol (MCP) server, so an AI assistant like Claude Code can do anything you can in the app: read and replay traffic, turn capture on, set up Map Local and breakpoints, read Insights, and use the whole API client. This guide connects Claude Code, shows prompts that map to real tools, and covers reviewing what the assistant does and keeping it safe.

## What you need

| | |
|---|---|
| Cloak Proxy installed, with the certificate trusted | The assistant drives the running app over a local API |
| An MCP client: Claude Code, Claude Desktop, Cursor or VS Code | Each connects over stdio by running `cloakctl mcp` |

> **Caution:**
> The MCP server exposes everything the app can do on your Mac, including turning macOS capture on, publishing Gists and running requests. Only connect an assistant you trust, and review its tool calls.

## Connect the assistant

The connection command is on the **Advanced** settings page and in the API client's **MCP** hub (copy buttons fill in the real `cloakctl` path).

**Claude Code**

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

**Cursor / VS Code / Claude Desktop**

Add this to the client's MCP config:

```json
{"mcpServers":{"cloak-proxy":{"command":"/Applications/Cloak Proxy.app/Contents/Resources/cloakctl","args":["mcp"]}}}
```

*[Screenshot: The Advanced settings page with TLS key logging, cloakctl path, and AI assistant MCP commands for Claude Code and Cursor. Advanced settings: copy the MCP command for your client.]*

The API client's **MCP** hub shows the same commands alongside the full tool list.

*[Screenshot: The MCP hub with a Connect section, the Use Cloak Proxy from AI assistants card, and the grouped list of 151 tools. The MCP hub lists the connection commands and every tool by group.]*

> **Install the skills too:**
> Run `cloakctl skills install claude`, or use **Agent skills** on the MCP page, so Claude Code knows which Cloak Proxy tools to use for setup, debugging, mocks and tests. See [Agent skills and setup tools](https://docs.subcloak.com/cloak-proxy/automation/agent-skills/).

> **Working on one app?:**
> (added in Cloak Proxy 0.5.1) Right-click it in the sidebar and choose **Limit AI Assistants to ShopApp**, so Claude only sees its requests. See [Limit what AI assistants can see](https://docs.subcloak.com/cloak-proxy/automation/assistant-scope/).

## Ask it to investigate

Once connected, describe the problem in plain language. The assistant chooses the tools. A few examples and the tools they call:

| Ask | Tools it uses |
|---|---|
| "What's failing in my traffic right now?" | `list_requests` (errors only), `get_request`, `compare_requests` |
| "Why did request 42 fail? Try a fix." | `get_request`, `list_requests`, `edit_and_replay` |
| "Mock `GET /v1/users` to return an empty list." | `rule_from_request` (Map Local), `upsert_rule`, `replay_request` |
| "Any leaked secrets or weak headers?" | `insights` with section `secrets` and `security` |
| "What is the MyApp app doing on the network?" | `list_requests` filtered by app, `bypassing_apps` |
| "Turn on capture and decrypt api.example.com." | `set_macos_proxy`, `ssl_proxying` |
| "Run the Petstore collection and report failures." | `run_collection` |
| "Send request 42 twenty times, five at once. Do any succeed twice?" | `repeat_request_many` |
| "Pause the next checkout request so I can change the total." | `break_on_next`, then `list_paused` and `resolve_paused` |
| "Generate TypeScript types for the response of request 30." | `generate_types` |
| "Add `X-Debug: 1` to every request to `staging.example.com`." | `upsert_rule` with tool `rewrite` |
| "Stop recording Mail's traffic." | `mute_app` |

> **Tip:**
> The server also ships ready-made prompts your client can pick: **Debug a failing request**, **Mock an endpoint**, **Write tests for a saved request**, **Security review of captured traffic**, and **What is this app doing?**. They expand into the right tool sequence for you.

## What the assistant can reach

The 154 tools are grouped: captured traffic (`list_requests`, `get_request`, `search_requests`, `trace_value`, `replay_request`, `edit_and_replay`, `compare_requests`, `repeat_request_many`, `generate_types`, `build_replay_flow`, `privacy_map`, `get_stream_events`, `export_session`…), capture control (`mute_app`, `mute_host`, `set_focus`, `set_retention`, `set_recording`, `set_macos_proxy`, `app_capture_status`, `set_app_capture`, `ssl_proxying`), debugging tools including Rewrite (`list_rules`, `upsert_rule`, `rule_from_request`, `set_tool_enabled`, `rule_folders`, `rule_sets`), typed queries and extract rules (`explain_query`, `set_traffic_filter`, `save_extract_rule`), breakpoints (`break_on_next`, `list_paused`, `resolve_paused`), `insights`, model calls (`llm_calls`, `llm_summary`, `llm_prices`), API testing (`authorization_matrix`, `check_contract`, `release_diff`, `make_tests`, `compare_environments`, `mirror_report`), settings, bypassing apps, guided setup and bug reports (`capture_setup`, `install_certificate`, `search_docs`, `make_bug_report`), distributed tracing (`get_trace`, `trace_report`, `configure_tracing`), live sharing (`start_live_share`), Personal Cloud share links (`create_share_link`), the browser extension (`get_browser_context`, `list_browser_console`), security testing (`scope_status`, `inspect_tokens`, `api_scan`, `fuzz_preview`, `list_findings`, `add_finding`), AI security (`prompt_injection`, `mcp_manifests`, `ai_guard_log`), and the whole API client (collections, environments, runner, mocks, load tests, flows, specs, Git). There are also 7 read-only resources and 6 prompts.

It can also open things in the app for you (`open_in_app`) — a request, the Tools window, Insights, a Settings page — so you can see what it found.

## Review and stay safe

1. Watch the tool calls. Your MCP client shows each call and its arguments before (or as) it runs; read them like you'd read a command before pressing Enter.

2. Approve destructive actions deliberately. The server marks tools that delete or overwrite (`clear_session`, `delete_rule`, `delete_request`, `delete_collection`, `delete_variable`) as destructive, and the server's own instructions tell the assistant to ask before deleting things or turning macOS capture off.

3. Some actions still need you. Capturing an app that ignores the proxy needs your Mac password, so `open_capture` just opens the sheet for you to confirm — the assistant can't enter the password.

4. Breakpoints wait for a human. If a rule pauses a request, the assistant can read it with `list_paused` and continue or edit it with `resolve_paused`, but a paused request holds the app until someone acts.

> **Danger:**
> The local API answers only this Mac, and only requests that carry the token in `~/Library/Application Support/CloakProxy/api-token`. Don't share that token or expose the API to other machines. Treat an assistant with MCP access as having the same reach as you do in the app.

## Clean up

1. Remove the MCP server from your client when you no longer need it (for Claude Code, `claude mcp remove cloak-proxy`).

2. Turn off any tools the assistant left on (Map Local, Rewrite, Breakpoint…) in the Tools window, unmute any apps it muted in **Settings › General › Muted apps and hosts**, and turn off macOS capture if it was enabled for the session.

## Related

  - [MCP server](https://docs.subcloak.com/cloak-proxy/automation/mcp-server/): Connect Claude Code, Claude Desktop, Cursor and VS Code; what it can do; security.
  - [MCP tools reference](https://docs.subcloak.com/cloak-proxy/automation/mcp-tools-reference/): All 154 tools grouped, with arguments, resources and prompts.
  - [Control API](https://docs.subcloak.com/cloak-proxy/automation/control-api/): The local REST API and its token.
  - [MCP client](https://docs.subcloak.com/cloak-proxy/api-client/protocols/mcp/): Use the API client to test other MCP servers.
