• v1.14.1-mcp-poc: single-server MCP client against Context7

    indifferentketchup released this 2026-05-23 21:58:09 +00:00

    Validates the MCP-client loop end-to-end against one real MCP server before
    the full v1.15 port. New services/mcp-client.ts wraps @modelcontextprotocol/sdk
    v1.29.0 with Streamable HTTP transport. On startup (when MCP_CONTEXT7_URL is
    set), connects to Context7, discovers tools via tools/list, wraps each as a
    ToolDef prefixed context7_, and appends to ALL_TOOLS via appendMcpTools.

    Read-only invariant guard rejects any tool with readOnlyHint: false. Tool
    dispatch is transparent — executeToolCall routes MCP calls through the ToolDef
    execute wrapper, which strips the prefix before calling the MCP server. Result
    size capped at 5MB with truncation. Graceful degradation: server down at
    startup → zero tools; server down mid-session → error result, model
    self-corrects.

    Adversarial review caught that a Zod .default() on the URL config made MCP
    always-on instead of opt-in — fixed by removing the default. MCP_CONTEXT7_URL
    must be explicitly set to enable.

    ALL_TOOLS changed from ReadonlyArray to mutable to support late-registration.
    appendMcpTools re-sorts and rebuilds TOOLS_BY_NAME after append.

    348/348 server tests passing (16 new mcp-client tests). No schema changes,
    no frontend changes.

    Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

    Downloads