Skip to main content
Glama

proxy-mcp

MCP server for AI agents to run a local HTTPS MITM proxy and mock headend/backend responses on real Android devices — at the network level, with zero app source changes.

  • Intercepts HTTP/HTTPS traffic from physical devices and emulators

  • Registers mock responses and JSON transform rules via MCP tools

  • Modifies outgoing requests (headers / query / body) via request-transform rules

  • Probes transforms before registering (one-shot dry-run patch)

  • Persists/restores transform rules across proxy restarts

  • Tracks per-request transform outcomes — distinguish patched, no_match, error

  • Gzip-safe — transparently decompresses, patches, and recompresses

  • Rewrites passthrough hosts (e.g. Android emulator 10.0.2.2 → 127.0.0.1)

  • Simulates slow servers on mocks: delayMs processing time + bandwidthKbps streaming cap

  • Capture scoping (proxy_scope): retain only the hosts you're investigating so the log stays small

  • CLI fallback when MCP is unavailable

Charles-only CA

This proxy must use the same CA certificate that the target app's network_security_config.xml trusts. The only supported path is the Charles Proxy CA — no auto-generation, no Frida, no alternative CAs.

Related MCP server: proxy-mcp

Requirements

  • Node >= 18

  • adb on PATH (for device proxy setup)

  • Charles Proxy CA (cert + key exported from Charles)

Setup

No clone needed. The server is installed from the npm registry (prebuilt dist/ — no devDeps, no build step), then registered with your MCP client.

# verify the CLI works once
npx -y @shahfazliz/proxy-mcp@latest --help

Updates: use @latest so new releases are picked up automatically — no cache clearing, no config changes. If you need reproducibility (e.g. comparing behavior across sessions), pin a specific version like @0.1.1 instead.

1. Extract your Charles Proxy CA

Charles stores its CA at ~/Library/Application Support/Charles/ca/. Extract the cert and key into your project's .proxy-ca/ directory:

Step 1: Export the Charles CA (one-time setup)

  • In Charles: Help → SSL Proxying → Export Charles Certificate and Private Key

  • Save as .p12 file (password-protected or empty password - your choice)

Step 2: Extract to .proxy-ca/ .proxy-ca can be anywhere on your computer. I like to put them in ~/.certificates/ where I put all other certs there

# If exported with password
npx proxy-mcp-cli ca:import --p12 ~/path/to/charles-ssl-proxying.p12 --password yourpassword

# If exported with empty password (default)
npx proxy-mcp-cli ca:import --p12 ~/path/to/charles-ssl-proxying.p12

# Or manually extract
mkdir -p .proxy-ca
openssl pkcs12 -in ~/path/to/charles-ssl-proxying.p12 \
  -nocerts -nodes -passin pass:yourpassword -out /path/to/.proxy-ca/key.pem
openssl pkcs12 -in ~/path/to/charles-ssl-proxying.p12 \
  -clcerts -nokeys -passin pass:yourpassword -out /path/to/.proxy-ca/cert.pem

Both files must be clean PEM (no Bag Attributes, no PKCS12 wrapping). The key must be an unencrypted RSA private key.

2. Register with Cursor / any MCP client

Use @latest to always get the newest release (see the note in Setup):

{
  "mcpServers": {
    "shah-proxy": {
      "command": "npx",
      "args": [
        "-y",
        "@shahfazliz/proxy-mcp@latest",
        "--ca-dir",
        "/absolute/path/to/.proxy-ca"
      ],
      "enabled": true
    }
  }
}

Alternative for zero-npx: npm install -g @shahfazliz/proxy-mcp, then set command to proxy-mcp with the same args. Update with npm update -g @shahfazliz/proxy-mcp.

--ca-dir must point to a directory containing cert.pem and key.pem (see step 1). If you omit it entirely, the server auto-discovers the CA in order: <cwd>/.proxy-ca, ~/.proxy-ca, then ~/Library/Application Support/Charles/ca — and reports which source it used (see proxy_health.caStatus → source).

Quick start

# 1. Start proxy (port 8889, Metro dev server passthrough)
proxy_start --passthroughHosts '["localhost:8081"]'

