Skip to content

fix(core): Add required field validation to MCP OAuth client registration#28490

Open
JoseBra wants to merge 1 commit intomasterfrom
ai-2267-community-issue-silent-failures-on-requests-to-mcp
Open

fix(core): Add required field validation to MCP OAuth client registration#28490
JoseBra wants to merge 1 commit intomasterfrom
ai-2267-community-issue-silent-failures-on-requests-to-mcp

Conversation

@JoseBra
Copy link
Copy Markdown
Contributor

@JoseBra JoseBra commented Apr 14, 2026

Summary

  • Add validation for client_name, grant_types, and redirect_uris in the MCP OAuth client registration endpoint (/mcp-oauth/register)
  • Previously, requests with missing required fields silently succeeded but the DB insert failed on NOT NULL constraints, resulting in phantom client_ids that couldn't be used
  • Add 3 test cases covering each missing field scenario

Related Linear tickets, Github issues, and Community forum posts

closes #27293
Linear Reference: https://linear.app/n8n/issue/AI-2267

Review / Merge checklist

  • PR title and summary are descriptive
  • Tests included
  • I have seen this code, I have run this code, and I take responsibility for this code.

…tion

Previously, POST /mcp-oauth/register silently accepted requests with
missing client_name, grant_types, or redirect_uris. The DB NOT NULL
constraint would fail but no error was returned to the client, leading
to phantom client_ids that couldn't be used.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/modules/mcp/mcp-oauth-service.ts 63.63% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@JoseBra JoseBra marked this pull request as ready for review April 14, 2026 15:58
@github-actions
Copy link
Copy Markdown
Contributor

Performance Comparison

Comparing currentlatest master14-day baseline

docker-stats

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
docker-image-size-runners 393.00 MB 393.00 MB 391.63 MB (σ 11.06) +0.0% +0.3%
docker-image-size-n8n 1269.76 MB 1269.76 MB 1269.76 MB (σ 0.00) +0.0% +0.0%

Idle baseline with Instance AI module loaded

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
instance-ai-rss-baseline 383.71 MB 388.20 MB 372.63 MB (σ 22.95) -1.2% +3.0%
instance-ai-heap-used-baseline 186.49 MB 186.52 MB 186.34 MB (σ 0.24) -0.0% +0.1%

Memory consumption baseline with starter plan resources

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
memory-heap-used-baseline 114.32 MB 114.05 MB 113.86 MB (σ 0.84) +0.2% +0.4%
memory-rss-baseline 278.14 MB 287.98 MB 284.98 MB (σ 42.51) -3.4% -2.4%
How to read this table
  • Current: This PR's value (or latest master if PR perf tests haven't run)
  • Latest Master: Most recent nightly master measurement
  • Baseline: Rolling 14-day average from master
  • vs Master: PR impact (current vs latest master)
  • vs Baseline: Drift from baseline (current vs rolling avg)
  • Status: ✅ within 1σ | ⚠️ 1-2σ | 🔴 >2σ regression

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Architecture diagram
sequenceDiagram
    participant Client as MCP OAuth Client
    participant Ctrl as MCP Controller
    participant Service as McpOAuthService
    participant DB as Database

    Note over Client,DB: Client Registration Flow (/mcp-oauth/register)

    Client->>Ctrl: POST /mcp-oauth/register (payload)
    Ctrl->>Service: registerClient(payload)
    
    rect rgb(240, 240, 240)
    Note over Service: NEW: Validation Logic
    Service->>Service: validateClientRegistration()
    
    alt Missing client_name, grant_types, OR redirect_uris
        Service-->>Ctrl: Throw Error (Validation failed)
        Ctrl-->>Client: 4xx Bad Request
    else Fields Valid
        Service->>DB: Insert client record
        DB-->>Service: Success
        Service-->>Ctrl: client_id + credentials
        Ctrl-->>Client: 200/201 Success
    end
    end

    Note over DB: Prevents DB NOT NULL constraint<br/>violations and "phantom" client IDs.
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent Failures on requests to /mcp-oauth/register when some parameters are missing

1 participant