diff --git a/src/lifecycle.ts b/src/lifecycle.ts index 85cf708c..08be3692 100644 --- a/src/lifecycle.ts +++ b/src/lifecycle.ts @@ -1,6 +1,6 @@ import type { CommandSpec, RawLifecycle, ServerDefinition, ServerLifecycle } from './config-schema.js'; -const DEFAULT_KEEP_ALIVE = new Set(['chrome-devtools', 'mobile-mcp', 'playwright']); +const DEFAULT_KEEP_ALIVE = new Set(['chrome-devtools', 'mobile-mcp', 'playwright', 'cloudbase']); const includeOverride = parseList(process.env.MCPORTER_KEEPALIVE); const excludeOverride = parseList(process.env.MCPORTER_DISABLE_KEEPALIVE ?? process.env.MCPORTER_NO_KEEPALIVE); @@ -19,6 +19,7 @@ const KEEP_ALIVE_COMMANDS: CommandSignature[] = [ { label: 'chrome-devtools', fragments: ['chrome-devtools-mcp'] }, { label: 'mobile-mcp', fragments: ['@mobilenext/mobile-mcp', 'mobile-mcp'] }, { label: 'playwright', fragments: ['@playwright/mcp', 'playwright/mcp'] }, + { label: 'cloudbase', fragments: ['@cloudbase/cloudbase-mcp', 'cloudbase-mcp'] }, ]; const CHROME_DEVTOOLS_URL_PLACEHOLDERS = [String.raw`\${CHROME_DEVTOOLS_URL}`, '$env:CHROME_DEVTOOLS_URL']; diff --git a/tests/lifecycle.test.ts b/tests/lifecycle.test.ts index 2d67a7b0..1b35baed 100644 --- a/tests/lifecycle.test.ts +++ b/tests/lifecycle.test.ts @@ -16,6 +16,20 @@ const CHROME_COMMAND_ENV: CommandSpec = { cwd: process.cwd(), }; +const CLOUDBASE_NPX_COMMAND: CommandSpec = { + kind: 'stdio', + command: 'npx', + args: ['-y', '@cloudbase/cloudbase-mcp@latest'], + cwd: process.cwd(), +}; + +const CLOUDBASE_BIN_COMMAND: CommandSpec = { + kind: 'stdio', + command: 'cloudbase-mcp', + args: [], + cwd: process.cwd(), +}; + describe('resolveLifecycle', () => { it('forces chrome-devtools placeholder runs to be ephemeral', () => { const lifecycle = resolveLifecycle('chrome-devtools', undefined, CHROME_COMMAND); @@ -26,4 +40,19 @@ describe('resolveLifecycle', () => { const lifecycle = resolveLifecycle('chrome-devtools', undefined, CHROME_COMMAND_ENV); expect(lifecycle?.mode).toBe('ephemeral'); }); + + it('auto-enables keep-alive for CloudBase MCP package commands', () => { + const lifecycle = resolveLifecycle('cloudbase', undefined, CLOUDBASE_NPX_COMMAND); + expect(lifecycle?.mode).toBe('keep-alive'); + }); + + it('auto-enables keep-alive for CloudBase MCP binary commands', () => { + const lifecycle = resolveLifecycle('tcb', undefined, CLOUDBASE_BIN_COMMAND); + expect(lifecycle?.mode).toBe('keep-alive'); + }); + + it('honors explicit ephemeral lifecycle for CloudBase MCP commands', () => { + const lifecycle = resolveLifecycle('cloudbase', 'ephemeral', CLOUDBASE_NPX_COMMAND); + expect(lifecycle?.mode).toBe('ephemeral'); + }); });