Skip to main content
Glama

session-relay-mcp

License: MIT Python 3.10+ MCP

Pass the baton between AI coding agents. session-relay-mcp reads the session stores that Codex, Claude Code, Antigravity, OpenCode, Freebuff and Grok already keep on your machine and turns them into inspectable history plus a one-call handoff brief — no cloud service and no copy-pasting context between agents.

Why

Every harness writes its own private session format. When one agent gets stuck, the next one starts blind: what was the goal, which files changed, what failed? This MCP server answers those questions from local files, so an operator or a different agent can resume the work immediately.

  • Cross-harness — one interface over six local stores.

  • Strictly read-only — SQLite is opened mode=ro with query_only, JSONL and JSON are only read. Stores are fingerprinted in tests to prove nothing is written.

  • Baton-pass brief — handoff_context returns Goal, Files touched, Last observed state, Blocker and Suggested next steps as markdown.

  • Bounded — giant Freebuff chats (hundreds of MB) are read from a capped tail; search has a byte budget.

Related MCP server: ai-r

Supported harnesses

Harness

Source

Notes

Codex

~/.codex/thread_history_1.sqlite

Turns, messages, shell/file/MCP tool items, turn errors

Claude Code

~/.claude/projects/*/*.jsonl

User/assistant turns, tool_use and tool_result blocks

Antigravity

~/.gemini/antigravity/brain/*/.system_generated/logs/transcript.jsonl

Planner responses, tool calls, error messages

OpenCode

~/.local/share/opencode/opencode.db

Sessions, messages, text/tool/patch parts

Freebuff / Manicode

~/.config/manicode/projects/*/chats/*/chat-messages.json

Chat blocks and tool calls; falls back to message-history.json

Grok

~/.grok/sessions/session_search.sqlite + prompt_history.jsonl

Prompt history and search index; Grok stores no tool events there

Missing or empty stores return friendly empty states with warnings instead of errors.

Install

pipx install .
# or
uv tool install .
# or a plain virtual environment
python3 -m venv .venv && .venv/bin/pip install .

Installing exposes the session-relay console script; python3 -m session_relay.server works without it.

MCP client setup

The server speaks MCP over stdio and needs no arguments.

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "session-relay": { "command": "session-relay", "args": [] }
  }
}

Codex (~/.codex/config.toml):

[mcp_servers.session-relay]
command = "session-relay"
args = []

Cursor (~/.cursor/mcp.json):

{
  "mcpServers": {
    "session-relay": { "command": "session-relay", "args": [] }
  }
}

Antigravity (~/.gemini/config/mcp_config.json):

{
  "mcpServers": {
    "session-relay": { "command": "session-relay", "args": [] }
  }
}

OrquestraAI (~/.orquestra/mcps.json):

"session-relay": {
  "id": "session-relay",
  "name": "Session Relay (Cross-Harness)",
  "description": "Read-only cross-harness session inspection and handoff briefs.",
  "command": "session-relay",
  "args": [],
  "env": {},
  "globalEnabled": true,
  "enabledHarnesses": []
}

Tools

Tool

Inputs

Returns

list_recent_sessions

harness?, limit? (default 5)

{count, sessions[], warnings[]} newest first

inspect_session

harness, session_id? (default latest), max_turns? (default 10)

{session, event_count, events[]}

handoff_context

source_harness, session_id?

Markdown brief with goal, files, state, blocker and next steps

search_sessions_history

query, harness?, limit? (default 10)

{query, count, hits[], warnings[]} with snippets

Harness ids: codex, claude, antigravity, opencode, freebuff, grok (aliases: claude-code, gemini, manicode, open-code, xai).

Example workflow

list_recent_sessions(limit=5)
inspect_session(harness="codex", session_id="latest", max_turns=3)
handoff_context(source_harness="codex")
search_sessions_history(query="deploy", harness="claude")

Configuration

Variable

Default

Purpose

SESSION_RELAY_HOME

$HOME

Alternate home root, useful for fixtures and tests

No configuration is required for normal use.

Known limits

  • Freebuff chats over 16 MB expose only their last 12 MB; turn counts above 4 MB fall back to the chat's recorded message count.

  • Grok's local index contains prompts, not assistant or tool events, so its briefs are goal-focused.

  • Codex search scans item text in a large database; expect a few hundred milliseconds on very large histories.

Development

python3 -m venv .venv
.venv/bin/pip install -e . pytest
.venv/bin/python -m pytest tests/ -q
bash scripts/check-file-size.sh

License

MIT — see LICENSE.

Available Tools

4 tools
handoff_contextC

Generate an executive handoff brief (goal, files, blocker, next steps) for a session.

NameRequiredDescriptionDefault
session_idNolatest
source_harnessYes

Output Schema

NameRequiredDescription
resultYes
inspect_sessionC

Read a session's ordered conversation and tool events. session_id defaults to the newest one.

NameRequiredDescriptionDefault
harnessYes
max_turnsNo
session_idNolatest

Output Schema

NameRequiredDescription

No output parameters

list_recent_sessionsA

List recent sessions across harnesses (codex, claude, antigravity, opencode, freebuff), newest first.

NameRequiredDescriptionDefault
limitNo
harnessNo

Output Schema

NameRequiredDescription

No output parameters

search_sessions_historyC

Keyword search across session message texts in one or every harness.

NameRequiredDescriptionDefault
limitNo
queryYes
harnessNo

Output Schema

NameRequiredDescription

No output parameters

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observedhandoff_context
    • First observedinspect_session
    • First observedlist_recent_sessions
    • First observedsearch_sessions_history

TDQS

B3.3/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: listing sessions, inspecting a single session in detail, generating a handoff brief, and searching message text. The boundaries are sharp; an agent can easily pick the right tool for each task.

Naming Consistency4/5

All names use snake_case with a verb-first pattern (list_recent_sessions, inspect_session, handoff_context, search_sessions_history). Minor deviations like the adjective in list_recent_sessions and the compound object in search_sessions_history are readable but not perfectly uniform.

Tool Count4/5

Four tools is a reasonable, focused set for a session relay/inspection server. Each tool earns its place, though the surface is slightly lean for covering five harnesses and multiple session operations.

Completeness4/5

Core read-and-summarize workflows are covered: listing, deep inspection, keyword search, and handoff brief generation. Minor gaps exist, such as no tool to actually relay/export a session or fetch lightweight metadata, but agents can work around these.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Provides a read-only interface to audit and continue coding agent sessions by extracting plans, intents, and edit authorship from history across multiple agents (Claude, Codex, OpenCode, Antigravity, Pi) via MCP, CLI, and Python SDK.
    18
    30 PyPI
    3
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Search past OpenCode conversation history before starting new work on a module or file, via a local read-only FTS5 index built from OpenCode's own SQLite database. No network calls, fully local. 7 tools for keyword search, file lookup, and session browsing.
    7
    43 PyPI
    4
    MIT