Skip to content

fix: exclude None fields in MCP Dynamic Client Registration request#35002

Open
samrusani wants to merge 1 commit intolanggenius:mainfrom
samrusani:fix/mcp-dynamic-registration-null-fields
Open

fix: exclude None fields in MCP Dynamic Client Registration request#35002
samrusani wants to merge 1 commit intolanggenius:mainfrom
samrusani:fix/mcp-dynamic-registration-null-fields

Conversation

@samrusani
Copy link
Copy Markdown
Contributor

@samrusani samrusani commented Apr 12, 2026

Summary

Use model_dump(exclude_none=True) instead of model_dump() when serializing client_metadata for OAuth Dynamic Client Registration. Strict MCP servers (e.g., GitLab) return HTTP 400 when optional fields are sent as JSON null. One-line change in api/core/mcp/auth/auth_flow.py.

Fixes #34857

Screenshots

N/A — backend-only change.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

From Claude Code

Strict MCP servers (e.g., GitLab) reject requests containing null
values for optional fields. Use model_dump(exclude_none=True) to
omit unset optional fields from the registration payload.

Closes langgenius#34857

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Dynamic Client Registration fails with 400 when server validates null fields

1 participant