From 17ba6586979aa67c507cc4a2ad96d7e3579d29b6 Mon Sep 17 00:00:00 2001 From: Alexandru Ciobanu Date: Tue, 16 Sep 2025 13:22:14 +0100 Subject: [PATCH 1/3] chore: remove `appId` when installing MCP server --- packages/cli/commands/mcp.ts | 53 ++---------------------------------- packages/cli/package.json | 2 +- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/packages/cli/commands/mcp.ts b/packages/cli/commands/mcp.ts index 6dfa01c1..84c6a98d 100644 --- a/packages/cli/commands/mcp.ts +++ b/packages/cli/commands/mcp.ts @@ -6,7 +6,6 @@ import { mkdir, readFile, writeFile } from "node:fs/promises"; import { dirname, join, relative } from "node:path"; import ora, { type Ora } from "ora"; -import { App, listApps } from "../services/bootstrap.js"; import { ConfigPaths, getServersConfig, @@ -18,20 +17,17 @@ import { configStore } from "../stores/config.js"; import { handleError } from "../utils/errors.js"; import { fileExists } from "../utils/file.js"; import { - appIdOption, configScopeOption, editorOption, } from "../utils/options.js"; export const mcpAction = async (options: { editor?: SupportedEditor; - appId?: string; scope?: "local" | "global"; }) => { const config = configStore.getConfig(); let spinner: Ora | undefined; let selectedEditor = options.editor; - let selectedApp: App | undefined; // Select Editor/Client if (!selectedEditor) { @@ -44,45 +40,6 @@ export const mcpAction = async (options: { }); } - // Select App ID - try { - spinner = ora(`Loading apps from ${chalk.cyan(config.baseUrl)}...`).start(); - const apps = listApps(); - spinner.succeed(`Loaded apps from ${chalk.cyan(config.baseUrl)}.`); - - if (apps.length === 0) { - throw new Error("You don't have any apps yet. Please create one."); - } - - let selectedAppId: string; - if (options.appId) { - // If appId is provided, try to find it directly - const app = apps.find(({ id }) => id === options.appId); - if (!app) { - throw new Error(`Could not find app with ID: ${options.appId}`); - } - - selectedAppId = app.id; - } else { - // Otherwise, show selection prompt - const nonDemoApp = apps.find((app) => !app.demo); - const longestName = Math.max(...apps.map((app) => app.name.length)); - - selectedAppId = await select({ - message: "Select an app", - default: config.appId ?? nonDemoApp?.id, - choices: apps.map((app) => ({ - name: `${app.name.padEnd(longestName, " ")}${app.demo ? " [Demo]" : ""}`, - value: app.id, - })), - }); - } - selectedApp = apps.find((app) => app.id === selectedAppId)!; - } catch (error) { - spinner?.fail("Loading apps failed."); - handleError(error, "MCP Configuration"); - } - // Determine Config Path const projectPath = configStore.getProjectPath(); const globalPath = resolveConfigPath(selectedEditor, false); @@ -152,7 +109,7 @@ export const mcpAction = async (options: { // Prompt for Add/Update let targetEntryKey: string; - const defaultNewKey = `Reflag - ${selectedApp.name}`; + const defaultNewKey = `Reflag`; if (existingReflagEntries.length === 0) { targetEntryKey = defaultNewKey; @@ -183,13 +140,8 @@ export const mcpAction = async (options: { } // Construct the MCP endpoint URL - const mcpUrlBase = config.apiUrl + "/mcp"; - const mcpUrlWithAppId = `${mcpUrlBase}?appId=${selectedApp.id}`; - const newEntryValue = { - type: "stdio", - command: "npx", - args: ["mcp-remote@latest", mcpUrlWithAppId], + url: config.apiUrl + "/mcp", }; // Update Config Object @@ -228,7 +180,6 @@ export function registerMcpCommand(cli: Command) { cli .command("mcp") .description("Configure Reflag's remote MCP server for your AI assistant.") - .addOption(appIdOption) .addOption(editorOption) .addOption(configScopeOption) .action(mcpAction); diff --git a/packages/cli/package.json b/packages/cli/package.json index 006c1f5a..8c69f3a6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/cli", - "version": "1.0.1", + "version": "1.0.2", "packageManager": "yarn@4.1.1", "description": "CLI for Reflag service", "main": "./dist/index.js", From f00f26cce394d2b2be93beb4f739c45cf8bee2bd Mon Sep 17 00:00:00 2001 From: Alexandru Ciobanu Date: Tue, 16 Sep 2025 13:24:37 +0100 Subject: [PATCH 2/3] chore: format --- packages/cli/commands/mcp.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/cli/commands/mcp.ts b/packages/cli/commands/mcp.ts index 84c6a98d..f2361ebc 100644 --- a/packages/cli/commands/mcp.ts +++ b/packages/cli/commands/mcp.ts @@ -16,10 +16,7 @@ import { import { configStore } from "../stores/config.js"; import { handleError } from "../utils/errors.js"; import { fileExists } from "../utils/file.js"; -import { - configScopeOption, - editorOption, -} from "../utils/options.js"; +import { configScopeOption, editorOption } from "../utils/options.js"; export const mcpAction = async (options: { editor?: SupportedEditor; From 187b6b1fd60940aa194a69facf08e031cddedeb6 Mon Sep 17 00:00:00 2001 From: Alexandru Ciobanu Date: Tue, 16 Sep 2025 15:26:30 +0100 Subject: [PATCH 3/3] fix: app ID potential issue --- packages/cli/commands/mcp.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/cli/commands/mcp.ts b/packages/cli/commands/mcp.ts index f2361ebc..6931934b 100644 --- a/packages/cli/commands/mcp.ts +++ b/packages/cli/commands/mcp.ts @@ -180,12 +180,4 @@ export function registerMcpCommand(cli: Command) { .addOption(editorOption) .addOption(configScopeOption) .action(mcpAction); - - // Update the config with the cli override values - cli.hook("preAction", (_, command) => { - const { appId } = command.opts(); - configStore.setConfig({ - appId, - }); - }); }