A Rust implementation of OpenCode
OpenCodeRust is the Rust implementation and evolution of OpenCode. It provides a full CLI/TUI/Server workflow for local AI coding agents, session management, tool invocation, MCP/LSP integration, and plugin extensions.
OpenCodeRustopencode (kept for backward compatibility)cargo build -p opencode-cli
To avoid running another OpenCode (e.g. npm/global) on your PATH when using OpenCodeRust, run from the repo root:
./target/debug/opencode after cargo build -p opencode-clicargo run -p opencode-cli -- to always use this repo's version./target/debug/opencode --help
or
cargo run -p opencode-cli -- --help
cargo run -p opencode-cli --
cargo run -p opencode-cli -- tui
cargo run -p opencode-cli -- run "Check this repo for risks"
cargo run -p opencode-cli -- serve --port 3000 --hostname 127.0.0.1
From the repo root use ./target/debug/opencode or cargo run -p opencode-cli --. These commands match the current ./target/debug/opencode --help:
tui – Start interactive terminal UIattach – Attach to a running serverrun – Run a single messageserve – Start HTTP serverweb – Start headless server and open web UIacp – Start ACP servermodels – List available modelssession – Session managementstats – Token/cost statisticsdb – Database toolsconfig – Show configurationauth – Credential managementagent – Agent managementdebug – Debugging and troubleshootingmcp – MCP managementexport / import – Export/import sessionsgithub / pr – GitHub-related featuresupgrade / uninstall – Upgrade and uninstallgenerate – Generate OpenAPI specversion – Show versionSubcommand help:
./target/debug/opencode tui --help
./target/debug/opencode run --help
./target/debug/opencode serve --help
./target/debug/opencode session --help
Configuration is merged from the following paths in priority order (searched upward):
opencode.jsoncopencode.json.opencode/opencode.jsonc.opencode/opencode.jsonGlobal config default path:
~/.config/opencode/opencode.jsonc (or .json)See: docs/opencode-config.md
crates/opencode-cli – CLI entrypoint (binary: opencode)crates/opencode-server – HTTP/SSE/WebSocket servercrates/opencode-tui – Terminal UIcrates/opencode-session – Sessions and messagescrates/opencode-tool – Tool registration and executioncrates/opencode-provider – Model provider adapterscrates/opencode-plugin – Plugin system and subprocess bridgecrates/opencode-mcp – MCP client and registrationcrates/opencode-lsp – LSP supportcrates/opencode-storage – SQLite storagecargo fmt
cargo check
cargo clippy --workspace --all-targets
Minimal check (typical):
cargo check -p opencode-cli
cargo check -p opencode-tui
USER_GUIDE.mddocs/README.mddocs/opencode-cli.mddocs/opencode-tui.mddocs/opencode-server.mddocs/opencode-tool.mddocs/opencode-provider.mddocs/opencode-config.mdopencode for backward compatibility. OpenCodeRust is the project name.$ claude mcp add OpenCodeRust \
-- python -m otcore.mcp_server <graph>