mirror of
https://github.com/langgenius/dify.git
synced 2026-05-09 21:28:25 +08:00
fix(mcp): exclude null fields from Dynamic Client Registration payload
`OAuthClientMetadata.model_dump()` serializes optional `None` fields
(e.g. `scope`, `client_uri`) as JSON `null`. Some MCP servers that
perform strict validation on the registration payload (e.g. GitLab MCP)
reject the request with 400 Bad Request:
{"error":"invalid_client_metadata","error_description":"expected string, received null"}
Using `model_dump(exclude_none=True)` omits unset optional fields from
the JSON body, which conforms to RFC 7591 (OAuth 2.0 Dynamic Client
Registration) where absent fields should use server defaults.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
41eeb1f2e7
commit
2114894118
@ -527,7 +527,7 @@ def register_client(
|
||||
|
||||
response = ssrf_proxy.post(
|
||||
registration_url,
|
||||
json=client_metadata.model_dump(),
|
||||
json=client_metadata.model_dump(exclude_none=True),
|
||||
headers={"Content-Type": "application/json"},
|
||||
)
|
||||
if not response.is_success:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user