Skip to content

fix(mcp): return 400 from test-connection when the server hostname does not exist - #10474

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/mcp-unknown-host-4xx
Nov 28, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/mcp-unknown-host-4xx

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

POST /api/mcp/servers/test-connection answered 502 for every DNS failure, so a hostname the user mistyped surfaced as a gateway error and counted toward 5xx. McpDnsResolutionError now carries hostNotFound, set from the existing isHostNotFound predicate (only ENOTFOUND). The route returns 400 when it is set and keeps 502 for transient lookup failures (EAI_AGAIN, timeouts). The message is unchanged.

Other callers are unchanged:

  • validateMcpServerUrl (create/update) and the managed connector already project DNS failures to validation/internal in the application layer.
  • categorizeMcpServerError (discovery and execution against a registered server) keeps 502, because by then a hostname that stopped resolving is a server-side condition.

Type of Change

  • Bug fix

Testing

  • domain-check.test.ts covers ENOTFOUND → hostNotFound: true and EAI_AGAIN → false through the real DNS-validation path. Both cases fail on the pre-fix domain-check.ts.
  • The test-connection, discover, and server-lifecycle suites pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…es not exist

A hostname the resolver proves does not exist (ENOTFOUND) is the caller's
input, so test-connection now answers 400 with the same message. Transient
lookup failures (EAI_AGAIN, timeouts) keep returning 502. The classification
reuses isHostNotFound, matching the credential validators' site_not_found split.
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 28, 2026 11:34am UTC

Request Review

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues remain.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain.

Summary

The PR returns 400 when a tested MCP hostname does not exist, while keeping 502 for temporary DNS failures.

  • MCP connection tests treat missing hostnames as bad requests.

Reviews (3) · Last reviewed commit: "test(mcp): cover test-connection status ..." · Reviewed by Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 6cb2819 into staging Nov 28, 2026
73 of 74 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/mcp-unknown-host-4xx branch November 28, 2026 11:36
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — 52ae6912 Deployed Nov 28, 2026 by vercel[bot]
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.

1 participant