# baton [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/Kaseban/baton  
**GitHub Stars:** 27  
**npm Downloads (last month):** 326  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/baton-2

## Description
Pass the baton between coding agents: convert sessions across Claude Code, OpenCode, Codex & more.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "baton": {
    "command": "npx",
    "args": ["-y","@kasabeh/baton-mcp"]
  }
}
```

## Documentation

## What the baton MCP server does

The baton MCP server moves coding-agent sessions between transcript formats. It can find sessions stored by supported agents, identify the format of a file or directory, convert a session, and import the result into a target agent when that agent provides an import command.

The command-line application supports Claude Code, OpenCode, Codex CLI, Gemini CLI, Zed, Aider, Cursor exports, Continue, and Cline or Roo sessions. All listed formats have readers. Writers are available for Claude Code, OpenCode, Codex, Zed, Aider, and Gemini CLI.

## How it works

The baton MCP server first parses an agent transcript into a canonical session representation. That representation contains message text, reasoning, tool calls, and tool results. A writer then creates the target format from the canonical session instead of using a separate converter for every source-target pair.

Session discovery can be automatic. The `--latest` option selects the newest session, while omitting the input path opens an interactive picker that previews sessions by their first user message. `baton list` reports sessions found across agents and includes their file paths.

The conversion process can preserve the complete transcript where the target format supports it, but formats differ in what they can represent. The README's benchmark reports different round-trip message counts for several target formats, so conversion is not guaranteed to retain every structural detail in every destination.

## Setup and configuration

Install a prebuilt package with npm, Homebrew, Cargo binstall, the shell installer, or a GitHub Release binary. Building from source requires cloning the repository and running `cargo build --release`.

For MCP registration, run `baton install`. The command registers the server in every detected agent's MCP configuration. Run `baton doctor` to verify the setup and `baton uninstall` to remove those registrations. The npm package also supports a zero-install help invocation through `npx @kasabeh/baton-mcp --help`.

A typical command converts the newest Claude Code session to OpenCode and imports it:

```sh
baton convert --from claude-code --to opencode --latest --import
```

You can instead select a session interactively or provide an explicit session file. After an import, the target agent can open the resulting session using its own session mechanism.

## Tools and capabilities

The MCP interface exposes four tools:

- `list_sessions` scans supported agents and returns a unified session list.
- `convert_session` converts a session from one supported format to another.
- `import_to_target` converts a session and runs the target agent's import command.
- `detect_format` examines a file or directory and reports the producing agent format.

The CLI provides related workflows through `convert`, `list`, `install`, `doctor`, and `uninstall`. Supported session locations include Claude Code project transcripts under `~/.claude/projects` and Codex CLI sessions under `~/.codex/sessions`; automatic discovery avoids requiring users to enter these paths manually.

_Full upstream README: https://allmcps.com/mcp/baton-2/readme_

