Skip to content

Expose vMCP scope authorization settings - #7446

Open
Sanskarzz wants to merge 1 commit into
stacklok:mainfrom
Sanskarzz:issue-6743-scope-config
Open

Sanskarzz wants to merge 1 commit into
stacklok:mainfrom
Sanskarzz:issue-6743-scope-config

Conversation

@Sanskarzz

Copy link
Copy Markdown
Collaborator

Summary

Clients needing different OAuth step-up responses can share one vMCP gateway URL, but the scope policy and response modes added in #7170 and #7190 were available only to Go embedders. Expose the final opt-in configuration through standalone YAML/CLI and the Kubernetes operator.

  • Add incomingAuth.scopeAuthorization with per-tool scope requirements, explicit scope implications, and http, tool-result, or auto response selection.
  • Keep HTTP 403 as the default. In auto, only explicitly configured exact client name/version pairs receive tool-result challenges; every other client falls back to HTTP 403.
  • Reuse the incoming OIDC resource URL for challenges and validate unsupported configurations before startup. Add optional CRD fields, admission validation, deep-copy conversion, generated artifacts, and deployment examples.

Fixes #6743

This is PR 3 of 3: #7170 added core scope authorization; #7190 added transport responses and discovery metadata; this PR makes those capabilities configurable in deployments.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests: focused Taskfile race suites for configuration, CLI, operator API/converter/controllers, and server scope behavior
  • Integration tests: all 116 vMCP operator envtest specs on Kubernetes 1.31
  • Linting: scoped task lint-fix (zero issues)
  • Generated deepcopy, CRDs, Helm wrappers, and CRD API reference
  • CRD schema compatibility against current main and v0.72.0; license check
  • Full task docs: CLI, Swagger, SDK, and chart generation passed with no additional generated changes

Tests cover flattened YAML/JSON configuration, independent copies, invalid resource/mode/profile/policy settings, unsupported execution paths and CLI flags, operator conversion and terminal status, schema admission, and existing mixed-client HTTP scope behavior.

API Compatibility

  • This PR does not break the v1beta1 API.

The new scope configuration is optional and has no CRD default. Existing objects retain their behavior. New constraints apply only when the new field is present.

Changes

Area Change
Unified configuration and CLI Reuse the core policy, share profile validation with the transport, validate effective CLI flags, and wire copied settings into the server
Operator Add optional scope configuration, bounded admission rules, deep-copy conversion, and terminal status for invalid resolved configuration
Generated API and documentation Update deepcopy code, CRDs, API reference, architecture, and standalone/operator examples
Tests Cover configuration round-trips and ownership, startup validation, operator conversion/status, and Kubernetes admission

Does this introduce a user-facing change?

Yes. Standalone and operator deployments can opt into incoming-token scope authorization for direct tools. Without the field, authorization is unchanged. HTTP 403 is the default; tool-result forces an error tool result, and auto supports both client response types on one gateway URL.

Implementation plan

Approved implementation plan
  1. Keep authorization in the core from Enforce incoming scopes in the vMCP core #7170 and refusal rendering in the transport from Add per-client vMCP scope challenge responses #7190.
  2. Expose a shared, optional scope configuration under incoming authentication, reusing the core policy and exact client profiles.
  3. Require OIDC and a canonical gateway resource URL; reject optimizer, embedding optimization, enabled code mode, and composite execution paths.
  4. Wire standalone and operator configuration, preserving defaults and ownership. Add schema validation and regenerate API artifacts.
  5. Add regression coverage and document configuration, response selection, and client testing requirements.

Special notes for reviewers

  • Profiles select encoding only. Current validated token claims and Cedar still determine access; no built-in or inferred client profiles are added.
  • Runtime configuration requires incomingAuth.oidc.resource. Operator deployments use the resource resolved from oidcConfigRef; examples set its public resourceUrl explicitly. Audience is not a resource fallback.
  • The authoritative operator field is spec.incomingAuth.scopeAuthorization; the overwritten spec.config.incomingAuth.scopeAuthorization location is rejected.
  • This enforces incoming-token requirements. It does not forward arbitrary backend authentication challenges or retry refused calls. Real ChatGPT/Codex UI behavior still needs testing with the deployed issuer and exact client releases.

Make the scope policy and response modes available to standalone and operator deployments. Keep HTTP challenges as the default, share validation with the transport, and reject unsupported execution paths before startup.

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.82%. Comparing base (6d6ace5) to head (23c7751).

Files with missing lines Patch % Lines
pkg/vmcp/cli/serve.go 88.23% 2 Missing ⚠️
pkg/vmcp/config/validator.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7446      +/-   ##
==========================================
+ Coverage   82.80%   82.82%   +0.01%     
==========================================
  Files         949      950       +1     
  Lines       98157    98207      +50     
==========================================
+ Hits        81277    81336      +59     
+ Misses      16875    16866       -9     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

MCPServerEntry response headers get swallowed by VirtualMCPServer

1 participant