Skip to content

Conversation

@mattpodwysocki
Copy link
Contributor

This PR adds Cursor and VS Code integration documentation and fixes the MCP stdio transport logging issue
that was causing JSON-RPC communication errors.

Problem

The MCP DevKit Server was outputting logs to stdout/stderr when using stdio transport, corrupting the
JSON-RPC protocol. This was caused by two issues:

  1. Environment variable mismatch: Code checked MCP_DISABLE_LOGGING but scripts used
    MCP_LOGGING_DISABLE
  2. OpenTelemetry diagnostic logger: OTEL's internal diagnostic logger was writing to stdout/stderr

Solution

  • Fixed environment variable checking to support both MCP_DISABLE_LOGGING and MCP_LOGGING_DISABLE for
    backwards compatibility
  • Suppressed OpenTelemetry diagnostic logger at module load time
  • Added OTEL_LOG_LEVEL environment variable for debugging OTEL issues when needed

New Documentation

Added comprehensive integration guides for:

  • Cursor IDE (docs/cursor-integration.md)
  • VS Code with GitHub Copilot (docs/vscode-integration.md)

Both guides include:

  • NPM, Docker, and Node setup options
  • Proper stdio logging configuration (MCP_LOGGING_DISABLE=true)
  • Troubleshooting sections
  • Example usage prompts
  • Token scope requirements

Changes

Core Fixes

  • src/index.ts: Updated logging checks to support both MCP_DISABLE_LOGGING and
    MCP_LOGGING_DISABLE
  • src/utils/tracing.ts: Added OTEL diagnostic logger suppression at module load time

Documentation

  • docs/cursor-integration.md: New Cursor IDE integration guide
  • docs/vscode-integration.md: New VS Code integration guide
  • README.md: Added links to new integration docs
  • .env.example: Documented OTEL_LOG_LEVEL variable
  • CLAUDE.md: Added OTEL_LOG_LEVEL to environment variables section

Updated Existing Docs

  • docs/claude-code-integration.md: Already had correct MCP_LOGGING_DISABLE usage
  • docs/claude-desktop-integration.md: Already had correct MCP_LOGGING_DISABLE usage

Testing

Verify Stdio Transport Fix

  1. Build the project:
    npm run build
    
  2. Run the MCP inspector with logging disabled:
    npm run inspect:build
  3. Expected: No OpenTelemetry or console logs should appear in stdio output, JSON-RPC communication
    should work cleanly
  4. Verify backwards compatibility by testing both environment variables:

Test with MCP_LOGGING_DISABLE

MCP_LOGGING_DISABLE=true node dist/esm/index.js

Test with MCP_DISABLE_LOGGING

MCP_DISABLE_LOGGING=true node dist/esm/index.js

Verify New Integration Docs

  1. Follow setup instructions in docs/cursor-integration.md with Cursor IDE
  2. Follow setup instructions in docs/vscode-integration.md with VS Code
  3. Verify server appears in respective IDE's MCP tools/servers list
  4. Test a simple tool execution (e.g., "list all my Mapbox styles")

Verify OTEL Diagnostic Logging

  1. With OTEL endpoint configured but logging suppressed:
    OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 npm run inspect:build
  2. Expected: No OTEL diagnostic output to stdio
  3. Enable OTEL logging for debugging:
    OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 OTEL_LOG_LEVEL=ERROR npm run inspect:build
  4. Expected: OTEL errors visible (if endpoint not reachable)

Run Test Suite

npm test
Expected: All 276 tests pass ✅

Run Linter

npm run lint
Expected: No errors (only pre-existing any type warnings)

Run inspector and no errors:
Screenshot 2025-11-05 at 10 03 34

Checklist

  • Code has been tested locally
  • Unit tests have been added or updated
  • Documentation has been updated if needed

Additional Notes

@mattpodwysocki mattpodwysocki requested a review from a team as a code owner November 5, 2025 15:03
zmofei
zmofei previously approved these changes Nov 5, 2025
jussi-sa
jussi-sa previously approved these changes Nov 5, 2025
@mattpodwysocki mattpodwysocki dismissed stale reviews from jussi-sa and zmofei via 2c0a763 November 5, 2025 16:12
@mattpodwysocki mattpodwysocki merged commit 7201837 into main Nov 5, 2025
1 check passed
@mattpodwysocki mattpodwysocki deleted the otel_docs_fix branch November 5, 2025 20:49
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.

3 participants