# On an Android emulator, also map its 10.0.2.2 alias to the host loopback
# so Metro/dev-server passthrough can reach the Mac:
proxy_start --port 8889 --passthroughHosts '["10.0.2.2:8081"]' \
  --hostRewrites '[{ "match": "10.0.2.2:8081", "upstream": "127.0.0.1:8081" }]'

# 2. Point device at the proxy
adb -e shell settings put global http_proxy 10.0.2.2:8889    # emulator
adb -s <ip> shell settings put global http_proxy <lan>:8889   # physical

# 3. Probe a transform before registering (dry-run)
proxy_probe_transform --url https://api.example.com/items \
  --patches '[{ "path": "items[]", "set": { "endTime": "__NOW_PLUS_2M__" } }]'

# 4. Register the transform
proxy_update_transform --method GET --url viewMultiviews \
  --patches '[{ "path": "items[]", "where": { "isMultiview": true }, "set": { "endTime": "__NOW_PLUS_2M__" } }]'

# 5. Traffic observability — check transform outcomes per request
proxy_list_traffic --filter viewMultiviews

# 6. Clean up
adb -e shell settings put global http_proxy :0
proxy_stop

MCP tools (21)

Tool

Purpose

proxy_start / proxy_stop

Start/stop the MITM proxy

proxy_health

Full preflight: running state, version, capabilities, CA status (cert/key present + matching + fingerprint), detected LAN IP, port availability, suggested proxy_start args

proxy_mock_response

Static mock response for a URL pattern

proxy_mock_transform

JSON transform rule for a URL pattern

proxy_update_transform

Idempotent upsert of a transform rule

proxy_list_mocks / proxy_clear_mocks

Manage mock responses

proxy_list_transforms / proxy_clear_transforms

Manage transform rules

proxy_request_transform

Modify outgoing requests (headers/query/body) before forwarding

proxy_list_request_transforms / proxy_clear_request_transforms

Manage request-transform rules

proxy_update_request_transform

Idempotent upsert of a request-transform rule

proxy_list_traffic

Captured requests with transform outcomes + optional body previews

proxy_probe_transform

One-shot fetch + dry-run patch, returns before/after

proxy_save_transforms / proxy_load_transforms

Persist/restore response + request transforms to JSON file

proxy_scope

Set/clear capture scope: which hosts' traffic is retained in the log

proxy_whats_new

Running vs published version + changelog of recent releases

ca_info

CA fingerprint, trust model (app-bundled vs device install), setup instructions

The server also ships an instructions block (delivered during MCP initialization) that tells agents the canonical workflow and gotchas, so they don't need this README to get a first run working.

Full parameter docs for each tool live in the proxy_start / proxy_* tool schemas (visible to MCP clients), plus the project wiki (a local Obsidian vault — not committed to this repo).

App dependency

Your debug APK must trust the proxy's CA. For an Android TV app:

  • Set enableSystemProxy=true in apps/tv/android/gradle.properties

  • This bakes the CA cert into the APK via res/raw/cacert

  • Verify the fingerprint from ca_info matches the app's bundled cert

No device-side CA installation, no root, no Magisk needed — trust is app-bundled.

tvOS / iOS (Apple TV)

Apple devices reject the proxy's leaf certificates unless the leaf's issuer bytes exactly match the CA subject bytes. proxy_health reports leafIssuerCheck and tlsHandshakeFailures so a trust failure is visible — the fix is in the server, not the app.

CLI fallback

npx proxy-mcp-cli start --port 8889 --passthrough 10.0.2.2:8081 --host-rewrite 10.0.2.2:8081=127.0.0.1:8081
npx proxy-mcp-cli status
npx proxy-mcp-cli ca-info
npx proxy-mcp-cli ca:import --p12 /path/to/charles-ssl-proxying.p12
npx proxy-mcp-cli transform add GET "https://..." patches.json
npx proxy-mcp-cli req-transform add GET viewBundle setHeaders='{"x-custom":"v"}' list
npx proxy-mcp-cli traffic --filter example
npx proxy-mcp-cli mock add GET "https://example.com/api/people" /tmp/fixture.json --delay 2000 --bandwidth 50
npx proxy-mcp-cli scope set api.example.com   # retain only interesting hosts
npx proxy-mcp-cli scope get

