Package com.tnsai.mcp.auth
Class McpClientRegistration
java.lang.Object
com.tnsai.mcp.auth.McpClientRegistration
RFC 7591 Dynamic Client Registration for MCP OAuth.
Enables MCP clients to dynamically register with an OAuth authorization server without manual client registration. This is useful for public MCP clients that need to authenticate with servers discovered at runtime.
Usage:
RegistrationRequest request = new RegistrationRequest(
"TnsAI MCP Client",
List.of("http://localhost:8080/callback"),
List.of("authorization_code"),
List.of("code"),
"none"
);
RegistrationResponse response = McpClientRegistration.register(
"https://auth.example.com/register",
request
);
String clientId = response.clientId();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordClient registration request as defined by RFC 7591.static final recordClient registration response as defined by RFC 7591. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionregister(String registrationEndpoint, McpClientRegistration.RegistrationRequest request) Registers a client with the OAuth authorization server.
-
Constructor Details
-
McpClientRegistration
public McpClientRegistration()
-
-
Method Details
-
register
public static McpClientRegistration.RegistrationResponse register(String registrationEndpoint, McpClientRegistration.RegistrationRequest request) throws IOException Registers a client with the OAuth authorization server.- Parameters:
registrationEndpoint- the dynamic client registration endpointrequest- the registration request- Returns:
- the registration response with assigned client credentials
- Throws:
IOException- if the registration request fails
-