Repository navigation
feat: "Connect an AI Agent" dialog and MCP status bar item - #42
Merged
Merged
Conversation
Connecting a client meant finding a config that was only printed to the dev console, and the Preferences > MCP tab still pointed at the legacy `/sse` endpoint without a token. Connecting is the point of Arduino Agent, so it gets a first-class place in the IDE: - Help > Connect an AI Agent... (also in the command palette) opens a dialog with copy buttons for: a `claude mcp add` command, an MCP config for Claude Desktop/Cursor/etc. via the bundled stdio bridge, and direct HTTP. The snippets use this installation's real paths: the bridge in resources/mcp-bridge (or the checkout's bridge/ in dev builds), the app executable as ARDUINO_AGENT_PATH, and the token. - A status bar item shows "MCP ready", "Agent connected" (a session made a request in the last 5 minutes), "MCP off" or "MCP unavailable" with the reason (e.g. its port is taken by another copy). Clicking it opens the dialog. - The first time the server is running, a notification offers the dialog. - Backend: MCPService.getConnectionGuide(); MCPStatus gains activeClients (per-session last-request times; Streamable HTTP sessions rarely close, so connectedClients only grows) and error (why start() failed); session open/close now pushes a status change to the frontend. - Preferences > MCP shows the /mcp address and points at the dialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Summary
Connecting an AI client is the whole point of Arduino Agent, but it was hard to do:
/sseendpoint, with no token and no mention of the bridge.This PR gives connecting a proper place in the IDE. It's stacked on #41.
Help › Connect an AI Agent... (also in the command palette, under "Arduino Agent") opens a dialog with copy buttons for three setups. They use this installation's real paths: the bundled bridge in
resources/mcp-bridge/, the app executable asARDUINO_AGENT_PATH, and the token.claude mcp add arduino --scope user --env ARDUINO_AGENT_PATH=... -- node <bridge>command.mcpServersconfig that goes through the bridge. The client stays connected while Arduino Agent is closed, and the app starts when a tool needs it.Status bar item (bottom left, click to open the dialog):
MCP readyAgent connected/N agents connectedMCP off⚠ MCP unavailable, with the reason in the tooltip and dialog (e.g. port in use)First run: the first time the server is running, a notification offers to show the setup.
Backend
MCPService.getConnectionGuide(), which finds the bridge inprocess.resourcesPath, the bundled backend's resources, or the checkout.MCPStatusgains:activeClients: per-session last-request times. Streamable HTTP clients rarely close their sessions, so the existingconnectedClientscount only ever grows.error: whystart()failed.Preferences › MCP now shows the
/mcpaddress and points at the new dialog.The dialog is plain DOM on Theia's
AbstractDialog, themed with Theia CSS variables. This avoids adding JSX to the extension's build.Test plan
On a local Windows build (production webpack + electron-builder with the release metadata), checked from inside the running app via CDP on the renderer and the main process:
ARDUINO_MCP_PORT=3848, the status bar readsMCP ready, and the dialog shows "MCP server running on http://127.0.0.1:3848/mcp" plus all three snippets with the build's real bridge path, exe path and token.2 agents connected(tooltip: "2 MCP sessions active in the last 5 minutes").MCP unavailable. The tooltip and the dialog both say the port is in use, probably by another copy of Arduino Agent, and how to fix it.arduino-agent.yarn test:bridgepasses 13/13.🤖 Generated with Claude Code