AI Sessions
Searching and access your AI coding sessions from Claude Code, Gemini CLI, opencode, and OpenAI Codex.
AI Sessions MCP Server
An MCP server that makes sessions from Claude Code, OpenAI Codex, Gemini CLI and opencode available to any MCP compatible client.
Mostly written using Claude Code.
What It Does
Allow AI agents to search, list, and read your previous local coding sessions from multiple CLI coding agents. Useful for:
- Finding past solutions to similar problems
- Reviewing what you worked on recently
- Learning from previous conversations
- Resuming interrupted work
Demo
Installation
Download Pre-built Binary
Download the latest release for your platform from GitHub Releases. Unzip and move the binary somewhere in your path and point your MCP config at that location.
Build from Source
Prerequisites: Go 1.25 or later
cd ai-sessions-mcp
go build -o bin/ai-sessions-mcp ./cmd/ai-sessions-mcp
Move the resulting binary anywhere you like and use that path in your MCP config.
Setup
Claude Code
claude mcp add ai-sessions /path/to/ai-sessions-mcp
Codex CLI
Edit ~/.codex/config.toml
and add:
[mcp_servers.ai_session]
command = "/path/to/ai-sessions-mcp"
Claude Desktop
Add to your Claude Desktop config file (open via Settings
-> Developer
-> Edit Config
)
{
"mcpServers": {
"ai-sessions": {
"command": "/path/to/ai-sessions-mcp"
}
}
}
Restart Claude Desktop to activate.
Usage
Once configured, you can ask:
- "Let's continue my latest sesion from Claude Code"
- "Show me my recent Codex sessions"
- "Search my sessions for authentication bugs"
- "How many times did Claude tell me I was absolutely right yesterday?"
How It Works
The server reads session files stored locally by various CLI coding agents:
- Claude Code:
~/.claude/projects/[PROJECT_DIR]/*.jsonl
- Gemini CLI:
~/.gemini/tmp/[PROJECT_HASH]/chats/session-*.json
- OpenAI Codex:
~/.codex/sessions/
and~/.codex/archived_sessions/
- opencode:
~/.local/share/opencode/storage/
When you ask your AI agent to list or search sessions, it automatically uses these agents to access your session history.
Available Tools
list_available_sources
Shows which AI CLI coding agents have sessions on your system.
list_sessions
Lists recent sessions from all projects (newest first).
Arguments:
source
(optional): Filter byclaude
,gemini
,codex
, oropencode
project_path
(optional): Filter by specific project directorylimit
(optional): Max results (default: 10)
Example: {"source": "claude", "limit": 20}
search_sessions
Searches session content using BM25 ranking. Returns results sorted by relevance score with contextual snippets.
Arguments:
query
(required): Search term (supports multiple keywords)source
(optional): Filter by sourceproject_path
(optional): Filter by projectlimit
(optional): Max results (default: 10)
Example: {"query": "authentication bug"}
Returns: Each match includes:
session
: Session metadata (ID, source, project, timestamp)score
: Relevance score (higher = more relevant)snippet
: Contextual excerpt (~300 chars) showing where the match occurred
get_session
Retrieves full session content with pagination.
Arguments:
session_id
(required): Session ID from list resultssource
(required): Which coding agent created itpage
(optional): Page number (default: 0)page_size
(optional): Messages per page (default: 20)
License
MIT
Related Servers
UUID MCP Provider
Generates timestamp-based unique identifiers using UUID v7.
Mesh Agent MCP Server
Connects to Heurist Mesh APIs to provide access to various blockchain and web3 tools.
Bruno MCP Server
Execute Bruno collections using the Bruno CLI, with support for environment files and detailed test results.
MCP Command Server
A server for securely executing commands on the host system, requiring Java 21 or higher.
WinCC Unified MCP Server
An MCP server for interfacing with SIEMENS WinCC Unified SCADA systems via their GraphQL API.
302AI Custom MCP Server
A customizable MCP service with flexible tool selection and configuration. Requires a 302AI API key.
Uniswap PoolSpy
Tracks newly created Uniswap liquidity pools across nine blockchain networks, providing real-time data for DeFi analysts, traders, and developers.
mcp-graphql
A GraphQL server that supports the Model Context Protocol (MCP), enabling Large Language Models (LLMs) to interact with GraphQL APIs through schema introspection and query execution.
MCP Tools for Open WebUI
An MCP server for Open WebUI that provides tools for secure Python code execution, time, and SDXL image generation.
PowerShell
Execute PowerShell scripts for Windows automation, system maintenance, data processing, and network monitoring.