Skip to content

feat: "Connect an AI Agent" dialog and MCP status bar item - #42

Merged
mixelpixx merged 1 commit into
mainfrom
connect-agent
Oct 2, 2026
Merged

mixelpixx merged 1 commit into
mainfrom
connect-agent

Conversation

@mixelpixx

Copy link
Copy Markdown
Owner

Summary

Connecting an AI client is the whole point of Arduino Agent, but it was hard to do:

  • The ready-to-paste config was only printed to the dev console.
  • Preferences › MCP still pointed at the legacy /sse endpoint, 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 as ARDUINO_AGENT_PATH, and the token.

  • Claude Code: a single claude mcp add arduino --scope user --env ARDUINO_AGENT_PATH=... -- node <bridge> command.
  • Claude Desktop, Cursor and other MCP clients: an mcpServers config that goes through the bridge. The client stays connected while Arduino Agent is closed, and the app starts when a tool needs it.
  • Direct HTTP: the existing config with the token, for clients that speak Streamable HTTP.

Status bar item (bottom left, click to open the dialog):

State Shows
Server up, no recent use MCP ready
A session made a request in the last 5 minutes Agent connected / N agents connected
Turned off in Preferences MCP off
Failed to start ⚠ 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

  • New MCPService.getConnectionGuide(), which finds the bridge in process.resourcesPath, the bundled backend's resources, or the checkout.
  • MCPStatus gains:
    • activeClients: per-session last-request times. Streamable HTTP clients rarely close their sessions, so the existing connectedClients count only ever grows.
    • error: why start() failed.
  • Session open and close now push a status change to the frontend, so the status bar updates without waiting for its 20 s refresh.

Preferences › MCP now shows the /mcp address 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:

  • Ready: with ARDUINO_MCP_PORT=3848, the status bar reads MCP 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.
  • Agents connected: with the build on the default port, the Arduino bridges of two live Claude Code sessions connected on their own, and the status bar showed 2 agents connected (tooltip: "2 MCP sessions active in the last 5 minutes").
  • Port busy: with a dummy listener holding 3847, the status bar shows 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.
  • Menu: the native Help menu opens with "Connect an AI Agent..." in its own group above Getting Started.
  • First run: the hint was raised once (it appears in the notification centre), and not again on the next launch.
  • Screenshot of the dialog in the dark theme: the status dot, three sections with Copy buttons, scrollable code blocks, and the theme's buttons.
  • Smoke test on 3848: 14/14, and the server now reports arduino-agent. yarn test:bridge passes 13/13.
  • CI.

🤖 Generated with Claude Code

@mixelpixx
mixelpixx changed the base branch from own-identity to main October 2, 2026 01:58
@mixelpixx
mixelpixx merged commit 883c165 into main Oct 2, 2026
1 check passed
@mixelpixx
mixelpixx deleted the connect-agent branch October 2, 2026 01:58
@mixelpixx mixelpixx mentioned this pull request Oct 2, 2026
2 of 4 tasks
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>
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.

1 participant