Using with Claude Code
There are two ways to connect OpenCodeHub to Claude Code. The plugin path
adds a PreToolUse hook that auto-augments rename-class edits with impact and
detect_changes. The MCP-only path wires the server without the hook.
Plugin (preferred)
Section titled “Plugin (preferred)”codehub setup --plugin--plugin installs the OpenCodeHub plugin into Claude Code. The plugin
registers a PreToolUse hook that runs before any edit that looks like a
rename or a cross-file refactor. The hook calls impact and
detect_changes, then feeds the results back to Claude Code as inline
context so the agent can adjust its plan before writing a diff.
The plugin bundles the MCP server wiring too, so you do not need to
also run setup --editors claude-code.
MCP-only
Section titled “MCP-only”If you prefer the raw MCP connection without the hook:
codehub setup --editors claude-codeThe writer targets <project>/.mcp.json (Claude Code’s project scope).
Prerequisite: codehub must be on your PATH — run
mise run cli:link from a checkout, or mise run cli:install-global
to install the packed tarball. See
Install.
The resulting entry looks like:
{ "mcpServers": { "codehub": { "command": "codehub", "args": ["mcp"], "env": {} } }}The server runs over stdio. Claude Code spawns it on demand, sends JSON-RPC over stdin/stdout, and keeps it alive for the session.
Multi-editor setup
Section titled “Multi-editor setup”--editors accepts any comma-separated subset of
claude-code,cursor,codex,windsurf,opencode. The default is all five.
codehub setup --editors claude-code,cursorReverting
Section titled “Reverting”codehub setup --editors claude-code --undo--undo removes only the codehub entry; any other mcpServers
entries in .mcp.json are preserved.
- MCP tools — the full catalogue of 29 tools Claude Code will see.
- MCP overview — server name, transport, envelope conventions.