Add embedded MCP server for AI-agent control - #158
Open
Tim-Hoekstra wants to merge 7 commits into
Open
Conversation
Autorize v1.9.2
Autorize v1.9.3
Autorize v1.9.4
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Authorization: Bearer <token>header on every request; the token is generated withSecureRandomat 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 /Authorizationheaders.java.net.ServerSocket(part ofjava.base) so it works on Burp's bundled/trimmed JRE with no extra modules.Tools (23)
Implementation notes
mcp/package (server,protocol,tools,edt) andgui/mcp_tab.py.SwingUtilities.invokeAndWait. The server uses its own thread pool, separate from the extension's traffic-replay pool.set_running, HTML/CSV report builders, and path-based save/restore;remove_usercan take a user id.