Repository navigation
feat(extensions): run stdio MCP servers in a sandboxed runner - #304
Merged
Merged
Conversation
MCP servers that run as a program (npx, uvx) run in the MCP runner, an opt-in container (COMPOSE_PROFILES=mcp) with none of Lens's data or keys, no capabilities, a read-only image and a network shared only with the backend. Admins add them as mcp extensions with command/args/env, and a plugin's stdio servers come along when an admin installs it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CsyA2Kuhsnhzz2HjkD3zED
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CsyA2Kuhsnhzz2HjkD3zED
Records the runner as new surface (Assistant family and the dependency table) and fixes the marketplace docstring that still said plugins bring network MCP servers only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0188zd7Y9m6tdENwXQyhCSH2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0188zd7Y9m6tdENwXQyhCSH2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0188zd7Y9m6tdENwXQyhCSH2
…-ks9sah # Conflicts: # threat-model.yaml
…-ks9sah # Conflicts: # CHANGELOG.md
adeelahmad
pushed a commit
that referenced
this pull request
Oct 14, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014pKRz6HkdQ7hTqEbpnyhYo
This was referenced Oct 15, 2026
Merged
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.
Requested by Adeel · project thread
Description
Before: Lens could use only MCP servers on the network (HTTP). Servers that run as a program (stdio, usually
npxoruvx), which are most of the servers in marketplaces, were left out.After: they run in the MCP runner, a new opt-in container (
COMPOSE_PROFILES=mcp, ordocker compose --profile mcp up -d). Admins add a stdio server as anmcpextension withcommand,argsandenv, just as Claude's.mcp.jsondescribes it. A plugin's stdio servers are installed with it when an admin installs the plugin, except servers whose program ships inside the plugin folder.The runner container is the sandbox:
no-new-privileges, a read-only image, and memory and process limits.npxanduvxcan fetch servers.A server starts on first use, is initialized once, and stops after 15 idle minutes. If it crashes, the error comes back to the caller and the next use starts it again.
mcp-runner/runner.pyis our own code, using only the Python standard library (about 250 lines). The existing bridges either take a fixed config at startup (mcp-proxy) or run one server per process (supergateway). Lens needs servers registered while it runs and the client'sinitializeanswered from one long-lived process.Brought up to date with main on 2026-10-14 (merge commit; the compose files keep both the
mcpandstyletts2services), with the runner recorded inthreat-model.md(Assistant family and the dependency table), a CHANGELOG entry and the refine-later list in DEVLOG.Motivation and Context
This follows #276. It closes the "MCP servers that run as a program aren't run" gap, since most marketplace MCP servers are stdio.
Steps to reproduce (if appropriate):
tests/api/test_mcp_servers.pyruns the real runner against a fake stdio server: it lists tools, calls one, reuses the same process, and restarts it after a crash. The newMCP runnerworkflow builds the image, runs it hardened as compose does, and calls real servers from npm (@modelcontextprotocol/server-memory) and PyPI (mcp-server-time).Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
<server>__<tool>.COMPOSE_PROFILES=mcp(refine later: turn it on from Settings through the machine agent, as monitoring does).mcpprofile.mcp.listandmcp.callgo through the activity ledger as before.mcpspec gains optionalcommand,args,env).🤖 Generated with Claude Code
https://claude.ai/code/session_0188zd7Y9m6tdENwXQyhCSH2