Skip to content

fix: PORT env leak, split usage cookie vars, fix vite proxy - #27

Merged
aterrylu merged 1 commit into
mainfrom
terry/env-fixes
Mar 14, 2026
Merged

fix: PORT env leak, split usage cookie vars, fix vite proxy#27
aterrylu merged 1 commit into
mainfrom
terry/env-fixes

Conversation

@aterrylu

Copy link
Copy Markdown
Owner

Summary

  • PORT env leak: Spawned Claude Code sessions inherited PORT=3100 from the server process, causing MCP OAuth callback to fail with "Port 3100 is already in use". Now stripped from child env.
  • Split cookie env vars: CLAUDE_SESSION_COOKIE replaced with separate CLAUDE_SESSION_KEY and CLAUDE_ORG_ID for clarity. Old combined format still works as fallback.
  • Vite proxy fix: Dev server was proxying to port 3000 instead of 3100.
  • Docs: Updated .env.example with warning to use .claude.ai cookies (not anthropic.com), added usage tracking section to README.

Test plan

  • Start session with MCP tools — OAuth callback should bind to a free port, not 3100
  • Usage tracking works with new CLAUDE_SESSION_KEY + CLAUDE_ORG_ID env vars
  • Usage tracking still works with old CLAUDE_SESSION_COOKIE format
  • Vite dev server proxies API/WS to :3100

🤖 Generated with Claude Code

- Strip PORT from spawned session env to prevent MCP OAuth port collision
- Split CLAUDE_SESSION_COOKIE into CLAUDE_SESSION_KEY + CLAUDE_ORG_ID
  with backward compat for the combined format
- Update .env.example with instructions to use .claude.ai cookies
  (not anthropic.com)
- Add usage tracking setup section to README
- Fix vite proxy target from port 3000 to 3100

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aterrylu
aterrylu enabled auto-merge (squash) March 14, 2026 00:03
@aterrylu
aterrylu merged commit 9257bd6 into main Mar 14, 2026
1 check passed
@aterrylu
aterrylu deleted the terry/env-fixes branch March 14, 2026 00:03
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.

1 participant