pub async fn run(
from_config: Option<String>,
server: Option<String>,
args: Vec<String>,
env: Vec<String>,
cwd: Option<String>,
http: Option<String>,
sse: Option<String>,
headers: Vec<String>,
name: Option<String>,
output_dir: Option<PathBuf>,
output_format: OutputFormat,
) -> Result<ExitCode>Expand description
Runs the generate command.
Generates progressive loading TypeScript files from an MCP server.
This command performs the following steps:
- Builds
ServerConfigfrom CLI arguments or loads from ~/.claude/mcp.json - Introspects the MCP server to discover tools
- Generates TypeScript files (one per tool) using progressive loading pattern
- Exports VFS to
~/.claude/servers/{server-id}/directory
§Arguments
from_config- Load server config from ~/.claude/mcp.json by nameserver- Server command (binary name or path), None for HTTP/SSEargs- Arguments to pass to the server commandenv- Environment variables in KEY=VALUE formatcwd- Working directory for the server processhttp- HTTP transport URLsse- SSE transport URLheaders- HTTP headers in KEY=VALUE formatname- Custom server name for directory (default:server_id)output_dir- Custom output directory (default: ~/.claude/servers/)output_format- Output format (json, text, pretty)
§Errors
Returns an error if:
- Server configuration is invalid
- Server not found in mcp.json (when using –from-config)
- Server connection fails
- Tool introspection fails
- Code generation fails
- File export fails