MCP server

ai-hist-mcp gives any MCP-capable agent search over its own past sessions, structured session reads, handoffs, and Agent Relay presence.

npx -y ai-hist-mcp

ai-hist-mcp exposes Relayhistory to an agent while it works. It calls the same public SDK operations as the CLI, never opens SQLite directly, and never loads cloud credentials.

Install

claude mcp add ai-hist -- npx -y ai-hist-mcp

Tools

Search and catalog

ToolWhat it does
search_historyFull-text search of indexed prompts and session events.
recent_historyRecent indexed prompts, newest first.
list_sessionsCached session catalog. Never discovers or syncs.
history_statsHow much history is indexed.

One session — each takes a source and session_id

ToolWhat it does
get_sessionThe session's prompts.
get_session_eventsA bounded page of normalized events.
get_session_tool_callsA page of recorded tool calls.
get_session_file_editsA page of recorded file edits.
get_session_markersNon-transcript records: compaction boundaries, system rows, lifecycle events.
get_session_requestsPer-request model usage.
get_session_usageToken usage rollup.
get_session_relationshipsDirect parents and children.
get_session_treeThe full descendant tree.
get_source_capabilitiesWhat one provider's parser can record.

Indexing

ToolWhat it does
discover_sessionsShallow provider discovery; updates the catalog only.
hydrate_sessionFully index one cataloged session.
syncFull ingestion.

Handoffs — need the workspace cloud source connector; see Handoffs

ToolWhat it does
create_handoffA pointer to the caller's current session, with a self-describing resume prompt.
resume_handoffAcquire a handed-off session and return its prompts, events, tool calls, and edits.

Agent Relay presence — live participants, not history

ToolWhat it does
list_relay_agentsWho is on Agent Relay right now.
relay_statusWhether this session is reachable on the relay.
join_relayMake this session reachable by teammates and agents, with an optional public name and description.
leave_relayTake it off the relay again.

The presence tools talk to the local Agent Relay desktop app over its socket (AGENT_RELAY_SOCKET, then ~/.agentworkforce/desktop/relay-socket). If the app isn't running, they return an instruction to open it rather than failing the agent's turn.

Pages and cursors

Every list tool is bounded. When a result has more, it returns a cursor; pass it back unchanged for the next page. Tool-call and file-edit pages always require both source and session_id and never merge two providers' records.

Remote sources

The server reads local history by default. To let it acquire from remote sources, set AI_HIST_PLUGIN_CONFIG to a plugin config file. Loading a plugin adds no tools; it widens what discover_sessions, hydrate_session, and sync can reach. resume_handoff uses the same mechanism: it needs a configured source connector named cloud.