feat(m3.6): local MCP server (tron mcp)#33
Merged
Merged
Conversation
Adds `tron mcp`, a local Model Context Protocol server over stdio (PRD §14), exposing TronBrowser's browser + analyze tools to any MCP host. Dependency-free protocol layer (packages/sdk/src/mcp) — a minimal JSON-RPC 2.0 server (initialize/tools/list/tools/call/ping) so the shipped runtime stays self-contained (no @modelcontextprotocol/sdk). Tools wrap the SDK Browser/Page, so M3.1–M3.5 are reused rather than reimplemented. Tools: browser_open/snapshot/click/fill/type/press/select/scroll/wait/extract/ screenshot/tabs/close, plus the AI-assisted browser_analyze (non-mutating dry-run), browser_step, and browser_run_task. Mutating tools return a fresh snapshot; screenshot returns image content. The managed session launches lazily on first tool use and tears down on browser_close. install.sh routes `tron mcp` via tron-node.mjs with TRON_SESSION_BIN; the server ships in the existing sdk/ payload. Tests (+11): protocol (initialize/list/call/ping/unknown/notification), all tools against a fake page (mutations return snapshots, screenshot image, analyze dry-run, close), and the newline-delimited stdio transport. Verified the full server end-to-end over stdio (initialize -> tools/list -> browser_open -> browser_close) against a WS CDP stub session. Full workspace suite green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
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.
Implements M3.6 — MCP server (PRD §14). Base
main.tron mcp # headed managed session tron mcp --headlessHost config:
{ "mcpServers": { "tronbrowser": { "command": "tron", "args": ["mcp", "--headless"] } } }Design: dependency-free, reuse the SDK
initialize/tools/list/tools/call/ping) — no@modelcontextprotocol/sdkdependency, so the shipped runtime stays self-contained like the rest of M3.Browser/Page, so M3.1–M3.5 are reused, not reimplemented. Lives in the SDK package (packages/sdk/src/mcp), shipped in the existingsdk/payload.Tools (16)
Primitive:
browser_openbrowser_snapshotbrowser_clickbrowser_fillbrowser_typebrowser_pressbrowser_selectbrowser_scrollbrowser_waitbrowser_extractbrowser_screenshotbrowser_tabsbrowser_closeAI-assisted:
browser_analyze(non-mutating dry-run) ·browser_step·browser_run_taskbrowser_screenshotreturns image content; analyze/extract/tabs return JSON.AI_PROVIDER_NOT_CONFIGURED.browser_close. Local stdio only — never a network listener.Acceptance criteria (PRD §22)
browser_analyzenon-mutating page/form analysis.browser_stepone validated action;browser_run_taskbounded loop.Verification — +11 tests
initialize → tools/list (16) → browser_open (launched session → "Page: Example Domain") → browser_closeagainst a WS CDP stub session.Scope
Node ≥22, stdio transport only. Cookies/storage not exposed as tools. See
docs/mcp.md.🤖 Generated with Claude Code