Skip to content

MCPHawk 1.0: DevTools for MCP - #6

Merged
tech4242 merged 13 commits into
mainfrom
release/v1.0.0
Sep 23, 2026
Merged

tech4242 merged 13 commits into
mainfrom
release/v1.0.0

Conversation

@tech4242

Copy link
Copy Markdown
Owner

MCPHawk 1.0: DevTools for MCP

See every call your agent makes, across every MCP server, in one place. Then let your agent see it too.

An agent run in MCPHawk

One command setup. mcphawk install routes every MCP server of Claude Desktop, Claude Code, Cursor and VS Code through MCPHawk, with a backup of each config and a clean mcphawk uninstall.

Agent runs. Everything a client does across all its servers lands on one waterfall timeline, split into runs by task, with status, latency and result size for every call.

Call inspector and replay. Rendered tool results, full request and response, headers and shareable links. Edit any call and replay it against the real server.

Context cost. See how many tokens each server and tool adds to every turn, which tools never get used and which results flood the context window.

Problems. JSON-RPC errors, tool failures, unanswered and slow calls, agent loops and spec violations, most severe first.

Built for MCP 2026-07-28. First class support for the stateless spec (multi round-trip requests, server/discover, Mcp-Method headers, cache hints) and the classic handshake era, with spec lint for whichever version a session speaks.

Compare. Tools added, removed or changed between two versions of a server, including the token delta, plus how each call behaved.

MCPHawk is an MCP server. Seven read-only tools let Claude Code find failing calls and context hogs on its own and link you straight to them.

OpenTelemetry. Stream metrics, logs and traces over OTLP to Grafana, Datadog or any backend, following the OpenTelemetry conventions for MCP. Includes a Prometheus /metrics endpoint and a ready made Grafana dashboard.

Capture anywhere. A stdio wrapper, an HTTP proxy for local and remote servers including HTTPS, or passive sniffing with zero config changes.

Private by default. Everything stays in a local database, secrets are masked before they are stored and the UI only listens on localhost.

Context cost per server and tool

Breaking changes

  • New database location (~/.mcphawk/) and schema; captures from 0.x are not migrated
  • The terminal UI is gone and mcphawk web is now mcphawk up (the old name still works)
  • Existing mcphawk wrap <command> entries keep working and are picked up by install and uninstall
  • Requires the MCP Python SDK 2.2 or newer and Python 3.10+

Rebuild MCPHawk around one shared core for the 2026-07-28 spec:

- store: sessions/exchanges/messages schema (WAL, multi-process), recorder
  with request/response pairing, multi round-trip chains, cancellation and
  identity from both the initialize handshake and modern _meta
- capture: stdio shim (wrap), recording reverse proxy (incl. legacy
  HTTP+SSE endpoint rewriting), rewritten passive sniffer with TCP ordering
  and an incremental HTTP/1.x + SSE parser
- install/uninstall for Claude Desktop, Claude Code, Cursor and VS Code
  with backups and structural undo; likely-OAuth remote servers are skipped
- analysis: context cost, problems (errors, hung, slow, loops), spec lint
  per protocol era, tool drift between sessions
- web API + live updates by tailing the DB; MCPHawk MCP server with six
  read-only tools returning capped summaries and deep links
- secrets masked before they are written
- drop the old logger/sniffer/wrapper/web modules and their tests
Replay re-sends a (possibly edited) client request to the same server over
stdio or Streamable HTTP, performing the legacy handshake when needed, and
records it as its own session for comparison. Refuses requests or commands
containing masked secrets.

Mutating API calls now require an X-MCPHawk header and a localhost Host,
blocking cross-site requests and DNS rebinding.
…pare, setup

Rebuilt the Vue app around the v1 API: a DevTools-style waterfall of every
call in a run across servers, a detail drawer with rendered tool results,
JSON tree, headers, multi round-trip chains and replay, plus context cost,
problems, session comparison and a setup page that dry-runs install.
Keeps the MCPHawk logo and takes the accent colour from it; fonts are
bundled locally. Drops Tailwind, Pinia, axios and headlessui.

