Implementation:1mcp app Agent installCommand
| Knowledge Sources | |
|---|---|
| Domains | CLI, MCP_Protocol |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete CLI command for installing an MCP server from the registry with version pinning, interactive wizard, dry-run preview, and force reinstall support.
Description
The installCommand function installs an MCP server from a remote registry by name or `name@version`. It resolves the registry server ID, creates a server installation workflow, and writes the resulting configuration to the config file. An interactive wizard (`--interactive`) guides users through configuration when no server name is provided. Dry-run mode (`--dry-run`) previews the installation without writing. Force mode (`--force`) reinstalls even if the server already exists.
Usage
Import this function when you need to:
- Install a server from the registry by name or full registry ID
- Pin a specific version with `name@version` syntax
- Launch an interactive wizard for guided installation
- Preview installation without writing changes (dry-run)
- Force reinstall an existing server
Code Reference
Source Location
- Repository: 1MCP Agent
- File: src/commands/mcp/install.ts (L35-80)
Signature
export interface InstallCommandArgs extends GlobalOptions, RegistryYargsOptions {
serverName?: string;
force?: boolean;
dryRun?: boolean;
verbose?: boolean;
interactive?: boolean;
}
export function buildInstallCommand(yargs: Argv): Argv;
export async function installCommand(argv: InstallCommandArgs): Promise<void>;
Import
import { installCommand, buildInstallCommand, InstallCommandArgs } from '@src/commands/mcp/install.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| serverName | string | No | Registry server name or name@version |
| force | boolean | No | Force reinstall (default: false) |
| dryRun | boolean | No | Preview only (default: false) |
| interactive | boolean | No | Launch wizard (default: false) |
Outputs
| Name | Type | Description |
|---|---|---|
| config file | side effect | Server entry written if not dry-run |
| stdout | text | Installation summary |
Usage Examples
Install from Registry
1mcp mcp install filesystem
1mcp mcp install io.github.user/filesystem
1mcp mcp install filesystem@1.0.0
Interactive Wizard
1mcp mcp install --interactive
Dry-Run Preview
1mcp mcp install filesystem --dry-run