diff --git a/packages/cli/src/__tests__/install-file-locations.test.ts b/packages/cli/src/__tests__/install-file-locations.test.ts index b70720dc..b7bf5b21 100644 --- a/packages/cli/src/__tests__/install-file-locations.test.ts +++ b/packages/cli/src/__tests__/install-file-locations.test.ts @@ -867,7 +867,7 @@ Follow TypeScript best practices. return tarball; } - it('installs MCP server (subtype: server) to .codex/config.toml with --editor codex', async () => { + it('installs MCP server (subtype: server) to .codex/config.toml with --as codex (via editor option)', async () => { const mockPackage = { id: '@test/mcp-server', name: '@test/mcp-server', @@ -893,7 +893,7 @@ Follow TypeScript best practices. expect(codexConfig).toContain('command = "npx"'); }); - it('installs MCP tool (subtype: tool) to .codex/config.toml with --editor codex', async () => { + it('installs MCP tool (subtype: tool) to .codex/config.toml with --as codex (via editor option)', async () => { const mockPackage = { id: '@test/mcp-tool', name: '@test/mcp-tool', diff --git a/packages/cli/src/commands/install.ts b/packages/cli/src/commands/install.ts index 0e71f600..267bd0a7 100644 --- a/packages/cli/src/commands/install.ts +++ b/packages/cli/src/commands/install.ts @@ -1942,20 +1942,27 @@ export function createInstallCommand(): Command { .option('--eager', 'Force skill/agent to always activate (not on-demand)') .option('--lazy', 'Use default on-demand activation (overrides package eager setting)') .option('--global', 'Install MCP servers to global config (e.g., ~/.claude/settings.json, ~/.codex/config.toml, ~/.cursor/mcp.json, ~/.kiro/settings/mcp.json)') - .option('--editor ', 'Target editor for MCP server installation (claude, codex, cursor, windsurf, vscode, gemini, opencode, kiro, trae, amp, zed)', 'claude') + .option('--editor ', '[Deprecated: use --as] Target editor for MCP server installation') .action(async (packageSpec: string | undefined, options: { version?: string; as?: string; format?: string; subtype?: string; hookMapping?: string; frozenLockfile?: boolean; yes?: boolean; location?: string; noAppend?: boolean; manifestFile?: string; eager?: boolean; lazy?: boolean; global?: boolean; editor?: string }) => { // Support both --as and --format (format is alias for as) - const convertTo = (options.format || options.as) as Format | undefined; + const rawAs = (options.format || options.as) as string | undefined; const validFormats = FORMATS; + // If --as value is an MCP editor but not a valid format, treat it as editor-only + const isMCPEditorOnly = rawAs && !validFormats.includes(rawAs as Format) && MCP_EDITORS.includes(rawAs as MCPEditor); + const convertTo = isMCPEditorOnly ? undefined : rawAs as Format | undefined; + if (convertTo && !validFormats.includes(convertTo)) { - throw new CLIError(`āŒ Format must be one of: ${validFormats.join(', ')}\n\nšŸ’” Examples:\n prpm install my-package --as cursor # Convert to Cursor format\n prpm install my-package --format claude # Convert to Claude format\n prpm install my-package --format claude.md # Convert to Claude.md format\n prpm install my-package --format kiro # Convert to Kiro format\n prpm install my-package --format agents.md # Convert to Agents.md format\n prpm install my-package --format gemini.md # Convert to Gemini format\n prpm install my-package # Install in native format`, 1); + throw new CLIError(`āŒ Format must be one of: ${validFormats.join(', ')}\n\nšŸ’” Examples:\n prpm install my-package --as cursor # Convert to Cursor format\n prpm install my-package --format claude # Convert to Claude format\n prpm install my-package --format claude.md # Convert to Claude.md format\n prpm install my-package --format kiro # Convert to Kiro format\n prpm install my-package --format agents.md # Convert to Agents.md format\n prpm install my-package --format gemini.md # Convert to Gemini format\n prpm install my-mcp-server --as codex # Install MCP server to Codex\n prpm install my-package # Install in native format`, 1); } + // Resolve MCP editor: --editor (deprecated) takes precedence, then --as + const mcpEditor = (options.editor || rawAs) as MCPEditor | undefined; + // Validate editor for MCP server installation if (options.editor && !MCP_EDITORS.includes(options.editor as MCPEditor)) { throw new CLIError( - `Invalid MCP editor: ${options.editor}\n\nSupported editors: ${MCP_EDITORS.join(', ')}\n\nšŸ’” Examples:\n prpm install my-mcp-server --editor claude # Install to .mcp.json\n prpm install my-mcp-server --editor codex # Install to .codex/config.toml\n prpm install my-mcp-server --editor cursor # Install to .cursor/mcp.json\n prpm install my-mcp-server --editor windsurf # Install to ~/.codeium/windsurf/mcp_config.json\n prpm install my-mcp-server --editor vscode # Install to .vscode/mcp.json\n prpm install my-mcp-server --editor gemini # Install to .gemini/settings.json\n prpm install my-mcp-server --editor opencode # Install to opencode.json\n prpm install my-mcp-server --editor kiro # Install to .kiro/settings/mcp.json\n prpm install my-mcp-server --editor trae # Install to .trae/mcp.json\n prpm install my-mcp-server --editor amp # Install to .amp/settings.json\n prpm install my-mcp-server --editor zed # Install to ~/.config/zed/settings.json` + `Invalid MCP editor: ${options.editor}\n\nSupported editors: ${MCP_EDITORS.join(', ')}\n\nšŸ’” Examples:\n prpm install my-mcp-server --as claude # Install to .mcp.json\n prpm install my-mcp-server --as codex # Install to .codex/config.toml\n prpm install my-mcp-server --as cursor # Install to .cursor/mcp.json\n prpm install my-mcp-server --as windsurf # Install to ~/.codeium/windsurf/mcp_config.json\n prpm install my-mcp-server --as vscode # Install to .vscode/mcp.json\n prpm install my-mcp-server --as gemini # Install to .gemini/settings.json\n prpm install my-mcp-server --as opencode # Install to opencode.json\n prpm install my-mcp-server --as kiro # Install to .kiro/settings/mcp.json\n prpm install my-mcp-server --as trae # Install to .trae/mcp.json\n prpm install my-mcp-server --as amp # Install to .amp/settings.json\n prpm install my-mcp-server --as zed # Install to ~/.config/zed/settings.json` ); } @@ -1993,7 +2000,7 @@ export function createInstallCommand(): Command { hookMapping: options.hookMapping as HookMappingStrategy | undefined, eager, global: options.global, - editor: options.editor as MCPEditor | undefined, + editor: mcpEditor as MCPEditor | undefined, }); }); diff --git a/public-documentation/cli/commands.mdx b/public-documentation/cli/commands.mdx index 1e371822..b5b4efb3 100644 --- a/public-documentation/cli/commands.mdx +++ b/public-documentation/cli/commands.mdx @@ -316,10 +316,11 @@ prpm install [additional-packages...] [options] **Options:** - `--version ` - Install a specific version -- `--as ` - Convert and install in specific format (cursor, claude, continue, windsurf, copilot, kiro, agents.md, canonical) +- `--as ` - Convert and install in specific format (cursor, claude, continue, windsurf, copilot, kiro, agents.md, canonical). For MCP servers, specifies the target editor (claude, codex, cursor, windsurf, vscode, gemini, opencode, kiro, trae, amp, zed) - `--format ` - Alias for `--as` - `--subtype ` - Specify subtype when converting (skill, agent, rule, etc.) - `--location ` - Custom installation location (Cursor and agents.md only) +- `--global` - Install MCP servers to global config (e.g., `~/.claude/settings.json`) - `--frozen-lockfile` - Fail if lock file needs to be updated (for CI) - `--eager` - Force skill/agent to always activate at session start (not on-demand) - `--lazy` - Use default on-demand activation (overrides package eager setting) @@ -356,6 +357,13 @@ prpm install @username/code-style --as agents.md --eager # Install with lazy activation (on-demand, default) prpm install @username/debugging-helper --as agents.md --lazy + +# Install MCP server for a specific editor +prpm install @org/my-mcp-server --as cursor +prpm install @org/my-mcp-server --as codex + +# Install MCP server globally +prpm install @org/my-mcp-server --as vscode --global ``` **What happens during installation:** diff --git a/public-documentation/guides/mcp-servers.mdx b/public-documentation/guides/mcp-servers.mdx index f14771fe..86b22805 100644 --- a/public-documentation/guides/mcp-servers.mdx +++ b/public-documentation/guides/mcp-servers.mdx @@ -139,8 +139,8 @@ prpm install @org/my-mcp-server prpm install @org/my-mcp-server --global # Install for a specific editor -prpm install @org/my-mcp-server --editor cursor -prpm install @org/my-mcp-server --editor vscode --global +prpm install @org/my-mcp-server --as cursor +prpm install @org/my-mcp-server --as vscode --global ``` ## MCP Servers + PRPM Collections @@ -185,7 +185,7 @@ If you're looking for existing MCP servers to use (not publish), these catalogs - PRPM can install MCP server configs for Claude Code, Cursor, VS Code, Codex, Windsurf, Gemini, Kiro, OpenCode, Trae, Amp, and Zed. Use the `--editor` flag to target a specific editor. + PRPM can install MCP server configs for Claude Code, Cursor, VS Code, Codex, Windsurf, Gemini, Kiro, OpenCode, Trae, Amp, and Zed. Use the `--as` flag to target a specific editor (e.g., `--as cursor`).