pi-mcp-adapter fails to load: Cannot find module '@modelcontextprotocol/sdk/types.js'
Running
pi(the Pi agent CLI, Unix-like system) fails withFailed to load extension ".../pi-mcp-adapter/index.ts": Cannot find module '@modelcontextprotocol/sdk/types.js', and the require stack points at@modelcontextprotocol/ext-apps/dist/src/app-bridge.js. No extension version is given in the thread. What causes this and how was it resolved?Originally asked on GitHub: https://github.com/nicobailon/pi-mcp-adapter/issues/285
3 answers
Status: explained — the issue is closed as completed, but this thread does not describe a fix or a release; it identifies the cause.
The error occurs while the Pi agent loads
pi-mcp-adapter/index.ts. The require stack shows@modelcontextprotocol/ext-apps/dist/src/app-bridge.jsfailing to resolve@modelcontextprotocol/sdk/types.jsfrom/home/user/.pi/agent/npm/node_modules/. One commenter diagnosed the root cause: the@modelcontextprotocol/sdkpackage was left out of the extension's dependencies (comment 3). Another commenter reported seeing the same failure in a past release and pointed to https://github.com/nicobailon/pi-mcp-adapter/issues/212 (opens external site), where a workaround was discussed at the time; that workaround is not reproduced in this thread, and no one here says it was applied or that it worked.This is general advice, not stated in the thread: since the missing module lives under the agent's
node_modulesdirectory, reinstalling the extension packages so the dependency tree is regenerated, or installing@modelcontextprotocol/sdkinto that samenode_modulespath, should allowtypes.jsto resolve. If that does not help, issue #212 is the place the commenter suggested looking for what was done the previous time.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
The reporter ran
piand got theFailed to load extension ... Cannot find module '@modelcontextprotocol/sdk/types.js'error.Source: https://github.com/nicobailon/pi-mcp-adapter/issues/285 (opens external site)
Did this work for you?What @max-miller1204 tried on GitHub (Outcome unclear)
A commenter said the same failure happened in a past release and linked issue #212, suggesting readers look through that issue for the workaround. The workaround itself is not included in this thread.
Did this work for you?
Related questions
- pi-mcp-adapter: per-server override in ~/.pi/agent/mcp.json wipes imported command/url
- How do I hot-load MCP direct tools in pi-mcp-adapter without reloading Pi?
- pi-mcp-adapter: compact TUI rendering for direct MCP tools?
- pi-mcp-adapter: huge MCP output hangs session, Esc can't abort — fixed upstream?
- Show which MCP tool is actually called when pi-mcp-adapter outputs only `mcp OK`