Mock speed control

proxy_mock_response (and the CLI mock add command) accept two optional knobs to simulate a slow, far-away server — useful when you want to reproduce loading states, spinners, or timeouts on the device:

  • delayMs — server processing time. The proxy waits this long before sending a single byte.

  • bandwidthKbps — network bandwidth cap. The body is re-streamed at this rate (KB/s), so a large payload arrives progressively instead of all at once.

{
  "method": "GET",
  "url": "api.example.com/v1/user",
  "bodyFile": "/tmp/user.json",
  "delayMs": 2000,
  "bandwidthKbps": 50
}

Both are optional and independent; combine them for a full "slow server" experience.

Capture scoping

During bug investigation, proxy_list_traffic returns every captured host into the agent's context — noisy and token-heavy. scope restricts which traffic is retained:

  • The proxy still MITMs and serves all hosts (discovery is unaffected) — scope only controls what appears in the log.

  • Scope by hostname, not path: api.example.com keeps that host plus its subdomains (sub.api.example.com); *.example.com wildcards are also accepted.

  • Narrow it mid-session: start wide, then scope once the interesting host shows up.

  • Already-captured entries are unaffected when you change scope.

At start (via proxy_start or CLI):

{ "scope": ["api.example.com"] }
npx proxy-mcp-cli start --port 8889 --scope api.example.com,cdn.example.com

At runtime (MCP tool or CLI):

proxy_scope --hosts '["api.example.com"]'   # set scope
proxy_scope                                 # clear scope (retain all)
npx proxy-mcp-cli scope set api.example.com,cdn.example.com
npx proxy-mcp-cli scope clear
npx proxy-mcp-cli scope get

Default scope: [] (or unset) = capture all traffic, matching the pre-scoping behavior.

Allowed directories

File-access tools (bodyFile on mocks, proxy_save_transforms, proxy_load_transforms, and CLI patch files) only read/write inside the folder the proxy was launched from. Add other directories at launch with a repeatable --allowed-dir <path> flag or the SHAH_PROXY_ALLOWED_DIRS env var (comma-separated). The list is fixed at startup — tools cannot widen it at runtime.

npx proxy-mcp-cli --allowed-dir /Users/me/shared-fixtures start

Metro passthrough

The proxy automatically forwards Metro bundler requests (:8081) to the local dev server. Headers like newrelic, traceparent, tracestate, and accept-encoding are stripped from forwarded Metro requests to avoid breaking the bundler.

localhost:8081, 127.0.0.1:8081, and the detected LAN IP at :8081 are always auto-added to passthrough — pass passthroughHosts only for additional hosts.

Android emulator host rewrites (hostRewrites)

Android emulators reach the host machine's loopback via the special alias 10.0.2.2. That address only exists inside the emulator's network namespace — it is not a real, reachable address from the Mac. When the app calls Metro through the proxy with Host: 10.0.2.2:8081, the proxy must translate it to 127.0.0.1:8081 before dialing, or the fetch hangs / returns 502 Error communicating with upstream server.

Pass hostRewrites to proxy_start:

{
  "port": 8889,
  "passthroughHosts": ["10.0.2.2:8081"],
  "hostRewrites": [
    { "match": "10.0.2.2:8081", "upstream": "127.0.0.1:8081" }
  ]
}
  • match — the host:port as it arrives in the request (hostname or hostname:port).

  • upstream — the host:port the proxy should actually dial instead.

  • Applies to both HTTP passthrough and WebSocket passthrough targets.

  • Add 10.0.2.2 (and its port) to passthroughHosts as well, so the request is not MITM'd before the rewrite happens.

  • proxy_health reports the active hostRewrites and passthroughHosts, so the agent can verify the mapping took effect.

  • CLI equivalent: --host-rewrite 10.0.2.2:8081=127.0.0.1:8081.

Releasing

Publish a new version to npm. Users on @latest get it automatically on next launch — no git installs, no cache clearing:

npm run release:patch   # or release:minor / release:major

This runs npm version <level> (bump + tag) then npm publish (builds, publishes, sets the latest tag). Prefer semver: patch for bug fixes, minor for new features, major for breaking changes.

