From 0cbff1e6579bbee2f1f10de840cdd9c1eaa5bca2 Mon Sep 17 00:00:00 2001 From: Nirmal Arya Date: Tue, 24 Jun 2025 16:42:13 -0400 Subject: [PATCH] Revert to stable MCP implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove problematic stdio import to fix build issues - Focus on SSE-based MCP servers for now - Builds should work properly now 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- app/lib/services/mcp.ts | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/app/lib/services/mcp.ts b/app/lib/services/mcp.ts index f371049c..8f6b7ff9 100644 --- a/app/lib/services/mcp.ts +++ b/app/lib/services/mcp.ts @@ -1,9 +1,6 @@ import { experimental_createMCPClient } from 'ai'; import { createScopedLogger } from '~/utils/logger'; -// Dynamic import for stdio transport to avoid build issues -let Experimental_StdioMCPTransport: any; - const logger = createScopedLogger('mcp-service'); // MCP config types @@ -92,28 +89,8 @@ async function createStdioClient(serverName: string, config: ServerConfig): Prom logger.debug(`Creating stdio MCP client for '${serverName}' with command: '${command}' ${args?.join(' ') || ''}`); - try { - // Dynamic import to avoid build issues with missing export - if (!Experimental_StdioMCPTransport) { - const module = await import('ai/mcp-stdio'); - Experimental_StdioMCPTransport = module.Experimental_StdioMCPTransport; - } - - const transport = new Experimental_StdioMCPTransport({ - command: command!, - args, - env, - cwd, - }); - - return await experimental_createMCPClient({ transport }); - } catch (e) { - // Fallback error message for unsupported environments - if (e instanceof Error && e.message.includes('Missing')) { - throw new Error(`Stdio MCP servers are not supported in this environment. Please use SSE-based servers instead.`); - } - throw new Error(`Failed to start command "${command}": ${errorToString(e)}`); - } + // Stdio servers not supported in this environment + throw new Error(`Stdio MCP servers are not supported in this environment. Please use SSE-based servers instead. See: https://modelcontextprotocol.io/examples`); } export async function createMCPClients(mcpConfig?: {