Add MCP server for AI-assisted development via Claude#56
Open
andrewleech wants to merge 2 commits into
Open
Conversation
f446ea9 to
654eef3
Compare
MCP (Model Context Protocol) server that lets Claude Code or Claude Desktop programmatically control ViperIDE while the user interacts with it in the browser simultaneously. Core: the MCP server serves built ViperIDE on localhost, opens the browser on first tool call, and bridges MCP tool calls over WebSocket to a control client injected into the IDE. 23 MCP tools expose device connection, file operations, editor control, code execution, terminal I/O, and package management. Serial bridge: Node.js opens USB serial ports directly and relays data over WebSocket, faking a WebREPL handshake so ViperIDE's existing transport works unchanged. Bypasses browser WebSerial permission picker entirely. Distribution: build-dist.sh produces per-platform .tar.gz and .mcpb (Claude Desktop Extension) bundles with pre-built ViperIDE assets. build-npm.sh stages a cross-platform npm package. CI workflow builds all three platforms and publishes to npm + GitHub Releases on tag. Also increases the WebREPL password prompt timeout from 1s to 5s for slow embedded WiFi stacks.
654eef3 to
db5e499
Compare
- control_client: track connecting/connected state locally and snapshot deviceInfo on deviceConnected event. Fixes get_status reporting stale devInfo from a prior session because app.js never clears its module local on disconnect. - mcp/index.js: drop 'usb' from connect_device enum and document connect_serial as the USB path, so Claude does not route USB connect requests to the browser click flow. - mcp/index.js: expose the bundled ideUrl in get_status and add an open_ide tool so the model stops suggesting viper-ide.org when the browser tab is closed. - rawmode: interruptProgram per retry failures now log to console.debug instead of popping a red toast; only the final 20s timeout surfaces as a user visible error.
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.
This adds an MCP (Model Context Protocol) server that lets Claude Desktop and Claude Code
control ViperIDE remotely, connecting to devices, managing files, running code, and
interacting with the REPL. The user sees everything in the browser and can intervene at
any point.
Entirely optional, self-contained in
mcp/with minimal touchpoints to the main codebase:src/control_client.js- new file, browser-side message handler for the MCP WebSocketsrc/app.js- ~15 lines added, conditionally initialises the control client whenlaunched with
?mcp=1src/transports.js- one timeout constant changed (1s to 5s for WebREPL password prompt)Everything else lives under
mcp/and doesn't affect normal ViperIDE usage.Includes:
I wrote up a walkthrough of how it works in practice:
https://notes.alelec.net/posts/claude-meets-micropython/
No pressure at all if you're not keen on AI integration or the maintenance/support
that might come along with it. Happy to keep this on my fork if you'd prefer.
I wanted to put it in front of you in case it's something you'd be interested in
having upstream. Either way, ViperIDE made this possible, the architecture and
transport abstraction were a great foundation to build on.