Git-ignored (keep local)

  • .proxy-ca/ — CA private key + cert

  • transforms.json — auto-saved on proxy stop

  • traffic-*.json / *.har — exported traffic logs

  • *.p12, cacert.pem — raw Charles exports

License

UNLICENSED — internal tool. Not distributed publicly.

Available Tools

21 tools
ca_infoCA path, trust model, and install instructionsA

Report the CA in use (directory, source, fingerprint, and whether cert.pem/key.pem are present AND match) plus per-platform instructions. There are two distinct trust paths: (1) app-bundled trust for TV / debug builds — the cert is compiled into the app (res/raw/cacert) and the README's 'No device-side CA install, no root, no Magisk' workflow applies; (2) explicit device CA install for phones/browsers — install once via Settings, or adbPush=true over USB (this does NOT apply to TV builds). Use proxy_health.caStatus for the same validity checks without the instructions.

Inputs: adbPush.

proxy_clear_mocksClear mock rulesA

Remove one mock rule by id, or all rules if no id is given.

Inputs: id.

proxy_clear_request_transformsClear request-modification rulesA

Remove one request transform rule by id, or all rules if no id is given.

Inputs: id.

proxy_clear_transformsClear transform rulesB

Remove one transform rule by id, or all transform rules if no id is given.

Inputs: id.

proxy_healthCheck proxy health and diagnostics (preflight)A

Full preflight/diagnostics. Always returns: running, version, capabilities, caStatus (dir, source, fingerprint, whether cert.pem/key.pem match), rule counts, captured-traffic count, and warnings. While the proxy is stopped it also returns detectedLanIp, whether the default port is free, and suggestedStart (ready-to-use proxy_start arguments). Use this first — it tells you everything needed to get running without shelling out.

Inputs: no named parameters.

proxy_list_mocksList active mock rulesB

View the active in-memory mock rules.

Inputs: no named parameters.

proxy_list_request_transformsList active request-modification rulesB

View the active request transform rules.

Inputs: no named parameters.

proxy_list_trafficList / export captured trafficA

Confirm a rule matched the intended request by inspecting captured traffic. Each entry includes transformOutcome (patched|no_match|not_json|error) and patchesApplied count. Sensitive headers (authorization, cookies, api keys) are redacted by default — set includeSensitiveHeaders=true to see raw values. Use includeRequestBodyPreviews=true to see POST/PUT body content. Use includeResponseBodyPreviews=true for response samples. Optionally export to JSON or HAR (replaces the Charles log-export workflow).

Inputs: export, filter, includeBodies, includeSensitiveHeaders, +2 more.

proxy_list_transformsList active transform rulesB

View the active intercept-and-transform rules.

Inputs: no named parameters.

proxy_load_transformsLoad transform rules from a JSON fileB

Load transform rules previously saved with proxy_save_transforms. Uses idempotent upsert (requires proxy to be running).

Inputs: path.

proxy_mock_responseAdd a mock ruleA

Add an in-memory mock rule. Matches on HTTP method + URL pattern (glob/substring by default against the full URL; set regex=true for a raw regex). Body is supplied inline or via a fixture file on disk. Provide either 'body' or 'bodyFile', not both. Optionally simulate a slow server: delayMs waits before responding (processing time), bandwidthKbps streams the body at a KB/s rate (slow network / big object from far away).

Inputs: url (required), method (required), body, regex, +5 more.

proxy_mock_transformAdd an intercept-and-transform ruleA

Intercept a request, forward it to the real backend, parse the JSON response, apply in-place patches (path + optional where + set), and return the modified response. Use [] for array wildcards in path, where for conditional matching, and __NOW__ / __NOW_PLUS_<N><UNIT>__ macros for dynamic timestamps.

Inputs: url (required), method (required), patches (required), regex.

proxy_probe_transformOne-shot: test transform rules without registering themA

Fetch a URL directly, apply the given patches, and return a sample of modified fields (before/after values) plus match count. Useful for verifying patch paths and wire values before calling proxy_update_transform. Does NOT require the proxy to be running.

Inputs: url (required), patches (required).

proxy_request_transformAdd a request-modification ruleA

