Repository navigation
Description
Summary
@sentry/mcp-server forces all organization / project / team slug parameters through .toLowerCase() in their Zod schemas. On self-hosted Sentry instances — where slugs are case-sensitive — this makes every tool call against an org whose slug contains uppercase letters fail with HTTP 404, even though the token and host are correct.
Sentry SaaS slugs are always lowercase, so the lowercasing is invisible there. Self-hosted instances can have mixed-case slugs (e.g. MyOrg), and the API treats MyOrg ≠ myorg.
Environment
@sentry/mcp-server:0.36.0- Deployment: self-hosted Sentry
- Org slug on instance: mixed-case (contains uppercase letters)
Reproduction
Token is valid; whoami works; the org is listed by find_organizations.
| Call | Result |
|---|---|
find_projects(organizationSlug="MyOrg") (actual slug) |
404 |
find_projects(organizationSlug="myorg") (lowercased) |
404 |
search_issues(organizationSlug="MyOrg", projectSlugOrId=<id>) |
404 |
Direct REST GET /api/0/organizations/MyOrg/ (Bearer token) |
200 ✅ |
Direct REST GET /api/0/organizations/MyOrg/projects/ |
200 ✅ |
Direct REST GET /api/0/organizations/myorg/projects/ (lowercase) |
404 |
So the token, host, org and project all exist and are accessible via the REST API. The 404 is caused purely by the MCP server lowercasing the slug before sending it.
Root cause
In dist/index.js (v0.36.0), the slug parameters are defined with a hardcoded .toLowerCase():
// dist/index.js:328-331
const ParamOrganizationSlug = z.string().toLowerCase().trim().superRefine(validateSlug)...
const ParamTeamSlug = z.string().toLowerCase().trim().superRefine(validateSlug)...
const ParamProjectSlug = z.string().toLowerCase().trim().superRefine(validateSlug)...
const ParamProjectSlugOrAll = z.string().toLowerCase().trim().superRefine(validateSlug)...The same pattern repeats for projectSlugOrId params:
// dist/index.js:12989 (find_releases)
projectSlugOrId: z.string().toLowerCase().trim().superRefine(validateSlugOrId)...
// dist/index.js:34094 (search_issues)
projectSlugOrId: z.string().toLowerCase().trim().superRefine(validateSlugOrId)...… and the create_project slug field (dist/index.js:33202).
Note: validateSlug itself is not the problem — its regex /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/ already allows uppercase. The .toLowerCase() in the schema chain is the sole cause.
Expected behaviour
Slug case is preserved as provided by the caller. On self-hosted instances with case-sensitive slugs, find_projects(organizationSlug="MyOrg") should hit /api/0/organizations/MyOrg/projects/ and succeed.
Suggested fix
Options (any one resolves it):
- Add a
--preserve-slug-caseflag (or auto-detect self-hosted mode) that skips.toLowerCase()on slug params. Default behavior unchanged for SaaS. - Drop
.toLowerCase()entirely fromParamOrganizationSlug/ParamTeamSlug/ParamProjectSlug/ParamProjectSlugOrAll/projectSlugOrIdparams.validateSlugalready enforces a safe charset, so removing the lowercasing does not weaken injection protection. (Platform param can stay lowercased — platform names are conventionally lowercase.) - At minimum, document that org/project slugs are coerced to lowercase and therefore self-hosted instances must use all-lowercase slugs.
Workaround
Patch the installed package locally: remove the .toLowerCase() calls on slug params in dist/index.js, pin the version, and point the MCP config at the patched binary. Works but breaks on upgrade.
Activity
linear-code commentedon Jun 30, 2026
MCP-995
sentry-pierre commentedon Jun 30, 2026
Hi, I'm Pierre!
This checks out. I confirmed the
.toLowerCase()chain is hardcoded in the source:packages/mcp-core/src/schema.ts—ParamOrganizationSlug,ParamTeamSlug,ParamProjectSlug, andParamProjectSlugOrAllall call.toLowerCase().packages/mcp-core/src/tools/catalog/search-issues.ts—ProjectSlugOrIdSchemadoes the same.packages/mcp-core/src/utils/slug-validation.ts—validateSlugalready allows uppercase characters (/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/), so the lowercasing isn't needed for security.The
find_projectstool feeds the lowercased slug straight intoapiService.listProjects(), which hits/organizations/${organizationSlug}/projects/. On a self-hosted instance whereMyOrg≠myorg, that's a guaranteed 404.You're right — removing
.toLowerCase()from the slug param schemas should fix it without weakening injection protection.Merci for the detailed report.
dcramer commentedon Jun 30, 2026
it looks like this was fixed in 23.2.0 and then fully fixed in 25.5.0. There are many things that will break in this MCP server with old versions of Sentry
If you have more concerns please re-open but I'm going to clsoe as wontfix because of that.
RavenLiao commentedon Jul 2, 2026
Thanks for the detailed investigation. But your own evidence actually shows the problem is the MCP's .toLowerCase(), not "old versions being broadly unusable":
You note that Sentry's lookup goes through slug = rhs (exact, case-sensitive), not iexact. Our org slug is a legacy mixed-case one (call it MyOrg), and that's exactly how it's stored. So:
Precisely because Sentry matches exactly, the MCP's forced .toLowerCase() is the sole cause of the 404. Pass the slug through unchanged and Sentry's own API resolves it fine.
23.2.0 only lowercases on save; 25.5.0 only rejects uppercase on save. Neither migrates slugs that already exist. So a legacy mixed-case slug stays mixed-case after upgrade, and the only remediation is a risky manual rename — but the org slug is baked into our app build/runtime config (SENTRY_ORG for symbol/source-map upload), CI, and dashboards, so renaming is a costly, coordinated change. Upgrading alone does not fix this.
We have direct evidence: with the .toLowerCase() removed (pass-through patch), this MCP fully works on our self-hosted instance — issue, event, and release queries all return data. n was that one line. So this isn't "old versions are unusable and not worth supporting"; it's a one-line defensive fix with zero impact on new versions.
Ask: please reconsider — either (a) pass the slug through unchanged, or (b) add a config flag to disable lowercasing. New installs already have lowercase slugs post-23.2.0, so pass-td only helps legacy ones.
Also: I don't have write access to the repo, so I can't re-open this myself — could you re-open it based on the above?
dcramer commentedon Jul 2, 2026
@RavenLiao ah i must not have read close enough. Will try to dig more today, ty
fix(core): Preserve mixed-case slug parameters (#1142)