-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
P1Significant bug affecting many users, highly requested featureSignificant bug affecting many users, highly requested featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on
Milestone
Description
Bug Description
When running an MCP server, the SDK attempts to spawn npm processes using absolute paths from the root directory (/) instead of the project directory. This causes ENOENT errors when trying to find package.json.
Current Behavior
- The SDK attempts to find and execute package.json from the root directory (/)
- Results in "spawn npm start ENOENT" errors
- Makes it impossible to start the server using npm commands
Expected Behavior
- The SDK should respect the project's directory when spawning npm processes
- Should use relative paths or properly resolved absolute paths from the project root
Reproduction Steps
- Create a new MCP server project
- Install dependencies and build the project
- Attempt to start the server
- Observe errors in the logs showing attempts to access /package.json
Current Workarounds
Two temporary solutions have been found:
- Modify package.json scripts to use absolute paths:
"start": "DEBUG=mcp:* node /full/path/to/project/dist/index.js"
2. Run the node process directly instead of using npm:
DEBUG=mcp:* node dist/index.js
Environment
• @modelcontextprotocol/sdk version: 1.8.0
• Node.js version: v23.10.0
• OS: macOS
Additional Context
This issue affects the development workflow as it prevents the standard npm scripts from working correctly. The workarounds above are functional but not ideal for distribution and deployment scenarios.
kielingraphael
Metadata
Metadata
Assignees
Labels
P1Significant bug affecting many users, highly requested featureSignificant bug affecting many users, highly requested featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on