auchenberg / auchenberg/claude-code-mcp
npm E404 error for 'codemcp' after client initialize message causes server crash
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm encountering an issue where the claude-code-mcp server crashes shortly after a client (Claude desktop app) successfully connects and sends the initialize message.
Symptoms:
The server starts successfully using npm start (Claude Code MCP server started message appears).
The Claude desktop client connects to the server (ws://localhost:3005).
The server logs show the initialize message being received from the client.
Immediately after the initialize message, the server attempts to run an npm command to fetch a package named codemcp.
This results in an npm error code E404 / npm error 404 Not Found - GET https://registry.npmjs.org/codemcp because this package does not exist in the public npm registry.
Due to the npm error, the server process exits unexpectedly, and the connection to the client is closed.
Steps to Reproduce:
Clone the repository.
Run npm install and npm run build.
Run npm start.
Configure the Claude desktop app to use the local MCP server at ws://localhost:3005.
Observe the server logs in the terminal.
Expected Behavior:
The server should successfully process the initialize message and remain running, ready for further communication with the Claude client. It should not attempt to install external npm packages during runtime after initialization.
Actual Behavior:
The server crashes due to an npm E404 error while trying to fetch a non-existent package codemcp immediately after client initialization.
Environment:
OS: macOS 14.5 (Intel Core i9)
Node.js: v20.12.2 (Managed via ASDF)
npm: v10.5.0
Relevant Log Snippet:
2025-04-18T00:52:51.706Z [codemcp] [info] Initializing server...
2025-04-18T00:52:51.871Z [codemcp] [info] Server started and connected successfully
2025-04-18T00:52:52.457Z [codemcp] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/codemcp - Not found
npm error 404
npm error 404 'codemcp@*' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: /Users/office/.npm/_logs/2025-04-18T00_52_52_180Z-debug-0.log
2025-04-18T00:52:54.805Z [codemcp] [info] Server transport closed
2025-04-18T00:52:54.806Z [codemcp] [info] Client transport closed
2025-04-18T00:52:54.806Z [codemcp] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log.
2025-04-18T00:52:54.806Z [codemcp] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-04-18T00:52:54.807Z [codemcp] [info] Client transport closed
Contributor guide
Research direction
Run npm install, npm run build, and npm start, then trace the server path handling the client’s initialize message and the subsequent npm request for codemcp. Confirm where the runtime package lookup is triggered and remove or correct that behavior without disrupting initialization. Done means the server remains running after initialization and the client connection stays open without an npm E404.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100