Skip to content

fix(mcp): declare @modelcontextprotocol/sdk as a root dependency (#231) - #232

Merged
jung-thomas merged 1 commit into
mainfrom
fix/231-mcp-sdk-dependency
Sep 5, 2026
Merged

fix(mcp): declare @modelcontextprotocol/sdk as a root dependency (#231)#232
jung-thomas merged 1 commit into
mainfrom
fix/231-mcp-sdk-dependency

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Fixes #231.

Problem

The hana-cli-mcp bin (./mcp-server/build/index.js) imports @modelcontextprotocol/sdk, but the package only declared it in the nested mcp-server/package.json. npm strips nested node_modules from the published tarball, so registry installs can't resolve it and crash at module resolution — before any config or HANA connection:

$ npx -y -p hana-cli hana-cli-mcp < /dev/null
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@modelcontextprotocol/sdk'
  imported from .../node_modules/hana-cli/mcp-server/build/index.js

It only worked in a dev checkout, where the nested install made it reachable.

Fix

Add @modelcontextprotocol/sdk@^1.29.0 (the range mcp-server was built against) to the root dependencies. Node's upward module resolution from mcp-server/build/index.js then finds it in the root node_modules of any install. npm-shrinkwrap.json updated accordingly.

Verification

Reproduced the published-tarball state by temporarily removing mcp-server/node_modules, then ran the bin exactly as the issue does:

$ node ./mcp-server/build/index.js < /dev/null
[DocsSearch] Loaded index with 272 documents
[MCP] Loaded 170 command modules from hana-cli
[MCP] Registered 170 unique commands
[MCP] SAP HANA CLI MCP Server running on stdio
EXIT=0

Boots cleanly instead of throwing ERR_MODULE_NOT_FOUND.

The hana-cli-mcp bin (mcp-server/build/index.js) imports
@modelcontextprotocol/sdk, but it was only declared in the nested
mcp-server/package.json. npm strips nested node_modules from the
published tarball, so registry installs fail at module resolution with
ERR_MODULE_NOT_FOUND before any config is read (npx, MCP clients).

Add @modelcontextprotocol/sdk@^1.29.0 to root dependencies so Node's
upward resolution from mcp-server/build/index.js finds it in the root
node_modules of an install.

Fixes #231
@jung-thomas
jung-thomas merged commit e30e505 into main Sep 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hana-cli-mcp cannot start: @modelcontextprotocol/sdk is imported but not declared as a dependency

1 participant