Repository navigation
Description
Is your feature request related to a problem? Please describe.
The current MCP TypeScript SDK implementation of OAuth 2.0 Dynamic Client Registration does not support initial access tokens, which limits deployment flexibility for enterprise use cases. According to RFC 7591, authorization servers may optionally restrict client registration to only previously authorized parties using initial access tokens.
While open registration is perfectly acceptable for consumer applications and development scenarios, enterprise deployments often require this additional security layer. Without this optional support, enterprise MCP servers must either:
- Implement custom workarounds outside the standard OAuth flow
- Use third-party solutions
- Pre-register all clients manually (defeats the purpose of dynamic registration)
This limitation prevents enterprise-grade deployments while maintaining current open registration capabilities for consumer applications.
Describe the solution you'd like
Add optional support for initial access tokens in the dynamic client registration flow. The implementation should:
-
Provide an easy configuration method such as:
- Environment variables (e.g.,
MCP_INITIAL_ACCESS_TOKEN,OAUTH_INITIAL_ACCESS_TOKEN) - Configuration files
- Constructor parameters
- Other standard configuration approaches
- Environment variables (e.g.,
-
Maintain backward compatibility - existing code should continue to work without changes
-
Follow RFC 7591 specification - when an initial access token is provided, include it as a Bearer token in the Authorization header of the registration request:
Authorization: Bearer <initial_access_token> -
Handle missing tokens gracefully - when no token is provided, proceed with open registration (normal behavior for consumer apps)
-
Provide clear error handling for cases where tokens are invalid (but remember that missing tokens are expected and valid for consumer apps)
Describe alternatives you've considered
- Custom middleware: Implementing initial access token validation as separate middleware, but this breaks the standard OAuth flow
- Third-party solutions: Using external libraries, but this adds complexity and dependencies
- Pre-registration: Manually registering all clients, but this eliminates the benefits of dynamic registration
- Open registration only: This works for consumer applications but doesn't meet enterprise security requirements
Additional context
- RFC 7591 compliance: The OAuth 2.0 Dynamic Client Registration Protocol supports initial access tokens as an optional feature for restricting registration access
- Enterprise flexibility: This provides an optional security layer for enterprise deployments without impacting consumer applications
- Industry standard: Authorization servers like Auth0, Keycloak, and others already support this feature
- Deployment options: This enables both open registration (consumer apps) and restricted registration (enterprise) from the same codebase
Implementation considerations
The maintainers can choose the most appropriate implementation approach, but it should be easy for developers to configure, such as:
- Setting an environment variable
- Adding a configuration option
- Providing the token through existing configuration mechanisms
Expected behavior
When an initial access token is configured:
- Include it as
Authorization: Bearer <token>in the registration request - Handle 401/403 responses appropriately when tokens are invalid
When no initial access token is configured:
- Proceed with open registration (current behavior)
- Maintain full backward compatibility
This enhancement would provide deployment flexibility for both consumer applications and enterprise deployments while bringing the TypeScript SDK closer to full RFC 7591 compliance.
Activity
pcarleton commentedon Jul 16, 2025
Hi @andormarkus could you share a little more about the scenario you're trying to unblock?
I agree this is supported in the RFC, but I'm uncertain of the benefit it provides. When I've considered this before, if an AS needs to distribute this initial access token, why not distribute a client ID/secret instead (i.e. pre-register that client)?
andormarkus commentedon Jul 16, 2025
Hi @pcarleton! Great question - I totally understand the confusion since on the surface they seem like they'd solve similar problems. Let me walk through the specific scenario that led me to implement this feature and why I've found initial access tokens work better than pre-registration for our use case.
The Challenge We're Facing
We're building a B2B MCP product where enterprise customers typically need multiple MCP clients per organization. For example:
With pre-registration, we'd end up manually creating and securely distributing 35+ different client credentials. That quickly becomes a lot of manual work on our end!
Why Initial Access Tokens vs Pre-registration
The Core Issue: Pre-registering clients moves us away from the self-service aspect that makes DCR so valuable in the first place.
Current workflow (pre-registration approach):
What we're hoping to enable (with initial access tokens):
Technical and Operational Benefits
Enhanced Security Model:
Operational Efficiency:
Standards Compliance:
RFC 7591 actually designed initial access tokens for exactly this scenario:
Industry Precedent:
Auth0, Keycloak, and Azure AD all support this pattern for multi-tenant enterprise deployments. This is the standard way to handle "public internet but controlled registration."
Our Specific Requirements
We're building a product that's:
Without initial access tokens, we're forced to choose between:
Implementation Details
I've implemented this in PR #773 for TypeScript and PR #1154 for Python. The implementation provides:
When an initial access token is configured, my implementation includes it as
Authorization: Bearer <token>in the registration request. When no token is configured, it proceeds with open registration (current behavior).Summary
This is why I implemented initial access token support in both the TypeScript and Python SDKs. It solves the "controlled self-service" problem that pure pre-registration cannot, enabling DCR's automation benefits while maintaining enterprise security controls - exactly what RFC 7591 designed this feature for.
Really appreciate you taking the time to review this! Happy to clarify any implementation details or adjust the approach based on your feedback.
feat(client): add initial access token support for Dynamic Client Reg…
pcarleton commentedon Apr 14, 2026
We've started recommending CIMD as a preferred alternative to DCR. I'll close this issue, but if you still need access token support on DCR endpoints, please re-open. The referenced PR #1874 is a good approach, but it's not clear to me if there is still demand for this.