proxy-mcp
A local HTTPS MITM proxy MCP server that lets AI agents mock and transform app traffic on real Android devices/emulators without touching app source.
Start/stop an HTTPS MITM proxy and get the LAN IP:port to configure on the device (
proxy_start,proxy_stop).Serve static mock responses for URL patterns, inline or from a fixture file (
proxy_mock_response,proxy_list_mocks,proxy_clear_mocks).Simulate slow servers on mocks with
delayMsprocessing delay andbandwidthKbpsstreaming cap.Intercept real backend responses and apply JSON patches by path with
[]array wildcards,whereconditions, and__NOW__/__NOW_PLUS_<N><UNIT>__macros (proxy_mock_transform,proxy_update_transform,proxy_list_transforms,proxy_clear_transforms).Modify outgoing requests before forwarding — add/override/strip headers and query params, or replace the body (
proxy_request_transform,proxy_update_request_transform,proxy_list_request_transforms,proxy_clear_request_transforms).Dry-run a transform against a live URL to preview before/after values without registering it (
proxy_probe_transform).Inspect captured traffic with per-request transform outcomes (patched/no_match/not_json/error), optional request/response body previews, sensitive-header redaction, filtering, and JSON/HAR export (
proxy_list_traffic).Scope which hosts are retained in the traffic log, by hostname or
*.example.comwildcard, settable at start or mid-session (proxy_scope).Persist and restore response + request transform rules across proxy restarts (
proxy_save_transforms,proxy_load_transforms).Rewrite passthrough dial targets, e.g. Android emulator
10.0.2.2:8081→127.0.0.1:8081, and auto-passthrough Metro dev server traffic (hostRewrites,passthroughHosts).Report CA details (dir, source, fingerprint, cert/key match) plus per-platform trust and install instructions (
ca_info).Run full preflight diagnostics — running state, version, capabilities, CA status, rule counts, LAN IP, port availability, suggested start args (
proxy_health).Check running vs published version and recent changelog (
proxy_whats_new).Restrict file access to the launch directory or extra
--allowed-dirpaths.Use an equivalent CLI (
proxy-mcp-cli) when MCP is unavailable.
Enables network-level HTTP/HTTPS MITM proxying and mock response injection for real Android devices and emulators via adb, allowing AI agents to intercept and transform traffic from Android apps without source changes.
Uses the Charles Proxy CA certificate for SSL interception, requiring the Charles-exported cert and key to enable HTTPS MITM on the proxy.
Provides automatic passthrough of Metro bundler requests on port 8081 to the local dev server, stripping certain headers to avoid breaking the bundler.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@proxy-mcp start proxy on port 8889 and passthrough localhost:8081"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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:
delayMsprocessing time +bandwidthKbpsstreaming capCapture scoping (
proxy_scope): retain only the hosts you're investigating so the log stays smallCLI 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
adbon 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 --helpUpdates: use
@latestso 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.1instead.
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
.p12file (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.pemBoth 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_stopMCP tools (21)
Tool | Purpose |
| Start/stop the MITM proxy |
| Full preflight: running state, version, capabilities, CA status (cert/key present + matching + fingerprint), detected LAN IP, port availability, suggested |
| Static mock response for a URL pattern |
| JSON transform rule for a URL pattern |
| Idempotent upsert of a transform rule |
| Manage mock responses |
| Manage transform rules |
| Modify outgoing requests (headers/query/body) before forwarding |
| Manage request-transform rules |
| Idempotent upsert of a request-transform rule |
| Captured requests with transform outcomes + optional body previews |
| One-shot fetch + dry-run patch, returns before/after |
| Persist/restore response + request transforms to JSON file |
| Set/clear capture scope: which hosts' traffic is retained in the log |
| Running vs published version + changelog of recent releases |
| 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=trueinapps/tv/android/gradle.propertiesThis bakes the CA cert into the APK via
res/raw/cacertVerify the fingerprint from
ca_infomatches 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 getMock 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.comkeeps that host plus its subdomains (sub.api.example.com);*.example.comwildcards 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.comAt 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 getDefault 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 startMetro 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 orhostname: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) topassthroughHostsas well, so the request is not MITM'd before the rewrite happens.proxy_healthreports the activehostRewritesandpassthroughHosts, 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:majorThis 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 + certtransforms.json— auto-saved on proxy stoptraffic-*.json/*.har— exported traffic logs*.p12,cacert.pem— raw Charles exports
License
UNLICENSED — internal tool. Not distributed publicly.
Available Tools
21 toolsca_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
Scored across 21 tools
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.
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.
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.
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
Related MCP Connectors
Capture, inspect & debug HTTPS traffic across iOS, Android, browsers & backends — 304 MCP tools.
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
AI-native mock API server with MCP. Create REST/SOAP mocks from Claude, Cursor, or Windsurf.
Debug webhooks from your AI agent: inspect and replay captured webhooks on localhost.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn 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.11245MIT
- FlicenseBqualityBmaintenanceAn 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.7210-
- AlicenseCqualityBmaintenanceTransforms mitmproxy into a toolset for AI agents to inspect, modify, and replay HTTP/HTTPS traffic in real-time.425255 PyPI137MIT
- AlicenseAqualityDmaintenanceMCP server for intercepting and mocking HTTP(S) traffic via a Mockttp proxy, with tools for Android emulator setup, traffic inspection, protobuf analysis, and rule-based manipulation.35MIT