Let AI agents query Argus data via a local MCP endpoint (#299) - #329
Open
mando wants to merge 1 commit into
Open
Let AI agents query Argus data via a local MCP endpoint (#299)#329mando wants to merge 1 commit into
mando wants to merge 1 commit into
Conversation
Serve a stateless streamable-HTTP MCP server at POST /mcp, mounted among the read routes in createApp behind the existing rejectUnsafeHost guard. Six read-only tools (search_sessions, get_session, get_session_transcript, usage_summary, tool_usage, health_summary) reuse the exact readers startServer assembles for the web API, so agents and the dashboard never disagree. Two new settings resolve per request so Settings toggles apply live: agentAccess.enabled (default on; off makes /mcp 404) and agentAccess.includeTranscripts (default off; gates transcript text, the genuinely new exposure). Both surface in a new Agent access category in Settings. Docs: new Connect Your Agent page, internals/agent-access.md, and updates to privacy.md and settings-reference.md. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Fixes: #299
Why
Argus indexes local agent sessions, but agents can't see any of it. This lets AI agents on the user's machine (Claude Code, Codex, Gemini CLI) query Argus directly — "what did I work on last week", usage/cost, task outcomes — so agents can use the user's own work history as context.
How
A local MCP server, served as stateless streamable HTTP on the existing serve app at
POST /mcp(reachable athttp://127.0.0.1:4242/mcp, including through the desktop app's front-door proxy, which is a dumb TCP relay so no proxy changes were needed). No stdio subcommand: the desktop sidecar binary lives at an unstable bundle path, and all three clients speak streamable HTTP.search_sessions,get_session,get_session_transcript,usage_summary,tool_usage,health_summary) reuse the exact readersstartServerassembles for the web API. Zero new store queries, so agents and the dashboard can never disagree.agentAccess.enabled(default on; off makes/mcp404) andagentAccess.includeTranscripts(default off; also requiresretainText). The transcript tool stays listed while gated, with a description that tells the agent how to ask the user to enable it, and refuses with a tool-level error if called anyway.readOnlymode), guarded by the existingrejectUnsafeHost(the MCP spec's DNS-rebinding requirement), nox-argus-appCSRF requirement (MCP clients can't send one, and every tool is read-only), no auth token (loopback bind stays the boundary, consistent with the rest of the API).McpServer+StreamableHTTPTransport(@hono/mcp) per request,sessionIdGenerator: undefined(no session state),enableJsonResponse: true(plain JSON answers, easy to smoke-test),GET /mcp→ 405 (no standalone notification stream; this server never initiates messages).Settings surface
New "Agent access" category in Settings with the two toggles. The web Settings screen renders from
describeSettings(), so no web code changes were required; the transcript toggle is gated on the enabled toggle via the existingactiveWhenmechanism.Docs
docs/connect-your-agent.md(under "Using Argus"): per-client connect snippets, the tool table, the transcript toggle, and the plain-HTTP/CLI fallback.docs/internals/agent-access.md: transport decision, tool-to-reader map, threat model.docs/privacy.md(agent access section) anddocs/settings-reference.md(both new settings).Verification
bun test(720 pass, including 17 newtest/mcp.test.tstests drivingcreateAppwith raw JSON-RPC POSTs: initialize, tools/list, tools/call per tool, filter pass-through, sentinel stripping, limit clamping, gating, non-loopback Host 403, GET 405, read-only mode) andbun run typecheck.bun run build:compile, randist/argus serve, POSTedinitialize+tools/list+tools/call(usage_summary,search_sessions) to/mcp; confirmed transcripts-off refusal, disabled 404, evil-Host 403, GET 405.claude mcp add --transport http argus http://127.0.0.1:4242/mcpend-to-end, and Claude Cowork's sandboxed VM may not reach host loopback (docs note Claude Code/Codex/Gemini CLI first).