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.

ParametersJSON Schema
NameRequiredDescriptionDefault
session_idNolatest
source_harnessYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden, and it discloses almost nothing: not whether the brief is persisted or ephemeral, whether generation is costly/slow, what auth or harness access is required, or whether output is deterministic. The one useful signal is that it synthesizes rather than fetches, which is inferable from 'Generate'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence that front-loads the verb and the artifact, then parenthetically enumerates the brief's sections. Zero filler and no restatement of the tool name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return shape is covered and need not be described. But for a tool with a required, entirely undefined parameter and no annotations, the description leaves critical invocation information missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it largely does not. 'For a session' loosely implies session_id (whose 'latest' default lives only in the schema), but source_harness — a REQUIRED parameter — is given no meaning anywhere, leaving the agent unable to supply it correctly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Generate') and a concrete artifact ('executive handoff brief') with its contents enumerated (goal, files, blocker, next steps) and its scope ('for a session'). This clearly separates it from the list/inspect/search siblings, which retrieve rather than synthesize. It stops short of naming any sibling explicitly, so 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No statement of when to prefer this over inspect_session or list_recent_sessions, and no prerequisites or exclusions. 'For a session' is the only contextual hint, and it is too thin to count as guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

inspect_sessionC

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

ParametersJSON Schema
NameRequiredDescriptionDefault
harnessYes
max_turnsNo
session_idNolatest

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. "Read" implies a non-mutating operation and "ordered" conveys result sequencing, but nothing is said about permissions, truncation, how much history is returned, or what happens when a session_id doesn't exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with zero filler, and the core purpose is front-loaded ahead of the default-value note. It is tight, though it spends one of its two sentences on a detail the schema already encodes as a default.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return-value detail is not required, but the tool has a required `harness` parameter that is undocumented in both description and schema, and with no annotations the safety/behavior profile is unstated. For a three-parameter read tool this is insufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, yet the description only clarifies session_id (defaults to the newest session). The required `harness` parameter is never explained anywhere, and max_turns/default 10 is left entirely to the schema, so a critical gap remains.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ("Read") and a well-defined resource (a session's ordered conversation and tool events), which is enough to separate it from list_recent_sessions and search_sessions_history. It stops short of explicitly naming how it differs from those siblings, so it is clear but not fully differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to inspect a session versus listing recent sessions or searching history; the agent must infer that from the verb "Read." No prerequisites, exclusions, or alternative tools are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_recent_sessionsA

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

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
harnessNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses ordering (newest first) and the harness domain, which is genuine behavioral context, but says nothing about permissions, pagination/truncation, or what a limited result set implies.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single compact sentence with the action, scope and ordering front-loaded. Nothing is padded or restated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be described. For a simple two-param list tool, the description covers scope, ordering and the harness domain adequately; the unexplained 'limit' and the lack of sibling routing are the only real gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% for two parameters. The description compensates partially by enumerating valid harness values (codex, claude, antigravity, opencode, freebuff), which the schema lacks as an enum, but it never explains the 'limit' parameter or its default of 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('List recent sessions'), plus scope ('recent'), domain ('across harnesses' with five named values) and ordering ('newest first'). It does not distinguish itself from siblings like search_sessions_history or list-style alternatives, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The word 'recent' and 'newest first' imply the browsing use case, but there is no explicit when-to-use, when-not-to-use, or named alternative. An agent must infer whether this or search_sessions_history is the right entry point.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_sessions_historyC

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

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
harnessNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are absent, so the description carries the full behavioral burden. It implies a read-only search but says nothing about matching semantics (substring, case sensitivity, tokenization), pagination, ordering, or result volume, which matter for a limit-bearing search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no padding or repetition. It is efficient, though its brevity contributes to the gaps noted in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema covers return values, but for a three-parameter search tool with zero schema descriptions and no annotations, the description omits usage routing and parameter meaning. It is under-specified relative to the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it largely does not. 'One or every harness' hints that harness is optional/null, but query and limit (default 10) semantics are left entirely unexplained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: keyword search over session message texts, with the scope of one or every harness. It is clear what the tool does, but it never names or contrasts with siblings like list_recent_sessions, which also surfaces sessions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No when-to-use guidance is given. It is not stated whether this is the right tool when you already know a session id (inspect_session) or want recency rather than keyword matching (list_recent_sessions); the agent must infer that from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

Maintenance

ActivityMaintained
ResponsivenessNo issues

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
    26 PyPI
    3
    MIT
  • A
    license
    A
    quality
    B
    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
    4
    MIT