CLI Tracker is a small FastAPI + mitmproxy dashboard for inspecting local AI client traffic in real time.
It runs:
- a FastAPI UI on
http://127.0.0.1:3000 - an in-process
mitmproxyHTTPS proxy onhttp://127.0.0.1:8080 - a WebSocket feed that streams captured requests into the dashboard
- Captures matching
POSTrequests and keeps them in memory. - Filters traffic by allowed hosts and tracked path fragments.
- Supports a catch-all mode for any
POSTrequest on allowed hosts. - Parses JSON request bodies and JSON responses.
- Detects
text/event-streamresponses and reconstructs assistant output from SSE chunks. - Shows a structured dashboard with message blocks, tool calls, raw JSON toggles, diagnostics, and request metadata.
Default allowed hosts:
api.anthropic.comapi.claude.aiapi.z.aiapi.githubcopilot.com
User config currently also includes:
integrate.api.nvidia.com
Default tracked path fragments:
/v1/messages/v1/responses/v1/chat/completions/chat/completions
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtpython run.pyOpen:
- UI:
http://127.0.0.1:3000 - setup script endpoint:
http://127.0.0.1:3000/setup - proxy:
http://127.0.0.1:8080
PowerShell:
Invoke-Expression (Invoke-RestMethod "http://127.0.0.1:3000/setup?shell=powershell")Bash:
eval "$(curl -s http://127.0.0.1:3000/setup)"The generated setup script exports proxy variables plus CA-related variables pointing to the mitmproxy CA:
- Windows:
%USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.pem - Unix:
~/.mitmproxy/mitmproxy-ca-cert.pem
Go clients on Windows use the Windows system trust store, not environment variables such as SSL_CERT_FILE.
If a Go-based client like Crush fails TLS validation through the proxy, import the mitmproxy CA into Trusted Root Certification Authorities:
Import-Certificate -FilePath "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.pem" -CertStoreLocation Cert:\LocalMachine\RootWithout admin rights:
Import-Certificate -FilePath "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.pem" -CertStoreLocation Cert:\CurrentUser\RootTo remove it later:
Get-ChildItem Cert:\LocalMachine\Root | Where-Object { $_.Subject -like "*mitmproxy*" } | Remove-ItemAdding the mitmproxy CA to the trusted root store allows local HTTPS interception. Use it only if that is intentional.
GET /renders the dashboard UIGET /setupreturns a shell setup scriptGET /statusreturns basic runtime stats plus settingsGET /api/settingsreturns current settings and diagnosticsGET /api/bootstrapreturns UI display metadataPOST /api/settingsupdates allowed hosts, tracked paths, and catch-all modePOST /api/rejected/clearclears diagnostics countersPOST /clearclears captured request historyWS /wsstreams request history and live updates
run.py: simple local entry point foruvicornapp/main.py: FastAPI app, routes, startup/shutdown, setup script generationapp/proxy_addon.py: mitmproxy addon, request matching, response parsing, SSE reconstructionapp/state.py: in-memory request store, diagnostics counters, WebSocket fanoutapp/models.py: captured request modelapp/ui_display.py: labels and field metadata for the UIapp/templates/index.html: main page shellapp/static/js/index.js: client-side rendering and interactionsapp/static/css/index.css: dashboard layout and stylesapp/data/allowed_hosts.json: persisted host/path configuration
docs/README.mddocs/architecture.mddocs/function-map.md
- In-memory storage only; restarting the app clears captured requests.
- No automated test suite is included.
run.pybinds the UI to port3000; useuvicorn app.main:app ...if you need custom server flags.