diff --git a/packages/mcp-core/src/utils/url-utils.ts b/packages/mcp-core/src/utils/url-utils.ts index 8e90b1e83..09d8b0b0a 100644 --- a/packages/mcp-core/src/utils/url-utils.ts +++ b/packages/mcp-core/src/utils/url-utils.ts @@ -1,4 +1,4 @@ -import { isSentryHost as isSharedSentryHost } from "@sentry/toolkit-core/sentry-host"; +import { isSentryHost } from "@sentry/toolkit-core/sentry-host"; import type { SentryProtocol } from "../types"; import { type EventsDataset, @@ -6,11 +6,6 @@ import { isProfilesDataset, } from "./events-datasets"; -/** Keep the MCP utility export for its existing consumers. */ -export function isSentryHost(host: string): boolean { - return isSharedSentryHost(host); -} - /** Hosts that use the public SaaS control host and organization web subdomains. */ export function isPublicSentryHost(host: string): boolean { return isSentryHost(host) && !host.endsWith(".my.sentry.io"); diff --git a/packages/mcp-server/src/auth/constants.ts b/packages/mcp-server/src/auth/constants.ts index 7b70c38ac..4655b4341 100644 --- a/packages/mcp-server/src/auth/constants.ts +++ b/packages/mcp-server/src/auth/constants.ts @@ -1,5 +1,4 @@ import { SCOPES } from "@sentry/mcp-core/scopes"; -import { isSentryHost } from "@sentry/mcp-core/utils/url-utils"; /** * Public OAuth app registered on sentry.io for the stdio device code flow. @@ -15,12 +14,6 @@ export const DEVICE_CODE_ENDPOINT = "/oauth/device/code/"; export const TOKEN_ENDPOINT = "/oauth/token/"; export const DEVICE_CODE_SCOPES = Object.keys(SCOPES).join(" "); -/** - * Whether device code auth is available for this host. - * Supports sentry.io and regional subdomains (us.sentry.io, eu.sentry.io). - */ -export { isSentryHost as isSentryIo }; - /** * OAuth endpoints live on sentry.io regardless of regional host. * Always use this as the host for device code and token requests. diff --git a/packages/mcp-server/src/auth/resolve-token.ts b/packages/mcp-server/src/auth/resolve-token.ts index 1d91bfa49..fbb3c72a0 100644 --- a/packages/mcp-server/src/auth/resolve-token.ts +++ b/packages/mcp-server/src/auth/resolve-token.ts @@ -1,5 +1,6 @@ +import { isSentryHost } from "@sentry/toolkit-core/sentry-host"; import type { PartiallyResolvedConfig, ResolvedConfig } from "../cli/types"; -import { isSentryIo, OAUTH_HOST } from "./constants"; +import { OAUTH_HOST } from "./constants"; import { authenticate } from "./device-code-flow"; import { readCachedToken, writeCachedToken } from "./token-cache"; import { toCachedToken } from "./types"; @@ -26,7 +27,7 @@ export async function resolveAccessToken( return withToken(partial, partial.accessToken); } - if (!isSentryIo(partial.sentryHost)) { + if (!isSentryHost(partial.sentryHost)) { throw new Error( "Error: No access token was provided. Device code authentication is only supported for sentry.io.\n" + "Pass one with `--access-token` or via `SENTRY_ACCESS_TOKEN`.", diff --git a/packages/mcp-server/src/cli/commands/auth.ts b/packages/mcp-server/src/cli/commands/auth.ts index 15b2208fc..3630951a1 100644 --- a/packages/mcp-server/src/cli/commands/auth.ts +++ b/packages/mcp-server/src/cli/commands/auth.ts @@ -1,10 +1,7 @@ +import { isSentryHost } from "@sentry/toolkit-core/sentry-host"; import { parseEnv } from "../parse"; import { resolveHost } from "../resolve"; -import { - DEFAULT_SENTRY_CLIENT_ID, - isSentryIo, - OAUTH_HOST, -} from "../../auth/constants"; +import { DEFAULT_SENTRY_CLIENT_ID, OAUTH_HOST } from "../../auth/constants"; import { authenticate } from "../../auth/device-code-flow"; import { readCachedToken, @@ -46,7 +43,7 @@ function resolveAuthContext(argv: string[]): AuthContext { async function login(argv: string[]): Promise { const { sentryHost, clientId } = resolveAuthContext(argv); - if (!isSentryIo(sentryHost)) { + if (!isSentryHost(sentryHost)) { console.error( "Error: Device code authentication is only supported for sentry.io.", ); diff --git a/packages/mcp-server/src/cli/resolve.ts b/packages/mcp-server/src/cli/resolve.ts index 83f2c9e5a..d51b0baaa 100644 --- a/packages/mcp-server/src/cli/resolve.ts +++ b/packages/mcp-server/src/cli/resolve.ts @@ -4,8 +4,8 @@ import { parseSkills, type Skill, } from "@sentry/mcp-core/skills"; +import { isSentryHost } from "@sentry/toolkit-core/sentry-host"; import { - isSentryHost, validateAndParseSentryUrlThrows, validateOpenAiBaseUrlThrows, validateSentryHostThrows,