Skip to content

Conversation

felixweinberger
Copy link
Contributor

Motivation and Context

The npx entry point (cli/src/cli.ts) was not generating or passing
authentication tokens, causing proxy authentication to fail when using
npx @modelcontextprotocol/inspector@latest.

This change aligns the npx behavior with the local development behavior:

  • Generate session token using crypto.randomBytes(32)
  • Pass MCP_PROXY_TOKEN to server via environment
  • Use correct SERVER_PORT instead of PORT
  • Build client URL with authentication parameters
  • Pass URL to client via INSPECTOR_URL environment variable

Now both npm run start and npx commands handle authentication
consistently.

How Has This Been Tested?

node cli/build/cli.js run locally:

CleanShot 2025-07-10 at 18 26 31@2x CleanShot 2025-07-10 at 18 26 28@2x

Breaking Changes

No.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Copy link

github-actions bot commented Jul 10, 2025

🎭 Playwright E2E Test Results

✅  12 passed

Details

12 tests across 1 suite
 19.6 seconds
 e552377
ℹ️  Test Environment: Ubuntu Latest, Node.js v22.17.0
Browsers: Chromium, Firefox

📊 View Detailed HTML Report (download artifacts)

The npx entry point (cli/src/cli.ts) was not generating or passing
authentication tokens, causing proxy authentication to fail when using
`npx @modelcontextprotocol/inspector@latest`.

This change aligns the npx behavior with the local development behavior:
- Generate session token using crypto.randomBytes(32)
- Pass MCP_PROXY_TOKEN to server via environment
- Use correct SERVER_PORT instead of PORT
- Build client URL with authentication parameters
- Pass URL to client via INSPECTOR_URL environment variable

Now both `npm run start` and `npx` commands handle authentication
consistently.
@felixweinberger felixweinberger force-pushed the fweinberger/npx-cli-fix branch from c5a31dd to e552377 Compare July 10, 2025 17:29
@felixweinberger felixweinberger marked this pull request as ready for review July 10, 2025 17:32
@cliffhall
Copy link
Member

Fixed with #604

@cliffhall cliffhall closed this Jul 10, 2025
@felixweinberger felixweinberger deleted the fweinberger/npx-cli-fix branch August 5, 2025 10:29
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.

2 participants