Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Fetched from the repository for this visit.
Rust implementation of a code-focused AI CLI with multi-provider support.
The codebase is organized as a Cargo workspace with explicit crate boundaries:
opencli: CLI entrypoint, clap parsing, completionsopencli-core: app orchestration, runtime assembly, agent loop, TUI, A2A delegationopencli-provider: provider traits, message model, provider implementations, provider factoryopencli-tools: generic tools, tool registry, path and shell safety policiesopencli-config: config loading, defaults, env overridesopencli-audit: audit logging and queriesopencli-session: session persistenceopencli-output: terminal rendering and markdown renderingThis structure is intended to keep future changes localized:
opencli-provideropencli-provider::ProviderFactoryopencli-outputopencli-toolsopencli-toolsopencli-auditopencli-core::runtimeopenai-compatible and anthropic text responsesdelegate_agent and a2adelegate_agents and a2a-batchrun --file/--dir context injection~/.config/opencli/config.jsonread_file, list_dir, search_files, run_shellon-writemodels and config show commandscompletions commandaudit list commandaudit tail commandaudit clear/export commandssession delete commandsession rename commandconfig doctor commandopenai-compatible, anthropiccargo build
Local install into ~/.local/bin:
./scripts/install.sh
Windows PowerShell install:
./scripts/install.ps1
Generate shell completions manually:
cargo run -- completions bash
cargo run -- completions zsh
cargo run -- completions fish
cargo run -- config init
Then edit ~/.config/opencli/config.json and set apiKey, baseUrl, and model.
Example config:
{
"provider": "openai-compatible",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "",
"model": "gpt-4.1",
"anthropicVersion": "2023-06-01",
"temperature": 0.2,
"maxTokens": 4096,
"approvalMode": "on-write",
"nonInteractiveApproval": "deny",
"workspaceRoot": ".",
"sessionDir": "~/.config/opencli/sessions",
"auditLogPath": "~/.config/opencli/audit.jsonl",
"requestTimeoutMs": 120000,
"shellTimeoutMs": 120000,
"agentMaxSteps": 8,
"a2aEnabled": true,
"a2aMaxDepth": 2,
"a2aMaxConcurrency": 4,
"allowedToolKinds": [
"filesystem-read",
"filesystem-search",
"shell",
"agent"
],
"allowedTools": []
}
cargo run -- "Explain this repository"
cargo run -- chat
cargo run -- tui
cargo run -- a2a --role researcher "Summarize the repository architecture"
cargo run -- a2a-batch --file tasks.json --concurrency 3
cargo run -- models
cargo run -- completions zsh
cargo run -- config show
cargo run -- config doctor
cargo run -- audit list --limit 20
cargo run -- audit tail --lines 20 --follow
cargo run -- audit stats
cargo run -- audit graph
cargo run -- audit export --output /tmp/audit.json
cargo run -- audit clear
cargo run -- run --file crates/opencli-core/src/lib.rs "Explain this file"
cargo run -- run --dir crates/opencli-core/src "Summarize this codebase"
cargo run -- session list
cargo run -- session resume <session-id>
cargo run -- session delete <session-id>
cargo run -- session rename <session-id> "New title"
The model can call these built-in tools:
read_filelist_dirsearch_filesrun_shelldelegate_agentdelegate_agentsrun_shell is constrained to the configured workspace and uses approvalMode:
on-write: read-like commands run directly, write-like commands ask for approvalalways-ask: every shell command asks for approvalnever-ask: shell commands run without approval except blocked dangerous commandsDangerous commands such as sudo, rm -rf /, mkfs, shutdown, and reboot are blocked.
Shell commands are terminated when they exceed shellTimeoutMs.
allowedToolKinds controls which tool groups can run:
filesystem-readfilesystem-searchshellagentallowedTools can further restrict execution to specific tool names. An empty array means "allow all tools that pass kind checks".
nonInteractiveApproval controls shell behavior when there is no TTY:
denyallow-read-onlyallow-allSupported providers:
openai-compatibleanthropicFor anthropic, set:
provider to anthropicbaseUrl to https://api.anthropic.com/v1anthropicVersion to a supported API versionThe CLI supports local agent-to-agent delegation.
Direct sub-agent invocation:
cargo run -- a2a --role researcher "Summarize the project structure"
cargo run -- a2a-batch --file tasks.json --concurrency 3
Example tasks.json for batch delegation:
[
{
"role": "researcher",
"task": "Summarize the provider module"
},
{
"role": "reviewer",
"task": "Identify risks in the TUI flow"
}
]
Model-driven delegation uses the delegate_agent tool. Delegation is controlled by:
a2aEnableda2aMaxDeptha2aMaxConcurrencyallowedToolKindsallowedToolsSub-agent results are returned as structured JSON including:
agent_idparent_agent_idroletasksuccessoutputerrorduration_msTool audit events also include parent/child agent correlation fields when delegation is involved.
For concurrent batch delegation, one sub-agent failure does not abort the whole batch. Each result item reports its own success and error fields.
Tool executions are written to auditLogPath as JSONL.
Query recent audit records:
cargo run -- audit list --limit 50
cargo run -- audit list --tool run_shell
cargo run -- audit list --event tool_finish
cargo run -- audit tail --lines 20 --follow
cargo run -- audit stats
cargo run -- audit graph
cargo run -- audit export --output /tmp/audit.json
cargo run -- audit clear
audit graph prints a readable agent delegation tree based on recorded A2A events.
Supported session commands:
session listsession resume <id>session delete <id>session rename <id> <title>Run a basic local config validation:
cargo run -- config doctor
It checks for missing API keys, missing base URLs, empty tool policy, and invalid workspace paths.
Launch the terminal UI chat mode:
cargo run -- tui
Controls:
Enter: send promptBackspace: delete characterEsc: exitopencli returns stable non-zero exit codes for common failure classes:
1: generic failure2: config error3: authentication error4: permission or approval error5: not found6: validation error7: network or timeout errorStructured tracing logs can be enabled with RUST_LOG.
Examples:
RUST_LOG=info cargo run -- chat
RUST_LOG=debug cargo run -- config doctor
Current logging focuses on:
Compile-time feature flags:
anthropic: enable Anthropic provider supporttui: enable terminal UI supportbenchmarks: reserve benchmark-focused buildsExamples:
cargo build --no-default-features
cargo build --features anthropic,tui
Compile benchmark targets:
cargo bench --no-run
Run the markdown benchmark:
cargo bench --bench markdown_render
The repository also includes mock-server provider tests and fixture-based rendering tests in tests/.
GitHub Actions CI is included at .github/workflows/ci.yml and runs:
cargo build --lockedcargo test --lockedGitHub Actions release automation is included at .github/workflows/release.yml.
Pushing a tag like v0.1.0 builds release archives for:
x86_64-unknown-linux-gnux86_64-apple-darwinx86_64-pc-windows-msvcThe repository also includes:
AGENTS.md for coding agentsCONTRIBUTING.md for contributorsCHANGELOG.md for release trackingdocs/architecture.md for module/layer overviewSECURITY.md for vulnerability reporting guidance.github/CODEOWNERS for ownership rules.github/The project currently uses multiple test layers:
crates/opencli/tests/cli_smoke.rscrates/opencli/tests/fixtures_*GitHub checked 207h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.