Baton logo

Baton

Convert coding-agent transcripts between supported formats and continue sessions with another agent.

Install Baton

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "baton-2": {
      "command": "npx",
      "args": [
        "-y",
        "@kasabeh/baton-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

The install command installed and started the server, which then stopped for configuration (such as an API key) that our sandbox does not have — expected for servers that connect to your account.

npx -y @kasabeh/baton-mcp

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 8d ago.

Overview

The baton MCP server lets coding agents list, inspect, convert, and import sessions across supported agent formats. It reads transcripts into a shared session model, then writes them in the target agent's format or runs that agent's import command. Use it when you need to move work between Claude Code, OpenCode, Codex CLI, and other supported agents without manually rewriting the session context.

Use cases

  • Transfer a Claude Code session to OpenCode when changing agents
  • Import a converted session into a target agent
  • List coding-agent sessions stored on a machine
  • Detect the format of an unknown session file
  • Archive sessions in a supported transcript format

Key features

  • Cross-agent session conversion
  • Canonical intermediate session representation
  • Automatic latest-session discovery
  • MCP tools for listing and importing sessions
  • Agent MCP configuration installation and diagnostics

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

4/4 checks healthy over the last 45d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 7d ago via OSV.dev · @kasabeh/baton-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars27Stargazers on the source repository.
npm downloads326Package downloads in the last 30 days.
Last commit7d agoMost recent push to the default branch.
Install checkRunsOur sandbox started it; it then asked for an API key or config.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Baton works

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.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Baton

baton is an MCP server that connects AI coding agents to local session transcripts and target-agent import commands. Its main tools are `list_sessions`, `convert_session`, `import_to_target`, and `detect_format`, covering session discovery, format conversion, importing, and format detection across supported coding-agent formats.

Install it with npm, Homebrew, Cargo binstall, Cargo, the shell installer, or a GitHub Release binary. Run `baton install` to register it in detected agents' MCP configurations, then use `baton doctor` to verify the installation.

Run `baton convert --from <source> --to <target> <session-file>`, or add `--latest` to select the newest source session automatically. Add `--import` to run the target agent's import command after conversion.

baton reads sessions from Claude Code, OpenCode, Codex CLI, Gemini CLI, Zed, Aider, Cursor exports, Continue, and Cline or Roo. Writers are listed for Claude Code, OpenCode, Codex, Zed, Aider, and Gemini CLI; the other listed formats do not have writers in the README.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewBaton AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/baton-2?style=directory)](https://allmcps.com/mcp/baton-2)
HTML Embed
<a href="https://allmcps.com/mcp/baton-2"><img src="https://allmcps.com/api/badge/baton-2?style=directory" alt="Baton on AllMCPs" /></a>