Skip to content

stdio MCP env values keep literal quotes (parseStdioEnv lacks dotenv parsing) #811

@aryasaatvik

Description

@aryasaatvik

Repro

Add an stdio MCP source via the UI with dotenv-style env, e.g.:

IBKR_HOST="127.0.0.1"
IBKR_PORT="4002"

Behavior

Child process receives IBKR_HOST = "127.0.0.1" (literal 11-char string with quotes), schema/Config validation in the child fails, child exits, and the API returns McpToolDiscoveryError surfaced as a generic "Failed connecting via stdio".

Cause

parseStdioEnv in packages/plugins/mcp/src/react/AddMcpSource.tsx:516 does a naive =-split + .trim() — it does not interpret surrounding quotes as syntactic.

Secondary: connectClient in packages/plugins/mcp/src/sdk/connection.ts:88-94 discards the underlying error, so the UI can't show the real cause.

Fix

Parse env like dotenv: matched surrounding "…" or '…' are treated as delimiters (with the usual escape handling inside double quotes). Optionally also propagate the underlying error message into McpConnectionError for better debuggability.

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