mitmproxy-mcp CLAUDE.md

mitmproxy-mcp CLAUDE.md is an instructions file for coding agents from mplogas/mitmproxy-mcp. It costs 820 tokens per session, scanned A, original, MIT.

A set of Claude Code instructions for a server that captures and analyses network traffic from IoT devices. It uses mitmproxy to inspect encrypted traffic and tshark to analyse packet captures.

In plain words
What is it for?
Use it when developing or operating the mitmproxy-based IoT traffic capture and analysis server.
Why use it?
It explains the project structure, subprocess ownership, and safety rules needed to work on a tool that can intercept device traffic.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/mplogas/mitmproxy-mcp/claude-md
Clone the repo
git clone --depth 1 https://github.com/mplogas/mitmproxy-mcp

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mitmproxy-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/mplogas/mitmproxy-mcp/claude-md.svg)](https://agentmods.dev/instructions/mplogas/mitmproxy-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/mplogas/mitmproxy-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/mplogas/mitmproxy-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 820 This file is loaded in full into every session.
When invoked 820 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00820 $0.00820
Opus 5 $0.00410 $0.00410
Sonnet 5 $0.00164 $0.00164
Haiku 4.5 $0.00082 $0.00082

Measured 4d ago against content hash 99ed76736738, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mitmproxy-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code when working with code in this repository.

Project

mitm-mcp is an MCP server that orchestrates mitmproxy (mitmdump) and tshark for network-level TLS interception of IoT device traffic, exposing capture and analysis operations as MCP tools over stdio transport.

Architecture

MCP client (Claude Code, etc.)
  |
  stdio transport
  |
mitm-mcp (server.py)
  |
  tools.py -> session.py -> subprocess (mitmdump, tshark)
  |
addon.py (standalone, runs inside mitmdump)
  |
Pi network stack (hostapd AP on wlan0, eth0 uplink)

session.py is the ONLY module that manages long-lived subprocesses (Popen). Everything else talks to session.py. This prevents race conditions from split connection ownership.

addon.py is standalone -- no imports from mitm_mcp. It runs inside the mitmdump process which may use a different Python environment. It communicates with the MCP server via JSONL files only.

Safety Model

Three tiers enforced at the MCP server boundary:

  • read-only: full autonomy (list_clients, get_flows, get_findings, capture_status)
  • allowed-write: autonomous but logged (start_ap, stop_ap, start_proxy, stop_proxy, start_capture, stop_capture)
  • approval-write: reserved for future response injection (no MVP tools)

Build and Run

# Install
pip install -e ".[dev]"

# Run server (stdio transport, spawned by MCP client)
python -m mitm_mcp

# Tests (no network hardware needed)
pytest

# Integration tests (AP + network setup required)
pytest tests/ -m network

Prerequisites

  • mitmproxy installed (provides mitmdump): pip install mitmproxy
  • tshark installed: apt install tshark
  • WiFi AP configured via scripts/ap-setup.sh (idempotent, run once or rerun to change values)
  • Operator must be SSH'd over Ethernet, not WiFi

AP Scripts

  • scripts/ap-setup.sh -- one-time setup. Installs packages, writes hostapd/dnsmasq configs, creates NetworkManager connection, enables IP forwarding. Idempotent. Use --dry-run to preview. Override defaults with --ssid, --passphrase, --channel, --subnet, --interface.
  • scripts/ap-toggle.sh -- per-engagement. start brings up hostapd + dnsmasq + iptables rules (NAT MASQUERADE, FORWARD ACCEPT for wlan0<->eth0, REDIRECT 80/443/8883 to mitmproxy), stop tears them down. Called by the MCP server's start_ap/stop_ap tools. start --passthrough (or --no-redirect) skips the REDIRECT rules, leaving a plain NAT AP. Use for sacrificial-pair captures where TLS plaintext is not needed (still get SNI / DNS / endpoint shape via tshark), or for any AP-as-AP scenario without interception. The MCP tool start_ap exposes this via the passthrough boolean argument. stop is idempotent regardless of which start mode was used.

Read the full file on GitHub · 85 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 85 lines · 820 tokens per session scan A 99ed76736738

Subscribe to this mod's changes

mitmproxy-mcp CLAUDE.md is an instructions file published in the GitHub repository mplogas/mitmproxy-mcp (1 stars, last pushed 2mo ago), licensed MIT. It adds 820 tokens to every session, about $0.0041 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.