Skip to content

fix(mcp): report the bound HTTP port - #3000

Open
Iams4kura wants to merge 2 commits into
upstash:masterfrom
Iams4kura:bugfix/report-bound-http-port-20260807t160340z
Open

fix(mcp): report the bound HTTP port#3000
Iams4kura wants to merge 2 commits into
upstash:masterfrom
Iams4kura:bugfix/report-bound-http-port-20260807t160340z

Conversation

@Iams4kura

Copy link
Copy Markdown

Summary

  • Fixes: Starting the MCP server with --transport http --port 0 successfully binds an ephemeral port, but the startup URL is logged as http://localhost:0/mcp and cannot be used to connect.
  • Root cause: The listening callback interpolates the requested port argument instead of reading the actual TCP address assigned by Node after the server starts listening.

Regression evidence

  • Before: npx -y pnpm@10 --filter @upstash/context7-mcp exec vitest run test/integration.test.ts -t 'reports the bound port when port zero requests an ephemeral port' exited 1

  • After: npx -y pnpm@10 --filter @upstash/context7-mcp exec vitest run test/integration.test.ts -t 'reports the bound port when port zero requests an ephemeral port' exited 0

Verification

  • npx -y pnpm@10 --filter @upstash/context7-mcp test
  • npx -y pnpm@10 build
  • npx -y pnpm@10 lint:check
  • npx -y pnpm@10 format:check
  • npx -y pnpm@10 typecheck

Scope

  • 3 files changed, +26 / -7 lines

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