Skip to content

Add embedded MCP server for AI-agent control - #158

Open
Tim-Hoekstra wants to merge 7 commits into
Quitten:masterfrom
Tim-Hoekstra:master
Open

Add embedded MCP server for AI-agent control#158
Tim-Hoekstra wants to merge 7 commits into
Quitten:masterfrom
Tim-Hoekstra:master

Conversation

@Tim-Hoekstra

Copy link
Copy Markdown

Summary

Adds an optional, built-in MCP (Model Context Protocol) server to Autorize so an AI agent can query findings and drive the extension programmatically, instead of only through the UI.

The server is exposed at POST http://127.0.0.1:<port>/mcp (JSON-RPC 2.0) and is off by default. A new MCP Server sub-tab (under Configuration) provides an enable toggle, a port field, and the auth token with regenerate/copy buttons.

Security

  • Binds to 127.0.0.1 only.
  • Requires an Authorization: Bearer <token> header on every request; the token is generated with SecureRandom at start, kept in memory only, and is deliberately excluded from Save/Restore state files (only the enabled flag and port are persisted). This matters because the results table can contain live session cookies / Authorization headers.
  • Implemented on java.net.ServerSocket (part of java.base) so it works on Burp's bundled/trimmed JRE with no extra modules.

Tools (23)

  • Status/control: status, start, stop, clear results
  • Findings: list results (+ regex), get result detail, send to Repeater
  • Users: list, add (one or many at once), update, remove, get last captured Cookie/Authorization headers (and populate a user's headers from the last request)
  • Detectors & filters: per-user enforcement detector + match/replace (all types), global unauthenticated detector, interception filters (get/set), plus a helper that lists all valid type strings
  • Config & state: get/set configuration, export (HTML/CSV), save/restore state

Implementation notes

  • New mcp/ package (server, protocol, tools, edt) and gui/mcp_tab.py.
  • Concurrency: log reads use a lock-guarded snapshot; all Swing state is touched via SwingUtilities.invokeAndWait. The server uses its own thread pool, separate from the extension's traffic-replay pool.
  • Small refactors for reuse (no behavior change): extracted set_running, HTML/CSV report builders, and path-based save/restore; remove_user can take a user id.
  • README documents enabling and connecting.

Hannah-PortSwigger and others added 7 commits February 20, 2026 11:52
Expose Autorize's findings and configuration over a loopback-only,
token-authenticated MCP (JSON-RPC 2.0) endpoint at POST 127.0.0.1:<port>/mcp,
so an AI agent can query results and drive Autorize programmatically.

- New mcp/ package: server.py (raw java.net.ServerSocket HTTP/1.1 so it runs on
  Burp's trimmed JRE; 127.0.0.1-only bind; SecureRandom bearer token kept in
  memory, never persisted), protocol.py (initialize/tools/list/tools/call/ping),
  tools.py (23 tools), edt.py (run_on_edt + lock-guarded log snapshot).
- New "MCP Server" sub-tab (gui/mcp_tab.py): enable toggle, port, token display,
  regenerate/copy; wired via helpers/initiator.py init_mcp and torn down on unload.
- Tools cover status/start/stop/clear, results listing (+regex)/detail/
  send-to-repeater, users (bulk add, update, remove, fetch-last-headers),
  per-user enforcement detector + match/replace (all types), global unauth
  detector and interception filters (get/set), config get/set, export, and
  save/restore state.
- Refactor for reuse: configuration_tab.set_running, export build_html/csv report
  functions, save_restore save/restore_*_to_path (+ non-secret MCPConfig row),
  user_tab.remove_user(user_id)/set_user_name.
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.

2 participants