Skip to content

[MCP] Server crashes on initialization due to dotenv logging to stdout #9

@luvjapanmusic

Description

@luvjapanmusic

Describe the bug
The MakerKit CLI MCP server violates the Model Context Protocol (MCP) by outputting plain text logs to stdout during initialization.
While some MCP clients might be lenient, the MCP specification strictly requires stdout to be reserved for JSON-RPC messages. Any additional text injected into the stream will cause protocol errors in strictly-compliant MCP clients (such as Google’s Antigravity IDE).
The error encountered is:
invalid character 'd' looking for beginning of value (Attempting to parse '[dotenv...' as JSON).
Root Cause 1: dotenv stdout pollution
The dotenv package (used in src/mcp.ts and src/index.ts) outputs initialization logs to stdout when executed in a directory without a .env.local file:
[dotenv@17.2.4] injecting env (0) from .env.local -- tip: ...
Because developers usually have .env.local files, this issue may remain hidden during testing. However, for a user starting a new project, this log is printed and breaks the standard MCP communication channel.
Root Cause 2: Hardcoded CLI Version
Running makerkit -v on @makerkit/cli@2.0.2 still outputs 2.0.0-beta.1. This is confirmed by checking src/version.ts:

export const CLI_VERSION = "2.0.0-beta.1";

To Reproduce

  1. Run the MCP server in a directory where NO .env.local file exists.
  2. Verify output via terminal: npx --yes --quiet @makerkit/cli@latest makerkit-cli-mcp
  3. Observe that [dotenv...] is printed to stdout before the server waits for stdin. This output corrupts the JSON-RPC stream.
    Expected behavior
  • All non-JSON output must be suppressed or redirected to stderr. dotenv should be configured to be quiet or logs should be intercepted.
  • CLI_VERSION should match the actual package version.
    Environment:
  • OS: macOS
  • Package Version: @makerkit/cli@2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions