Implementation:1mcp app Agent cliSetupCommand
| Knowledge Sources | |
|---|---|
| Domains | CLI, Configuration |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete CLI command for generating agent configuration files (Claude Desktop `.mcp.json`, Codex config) to connect an AI agent to the 1MCP runtime.
Description
The cliSetupCommand function writes agent-specific configuration files that connect an AI agent to the 1MCP runtime. It resolves the target agent from `--claude` or `--codex` flags, determines the setup scope, and writes the appropriate config files (e.g., `.mcp.json` for Claude Desktop). For Codex, it also prints a notice with required `config.toml` settings for hooks and sandbox support.
Usage
Import this function when you need to:
- Generate `.mcp.json` for Claude Desktop integration
- Generate Codex configuration for 1MCP integration
- Write agent config files at a specific repository root or scope
Code Reference
Source Location
- Repository: 1MCP Agent
- File: src/commands/cliSetup/cliSetup.ts (L12-69)
Signature
export interface CliSetupCommandOptions extends GlobalOptions {
scope?: string;
claude?: boolean;
codex?: boolean;
'repo-root'?: string;
}
export async function cliSetupCommand(options: CliSetupCommandOptions): Promise<void>;
export function resolveCliSetupTargetsFromFlags(options: Pick<CliSetupCommandOptions, 'claude' | 'codex'>): CliSetupTarget[];
Import
import { cliSetupCommand } from '@src/commands/cliSetup/cliSetup.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| claude | boolean | One of | Target Claude Desktop |
| codex | boolean | One of | Target Codex |
| scope | string | No | Setup scope |
| repo-root | string | No | Repository root (default: cwd) |
Outputs
| Name | Type | Description |
|---|---|---|
| config files | files | Agent config files written to disk |
| stdout | text | Setup results and Codex notice |
Usage Examples
Setup for Claude Desktop
1mcp cli-setup --claude
1mcp cli-setup --codex
1mcp cli-setup --claude --repo-root /path/to/project