Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
removeMCPServerFromClientsStep,
} from './steps/add-mcp-server-to-clients';
import clack from './utils/clack';
import { abort, askForCloudRegion } from './utils/clack-utils';
import { abort } from './utils/clack-utils';
import type { CloudRegion } from './utils/types';
import opn from 'opn';
import { getCloudUrlFromRegion } from './utils/urls';
Expand Down Expand Up @@ -50,11 +50,9 @@ export const runMCPRemove = async () => {
};

export const getPersonalApiKey = async (options: {
region?: CloudRegion;
cloudRegion: CloudRegion;
}): Promise<string> => {
const cloudRegion = options.region ?? (await askForCloudRegion());

const cloudUrl = getCloudUrlFromRegion(cloudRegion);
const cloudUrl = getCloudUrlFromRegion(options.cloudRegion);

const urlToOpen = `${cloudUrl}/settings/user-api-keys?preset=mcp_server`;

Expand Down
19 changes: 17 additions & 2 deletions src/steps/add-mcp-server-to-clients/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import type { Integration } from '../../lib/constants';
import { traceStep } from '../../telemetry';
import { analytics } from '../../utils/analytics';
import clack from '../../utils/clack';
import { abort, abortIfCancelled } from '../../utils/clack-utils';
import {
abort,
abortIfCancelled,
askForCloudRegion,
} from '../../utils/clack-utils';
import { MCPClient } from './MCPClient';
import { CursorMCPClient } from './clients/cursor';
import { ClaudeMCPClient } from './clients/claude';
Expand All @@ -24,6 +28,17 @@ export const addMCPServerToClientsStep = async ({
cloudRegion?: CloudRegion;
askPermission?: boolean;
}): Promise<string[]> => {
const region = cloudRegion ?? (await askForCloudRegion());

if (region === 'eu') {
if (!askPermission) {
await abort(
'The MCP server is not available in the EU region. It is coming soon!',
);
}
return [];
}

const hasPermission = askPermission
? await abortIfCancelled(
clack.select({
Expand Down Expand Up @@ -83,7 +98,7 @@ export const addMCPServerToClientsStep = async ({
clack.log.info('Removed existing installation.');
}

const personalApiKey = await getPersonalApiKey({ region: cloudRegion });
const personalApiKey = await getPersonalApiKey({ cloudRegion: region });

await traceStep('adding mcp servers', async () => {
await addMCPServer(clients, personalApiKey);
Expand Down
Loading