Skip to content

fix(mcp): resolve every tool's secrets to plaintext so GUI IDEs authenticate - #263

Merged
jeff-r2026 merged 1 commit into
mainfrom
fix/mcp-all-plaintext
Jul 29, 2026
Merged

fix(mcp): resolve every tool's secrets to plaintext so GUI IDEs authenticate#263
jeff-r2026 merged 1 commit into
mainfrom
fix/mcp-all-plaintext

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Context

Follow-up to #262. That PR merged only the first commit (CodeBuddy-only plaintext); the "all tools plaintext" change did not land on main. So cursor still writes ${env:VAR} and codex still writes bearer_token_env_var — both of which a GUI-launched tool cannot resolve (no shell env), producing the same 401 CodeBuddy had.

Fix

Make supportsEnvExpansion always false — every tool, every scope resolves the secret to its value and writes it verbatim. The token is then present no matter how the tool is started. Removes the now-dead codexCanNameEveryVar helper.

tool before after
Claude (project) ${VAR} plaintext
Cursor ${env:VAR} plaintext
Codex bearer_token_env_var plaintext (http_headers)
CodeBuddy plaintext (#262) plaintext

Docs (both languages) warn that project-scope MCP configs now carry the literal secret and must be gitignored.

Test Plan

  • npx tsc --noEmit — clean
  • npm run build — success
  • npx vitest run — 1827 passed, 0 failed
  • Project-secret and codex tests assert plaintext Bearer <token> in every tool.
  • End-to-end (teamai pull in a real project): .mcp.json, .cursor/mcp.json, .codebuddy/mcp.json all contain resolved Bearer <token>, no ${} anywhere.
  • Backend probe with the resolved token: POST /api/ai/mcpHTTP 200.

🤖 Generated with Claude Code

Env-var passthrough was tried per tool (claude project scope, cursor ${env:},
codex bearer_token_env_var, codebuddy ${VAR}), but each tool expands variables
under different, fragile conditions. The decisive one: IDEs launched from the
GUI never inherit the user's shell exports, so a ${VAR} placeholder resolves to
empty and the server 401s.

Make supportsEnvExpansion always false so every tool/scope resolves the secret
to plaintext and writes it verbatim. The token is then present regardless of
how the tool is launched. Drop the now-dead codexCanNameEveryVar helper. Docs
warn that project-scope MCP configs now carry the literal secret and must be
gitignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jeff-r2026
jeff-r2026 merged commit 86cedf0 into main Jul 29, 2026
6 checks passed
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