Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1mcp app Agent CLI Agent Integration

From Leeroopedia
Knowledge Sources
Domains CLI, MCP_Protocol
Last Updated 2026-10-29 00:00 GMT

Overview

Pattern that connects an AI agent client to a 1MCP runtime through CLI setup, instruction fetching, tool inspection, and direct tool invocation commands.

Description

CLI Agent Integration provides the bridge between an AI agent (Claude Desktop, Codex) and the 1MCP aggregated runtime. The workflow starts with installing the 1MCP CLI, adding upstream MCP servers, starting the runtime, and then using `cli-setup` to write agent configuration files (e.g., `.mcp.json`). Once connected, the agent can fetch runtime instructions for context, inspect available servers and tool schemas, and directly invoke tools via the `run` command. This decouples the agent's tool discovery from the runtime's server management.

Usage

Use this principle when:

  • An AI agent needs to discover and use MCP tools through a CLI rather than a programmatic SDK
  • Agent configuration files must be generated for Claude Desktop or Codex targets
  • Runtime instructions (aggregated from all connected servers) need to be fetched as text
  • Tool schemas must be inspected before invocation to understand parameter requirements
  • Tools must be invoked directly from the command line with JSON arguments

Theoretical Basis

The integration follows a connect → discover → invoke sequence:

install → add servers → serve → cli-setup → instructions → inspect → run

Each step is a CLI command that interacts with the runtime via HTTP:

// Abstract flow (NOT real implementation)
await serve();                                    // Start runtime
await cliSetup({ claude: true });                  // Write .mcp.json
const instructions = await instructionsCommand();  // Fetch aggregated instructions
const tools = await inspectCommand({ target });    // Discover tool schemas
const result = await runCommand({ target, args }); // Invoke a tool

Practical Guide

  1. Install the CLI globally via npm to get the `1mcp` binary on PATH
  2. Use `cli-setup` with `--claude` or `--codex` to generate agent-specific config files
  3. Fetch instructions from the running runtime to provide the agent with tool context
  4. Use `inspect` with a `server/tool` target to get JSON schemas before invocation
  5. Use `run` with JSON arguments and a timeout to invoke tools and get formatted results

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment