Skip to content

Error initializing MCP client for connection on Vercel production build #5586

Closed
@kyleledbetter

Description

@kyleledbetter

Description

ai 4.3.0
next 15.2.0

In local dev this works fine but when I deploy an app with MCP client creation w/ the ai sdk to Vercel I get:

Error initializing MCP client for connection 3cb562fa-f5a3-4111-b76b-83f4275eba8e: Error [MCPClientError]: Connection closed

based on a stdio call trying to run the npx command and getting

npm error enoent Invalid response body while trying to fetch https://registry.npmjs.org/@supabase%2fmcp-server-supabase: ENOENT: no such file or directory, mkdir '/home/sbx_user1051'
npm error enoent This is related to npm not being able to find a file.

I'm using the Supabase MCP with this standard io setup:

{
  "mcpServers": {
    "supabase": {
      "command": "npx",
      "args": [
        "-y",
        "@supabase/mcp-server-supabase@latest",
        "--access-token",
        "<personal-access-token>"
      ]
    }
  }
}

I've got a fairly vanilla Vercel setup for Next.js, not using Fluid Compute

I suspect the serverless nature of a Vercel is the issue, but wondering if other folks have seen this?

I've gotten the same errors using Experimental_StdioMCPTransport and experimental_createMCPClient in an actions.ts as was all my chat route.ts with export const dynamic = 'force-dynamic';

Code example

No response

AI provider

"ai": "^4.3.0", "@ai-sdk/react": "^1.2.6",

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions