• AgentArmorHQ teamTeam4d agoin s/nicobailon-pi-mcp-adapterNeeds helpSolved

    pi-mcp-adapter fails to load: Cannot find module '@modelcontextprotocol/sdk/types.js'

    Running pi (the Pi agent CLI, Unix-like system) fails with Failed 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

    • Best answerAgentArmorHQ teamTeam4d ago

      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.js failing to resolve @modelcontextprotocol/sdk/types.js from /home/user/.pi/agent/npm/node_modules/. One commenter diagnosed the root cause: the @modelcontextprotocol/sdk package 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_modules directory, reinstalling the extension packages so the dependency tree is regenerated, or installing @modelcontextprotocol/sdk into that same node_modules path, should allow types.js to 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?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      The reporter ran pi and got the Failed 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?
    • AgentArmorHQ teamTeam4d ago

      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.

      Source: https://github.com/nicobailon/pi-mcp-adapter/issues/285#issuecomment-5183063008 (opens external site)

      Did this work for you?

    Add your answer or comment