I have implemented the Notion MCP using the Vercel AI SDK like this:
const mcpClient = await experimental_createMCPClient({
transport: new Experimental_StdioMCPTransport({
command: 'npx',
args: ['-y', '@notionhq/notion-mcp-server'],
env: {
OPENAPI_MCP_HEADERS: JSON.stringify({
Authorization: `Bearer ACCESS_TOKEN`,
'Notion-Version': '2022-06-28',
}),
},
}),
});
const tools = await mcpClient.tools();
Then I pass the tools to the Vercel AI SDK. The code is located inside a Vercel Function (Next.js)
It works well in my local environment but when I deploy to Vercel I have the following error:
npm error code ENOENT
npm error syscall mkdir
npm error path /home/sbx_user1051
npm error errno ENOENT
npm error enoent Invalid response body while trying to fetch https://registry.npmjs.org/@notionhq%2fnotion-mcp-server: 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.
npm error enoent
npm notice
npm notice New major version of npm available! 10.9.2 -> 11.4.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.4.1
npm notice To update run: npm install -g npm@11.4.1
npm notice