Intercept a request matching method+URL, modify it (headers, query params, body), forward to the real backend, and return the response. Use setHeaders/removeHeaders to modify headers, setQuery/removeQuery for URL params, and body to replace the request body.

Inputs: url (required), method (required), body, regex, +4 more.

proxy_save_transformsPersist all transform rules to a JSON fileA

Save both response and request transform rules to a JSON file for reuse after a proxy restart. Reload with proxy_load_transforms.

Inputs: path.

proxy_scopeSet or clear the capture scope (retention scoping)A

Restrict which traffic is retained in the proxy log (proxy_list_traffic). The proxy still intercepts and serves all hosts — this only controls what is kept, so the agent's context stays small during bug investigation. Pass 'hosts' to retain only matching hostnames (their subdomains are included, and '*.example.com' wildcards are allowed); omit 'hosts' or pass [] to clear scoping and retain all traffic again. Returns the active scope and current captured-traffic count. Already-captured entries are unaffected.

Inputs: hosts.

proxy_startStart MITM proxyA

Bring up the mockttp HTTPS MITM proxy. Returns the LAN IP : port to type into the device's manual Wi-Fi proxy settings. Unmatched requests pass through to the real headend. If the device is an Android emulator, pass hostRewrites to map its 10.0.2.2 alias (means 'host loopback', only valid inside the emulator) to 127.0.0.1 so Metro/dev-server passthrough can reach the Mac.

Inputs: port, scope, hostRewrites, passthroughHosts, +1 more.

proxy_stopStop MITM proxyA

Stop the proxy. Transform rules are auto-saved to transforms.json for next restart. Device proxy may still be set on the device — use proxy_health to detect this.

Inputs: no named parameters.

proxy_update_request_transformAdd or update a request-modification rule (idempotent upsert)A

Idempotently upsert a request transform rule by (method + url + regex) key. If a rule with the same key exists, its properties are replaced.

Inputs: url (required), method (required), body, regex, +4 more.

proxy_update_transformAdd or update an intercept-and-transform rule (idempotent upsert)A

Idempotently upsert a transform rule by (method + url + regex) key. If a rule with the same key exists, its patches are replaced. Use this instead of clear+re-add to avoid auto-review friction.

Inputs: url (required), method (required), patches (required), regex.

proxy_whats_newWhat's new in this server?A

Report the running server version, the changelog for recent releases (optionally since a specific version), and whether a newer version is published on npm. Use this to learn what changed in recent releases — e.g. when in-repo skills seem out of date — without leaving the MCP.

Inputs: sinceVersion.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 21 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: lifecycle (start/stop/health), mock responses, response transforms, request transforms, traffic inspection, CA info, scoping, and persistence. The three rule types (mock_response, mock_transform, request_transform) are clearly separated, and their list/clear/update operations are named distinctly.

    Naming Consistency4/5

    All tools share the proxy_ prefix and use snake_case, but the pattern is not perfectly uniform. Most are verb_noun (proxy_list_mocks, proxy_clear_transforms), but some are noun-like (proxy_health, proxy_ca_info, proxy_scope) or phrases (proxy_whats_new). This is a minor deviation from a strict verb_noun convention.

    Tool Count3/5

    At 21 tools, the set is on the heavy side. While each tool serves a legitimate purpose across rule lifecycle, traffic inspection, and diagnostics, the count borders on excessive for a typical proxy MCP, making it feel slightly bloated compared to the 3-15 range.

    Completeness4/5

    The surface covers the core proxy workflows well: start/stop, health checks, mock responses, response/request transforms with update and persistence, traffic inspection, and CA management. Minor gaps include lack of an update operation for mock_response rules and no explicit way to clear captured traffic, though proxy_scope mitigates the latter.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables AI assistants to capture and analyze HTTP/HTTPS traffic from Android devices. It supports smart searching of network requests and provides tools for detailed traffic analysis via natural language.
      11
      245
      MIT
    • F
      license
      B
      quality
      B
      maintenance
      An HTTP/HTTPS MITM proxy server that enables capture, modification, and mocking of network traffic across Chrome, CLI tools, Docker containers, and Android devices. It supports advanced capabilities like JA3/JA4 TLS fingerprinting, JA3 spoofing, and upstream proxy chaining.
      72
      10
      -