Also:
- pair responses recorded before their request (stdio pumps race)
- recognise the v0.x 'mcphawk wrap <cmd>' syntax in install/uninstall
- name version-titled client processes (Claude Code) by argv[0]
- replace the old examples with a demo that drives three SDK servers
- version 1.0.0, SPDX license metadata, classifiers incl. Python 3.14
- enforce 85% coverage via coverage fail_under
- CI: test Python 3.10-3.14, Node 22, check the committed UI build is current
- Makefile targets for the new test layout, demo and build
- README rewritten for v1, CHANGELOG, new screenshot
- keep 'mcphawk web' as a hidden alias of 'mcphawk up'
Runs are now computed at read time: one client's sessions across all its
servers (HTTP sessions join the same client's process group), split after
5 minutes without a call. Run keys are <client>@<start> and stay stable.
Problems and context cost for a run only count calls inside its window.

- sessions.run_key is now client_key (which client process); runs.py owns
  grouping; new list_runs MCP tool; UI shows 'Agent runs' with client
  labels (Claude Code, Cursor, ...) and time ranges
- mcphawk wrap forwards traffic unchanged if recording fails (bad DB,
  schema mismatch, disk full) instead of taking the server down
- install output says what happens to each server, summarises before
  asking, and shows paths relative to ~
- demo: a second, later task to show separate runs
- README leads with a one-minute setup (real install output), a section
  on what agent runs are, and one short section plus screenshot per
  feature (timeline, inspector/replay, context cost, problems, compare,
  agent access); images live in docs/images
- Setup page leads with which of your servers are recorded, uses client
  product names and plain status text (ClientTable component)
- cost findings format token counts with thousands separators
mcphawk up --otlp streams what MCPHawk records to any OTLP backend
(Grafana, Datadog, Honeycomb, ...) using the OpenTelemetry semantic
conventions for MCP, configured by the standard OTEL_* variables:

- metrics: mcp.client.operation.duration (requests, failures by
  error.type, latency) plus mcphawk.tool.result/definition.tokens
- logs: one record per MCP message, linked to its call's span;
  payloads only with --otlp-payloads (masked, capped)
- traces: one span per call; joins the client's trace when it sends a
  traceparent in _meta, otherwise one trace per agent run with a root
  span; multi round-trip retries nest under the first call
- /metrics Prometheus endpoint with the same names and labels
- mcphawk export --otlp for past runs or sessions
- Grafana dashboard in examples/grafana, checked against /metrics
- optional extra: pip install 'mcphawk[otel]'

Requested on r/mcp: ship MCP client-server logs and request/failure
metrics to Grafana/Datadog.
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.22655% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.22%. Comparing base (fc0b218) to head (0fdbd00).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
mcphawk/capture/stdio.py 90.00% 13 Missing ⚠️
mcphawk/otel/exporter.py 98.66% 3 Missing ⚠️
mcphawk/__main__.py 0.00% 2 Missing ⚠️
mcphawk/query.py 99.10% 2 Missing ⚠️
mcphawk/capture/http_sessions.py 98.59% 1 Missing ⚠️
mcphawk/capture/sniff.py 99.50% 1 Missing ⚠️
mcphawk/cli.py 99.47% 1 Missing ⚠️
mcphawk/replay.py 99.27% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main       #6       +/-   ##
===========================================
+ Coverage   84.50%   99.22%   +14.72%     
===========================================
  Files          11       34       +23     
  Lines        1226     3111     +1885     
===========================================
+ Hits         1036     3087     +2051     
+ Misses        190       24      -166     
Flag Coverage Δ
unittests 99.22% <99.22%> (+14.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
mcphawk/__init__.py 100.00% <100.00%> (ø)
mcphawk/analysis/cost.py 100.00% <100.00%> (ø)
mcphawk/analysis/drift.py 100.00% <100.00%> (ø)
mcphawk/analysis/lint.py 100.00% <100.00%> (ø)
mcphawk/analysis/problems.py 100.00% <100.00%> (ø)
mcphawk/capture/http1.py 100.00% <100.00%> (ø)
mcphawk/capture/http_proxy.py 100.00% <100.00%> (ø)
mcphawk/capture/process.py 100.00% <100.00%> (ø)
mcphawk/capture/sse.py 100.00% <100.00%> (ø)
mcphawk/install/clients.py 100.00% <100.00%> (ø)
... and 24 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- pin ruff==0.16.8 in requirements-dev.txt and install that exact version
  in the CI lint job so local and CI lint agree
- fix RUF059 (unused unpacked variables) in three tests
- remove mcphawk/tui/widgets/stats_chart.py, a 0.x leftover committed by
  accident, and ignore mcphawk/tui/
…WK_URL

Found by a smoke test of the packaged wheel: uninstall printed restored
servers with a '+', and 'mcphawk mcp' links point at port 8484 unless
MCPHAWK_URL says where the UI runs.
The release workflow already requests id-token: write; the upload now
uses pypa/gh-action-pypi-publish, so no PyPI token is stored in the repo.
Also bump softprops/action-gh-release to v2.
@tech4242
tech4242 merged commit d3997a0 into main Sep 23, 2026
7 checks passed
@tech4242
tech4242 deleted the release/v1.0.0 branch September 23, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant