Skip to content

fix(mcp): Tell callers how to recover from a rejected regionUrl - #2819

Open
37chengshan wants to merge 1 commit into
getsentry:mainfrom
37chengshan:fix/region-url-recovery-hint
Open

37chengshan wants to merge 1 commit into
getsentry:mainfrom
37chengshan:fix/region-url-recovery-hint

Conversation

@37chengshan

Copy link
Copy Markdown

Summary

Fixes #2777.

When an agent passes an organization's web URL (https://<org>.sentry.io, the webUrl from find_organizations) as regionUrl, validateRegionUrl rightly rejects it via the SSRF allowlist, but previously only listed the allowed domains (sentry.io, us.sentry.io, de.sentry.io). Agents either guessed a region URL and hit upstream errors (such as 401s) or gave up instead of omitting regionUrl or using the regionUrl from find_organizations.

Update the UserInputError message thrown on allowlist rejection in validateRegionUrl to keep the allowlist untouched while telling callers to pass the regionUrl from find_organizations, not the organization's webUrl, or omit regionUrl.

Before

Invalid regionUrl. The domain 'my-org.sentry.io' is not allowed. Allowed domains are: sentry.io, us.sentry.io, de.sentry.io

After

Invalid regionUrl. The domain 'my-org.sentry.io' is not allowed. Allowed domains are: sentry.io, us.sentry.io, de.sentry.io. Pass the `regionUrl` from `find_organizations`, not the organization's `webUrl`, or omit `regionUrl`.

Testing

  • Added a unit test in packages/mcp-core/src/internal/tool-helpers/validate-region-url.test.ts verifying the recovery message when an organization webUrl (https://my-org.sentry.io) is passed.
  • Ran @sentry/mcp-core build, TypeScript typecheck (tsconfig.json, scripts/tsconfig.json, chart-app), oxlint, oxfmt --check, ast-grep, definition sync checks, and unit tests.

🤖 Generated with Claude Code

Fixes getsentry#2777

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@37chengshan
37chengshan requested a review from a team as a code owner December 3, 2026 01:12
@vercel

vercel Bot commented Dec 3, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 3, 2026 1:13am UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – sentry-local December 3, 2026 01:13 Inactive
@vercel

vercel Bot commented Dec 3, 2026

Copy link
Copy Markdown

@37chengshan is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the risk: low PR risk score: low label Dec 3, 2026

This branch was previously deployed

1 inactive deployment
Preview – sentry-local — 1063550a Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rejected regionUrl errors don't say how to recover when an agent passes the organization's web URL

1 participant