mcp-auth-proxy icon indicating copy to clipboard operation
mcp-auth-proxy copied to clipboard

DCR registration response returns null grant_types/response_types (breaks RFC 7591-strict clients like LM Studio)

Open cmatte opened this issue 6 months ago • 0 comments

Summary

POST /.idp/register (Dynamic Client Registration) returns grant_types and response_types as null — and token_endpoint_auth_method as "" — when the client's registration request omits them. Per RFC 7591 these should default to ["authorization_code"] and ["code"]. Clients that strictly validate the registration response (e.g. LM Studio, whose Zod schema requires arrays) reject it and cannot connect. Lenient clients (Claude, etc.) tolerate the nulls, which is likely why the "verified" clients don't hit this.

Reproduction

Register a client without specifying grant_types / response_types (this is what LM Studio sends):

curl -sS -X POST https://<proxy-host>/.idp/register \
  -H 'content-type: application/json' \
  -d '{"client_name":"test","redirect_uris":["http://localhost:1234/callback"]}'

Actual response (HTTP 201)

{
  "client_id": "…",
  "client_secret": "…",
  "redirect_uris": ["http://localhost:1234/callback"],
  "client_name": "test",
  "grant_types": null,
  "response_types": null,
  "token_endpoint_auth_method": "",
  "registration_client_uri": "/.idp/register/…",
  "client_id_issued_at": 1780531527
}

Expected (RFC 7591 §2 & §3.2.1 defaults)

{
  "grant_types": ["authorization_code"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "client_secret_basic"
}

Client-side failure (LM Studio 0.4.x)

[MCPServerSession] Streamable HTTP MCP connect failed ... ZodError: [
  { "expected": "array", "code": "invalid_type", "path": ["grant_types"],
    "message": "Invalid input: expected array, received null" },
  { "expected": "array", "code": "invalid_type", "path": ["response_types"],
    "message": "Invalid input: expected array, received null" }
]

Suggested fix

When a DCR request omits grant_types / response_types, apply the RFC 7591 defaults (["authorization_code"], ["code"]) before persisting and in the returned object, and return a concrete token_endpoint_auth_method instead of "". The authorization-server metadata is already correct (grant_types_supported: ["authorization_code","refresh_token"], response_types_supported: ["code"]) — only the DCR registration response is non-compliant.

Environment

  • mcp-auth-proxy: ghcr.io/sigbit/mcp-auth-proxy:latest (image built 2026-05-08)
  • Failing client: LM Studio 0.4.15 (strict RFC 7591 response validation)
  • Working clients: Claude web/desktop/mobile (tolerant of the null fields)

cmatte avatar Jun 04 '26 00:06 cmatte