Skip to content

feat(mcp): add protected HTTP MCP server support#47

Open
frederikprijck wants to merge 1 commit into
mainfrom
feat/mcp-auth
Open

feat(mcp): add protected HTTP MCP server support#47
frederikprijck wants to merge 1 commit into
mainfrom
feat/mcp-auth

Conversation

@frederikprijck

Copy link
Copy Markdown
Member

Summary

Adds support for protected HTTP MCP servers — servers that require an Authorization: Bearer token rather than being publicly reachable (e.g. the Auth0 hosted MCP server, which authenticates with a Management API token).

This is the auth-plumbing layer only. The calledTool/calledToolOneOf trace-based grader primitives and the hosted_mcp_list_applications eval that build on top of it are intentionally left for a follow-up PR.

What's included

  • mintMcpToken — per-job client-credentials token mint for HTTP MCP servers (minted per job so a long matrix run never reuses an expired token).
  • MCPHttpServerConfig.auth — new optional auth block (tokenUrl / clientId / clientSecret / audience) typed as MCPOAuthConfig.
  • All four runners forward the token: claude-code, copilot, and gemini-cli set an Authorization: Bearer header on the MCP server config; codex writes a bearer_token_env_var reference into config.toml and injects the token into its process env (an inline bearer_token is rejected by Codex, so the secret stays out of the file).
  • Loud failure — a failed token mint skips the server with a logger.warn rather than registering it unauthenticated.
  • sandbox.passthroughEnv — forward named host env vars into the Docker sandbox (names only; values resolved from process.env at launch) so MCP credentials reach the container.
  • docs/PROTECTED_MCP.md — setup guide (prerequisites, env vars, config, how minting/forwarding works, troubleshooting).

Test plan

  • npm run build passes
  • npm test passes (697 tests)
  • npm run lint passes
  • Manual: run an eval with --tools mcp against a protected server with MCP_TENANT_DOMAIN/MCP_CLIENT_ID/MCP_CLIENT_SECRET set and confirm the token is minted and forwarded for each runner

Adds OAuth-protected HTTP MCP server support so evals can target servers
that require an Authorization: Bearer token (e.g. the Auth0 hosted MCP
server, which authenticates with a Management API token).

- mintMcpToken: per-job client-credentials token mint for HTTP MCP servers
- MCPHttpServerConfig.auth (tokenUrl/clientId/clientSecret/audience)
- All four runners forward the minted token: claude-code, copilot, and
  gemini-cli set an Authorization header on the server config; codex writes
  a bearer_token_env_var reference into config.toml and injects the token
  into its process env (an inline bearer_token is rejected by codex)
- A failed token mint skips the server with a warning rather than
  registering it unauthenticated
- sandbox.passthroughEnv: forward named host env vars into the Docker
  sandbox so MCP credentials reach the container
- docs/PROTECTED_MCP.md setup guide
@frederikprijck frederikprijck marked this pull request as draft June 16, 2026 13:38
@frederikprijck frederikprijck marked this pull request as ready for review June 17, 2026 15:40
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