Skip to content

Support Conditional OAuth Validation for Internal vs External Clients #622

@vengateshganesangv

Description

@vengateshganesangv

Description:
Currently, the Apollo MCP Server enforces OAuth 2.1 authentication for all incoming client connections according to the MCP Authorization Specification. This requires every client to provide a valid OAuth token or go through the OAuth flow.

We have two configurations currently:

  1. Skip OAuth completely (for internal/local usage):
schema:
  source: local
  path: /data/schema/schema.graphql
operations:
  source: local
  paths:
    - /data/operations/query/applicationById.graphql
transport:
  type: streamable_http
  address: 0.0.0.0
  port: 5000
forward_headers:
  - Authorization
endpoint: http://api-endpoint:8080/graphql
  1. Enforce OAuth (for external clients):
transport:
  type: streamable_http
  auth:
    servers:
      - https://auth.example.com
    audiences:
      - https://api.example.com
      - https://mcp.example.com

Use Case / Problem:

We have real-time applications with internal MCP clients (e.g., chatbots) that are accessed after login to the main application. These internal clients do not need to go through the OAuth flow again.

However, external clients (e.g., VS Code, Claude) connecting to the same MCP server should follow the standard OAuth flow.

Proposed Feature:

Introduce an option called allow_external_auth_header inside auth field in yaml config to conditionally enforce OAuth validation:

If allow_external_auth_header is true→ skip OAuth validation.

If allow_external_auth_header header is false→ initiate standard OAuth flow.

transport:
  type: streamable_http
  auth:
    servers:
      - https://auth.example.com
    allow_external_auth_header: true //Default to false
    audiences:
      - https://api.example.com
      - https://mcp.example.com
    forward_headers:
       - Authorization

This would allow MCP servers to support both internal trusted clients and external clients securely. As if we have token exchange also in place before hit actual API so any way it will be secure for internal clients too.

References / Notes:

FastMCP already supports this feature for conditional OAuth enforcement in the middleware.

This would improve developer experience for internal applications while maintaining security for external access.

Currently, there is no way to conditionally enforce OAuth validation based on the presence of the Authorization header. FastMCP supports this feature, allowing internal clients to bypass OAuth if they already provide a valid authorization header.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions