Skip to content

feat(mcp): allow editing stdio MCP sources from the UI #812

@aryasaatvik

Description

@aryasaatvik

Problem

The MCP source detail page hides the Edit button for stdio servers because the plugin sets canEdit: sd.transport === "remote" (packages/plugins/mcp/src/sdk/plugin.ts:1382, :1524), and updateSource early-returns on non-remote (plugin.ts:1553). Users can only change command / args / env / cwd by hand-editing executor.jsonc and restarting.

The React side already has a StdioReadOnly view in packages/plugins/mcp/src/react/EditMcpSource.tsx:246 that explains this, but the canEdit gate prevents users from ever reaching it — the button simply doesn't render.

Proposal

Full edit support for stdio sources, parity with remote.

Backend

  • Extend McpUpdateSourceInput (plugin.ts:131) with optional command, args, env, cwd.
  • Branch updateSource on transport. For stdio:
    • Persist updated McpStdioSourceData.
    • Re-run discovery — tools can change when command / args change — mirroring refreshSource.
    • Replace bindings accordingly.
  • Set canEdit: true for stdio at registration (both addSource and refreshSource).
  • Extend the API handler and request schema in packages/plugins/mcp/src/api/handlers.ts.

Config-file write-through already handles stdio via toMcpConfigEntry / inputFormFromStored (plugin.ts:1013, :1046), so no work needed there.

UI

  • Replace StdioReadOnly in EditMcpSource.tsx:246 with an editable form: command (text), args (string list), env (plain string key/value pairs — no secret references in v1), cwd (text).

Scope notes

  • env values are plain strings in v1. Secret references like remote headers use are out of scope.
  • Tool re-discovery on save is required: changing the command spawns a different process. Save should re-discover and surface failures inline; stale bindings would be a worse outcome than a failed save.

Open questions

  1. Cloud host: stdio is gated by dangerouslyAllowStdioMCP. Should the Edit form be hidden on hosts that disallow stdio? Likely yes — same gate as add.
  2. Read-only fallback when stdio is disabled: still surface command / args on the source detail header as info, or keep them hidden entirely?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions