Fix: Startup banner corrupts stdio JSON-RPC stream#8
Merged
Conversation
ProgramComputer
added a commit
that referenced
this pull request
Jul 4, 2026
Fix: Startup banner corrupts stdio JSON-RPC stream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When starting up Claude desktop which also starts the MCP server at the same time, the MCP server fails to connect when using the npx method, throwing:
Unexpected token '◇', "◇ injected"... is not valid JSONRoot cause
Looking at the
package.json, the json declared"dotenv": "", which is an empty version range that floats to the latest dotenv on every fresh install. Fresh installs (e.g. npx -y @programcomputer/nasa-mcp-server@latest) resolve dotenv v17+, which prints a startup banner to stdout by default:◇ injected env (1) from .env // tip: ...A stdio MCP server uses stdout exclusively as its JSON-RPC channel, so this banner corrupts the stream and the client fails to parse the handshake. The committed lockfile pinned the older, silent dotenv 16.4.7, which masked the issue in local development.
Changes
dotenvto^17.2.0so the version no longer silently floats.quiet: trueto everydotenv.config()call to suppress the v17 banner:src/utils/api-client.ts(4 calls) — imported byindex.ts, so its top-level calls run at startup and were the primary culpritsrc/index.ts(1 call)src/utils/env-setup.ts(4 calls)Verification
I have locally built the updated source code and piped a MCP
initializerequest intodist/index.jswith a.envpresent and verified that the error message does not appear when starting Claude.