Longhand — Claude Code MCP server: what it does, how to install
Longhand keeps Claude Code session history on your machine and retrieves it with natural-language queries. It is useful when an old fix or decision needs to be found without API calls.
claude mcp add longhand -- uvx longhandWhat Longhand does
Longhand records Claude Code activity locally, including tool calls, file edits, and reasoning records. It stores that history in SQLite, then lets you search across sessions with fuzzy natural-language queries. Previous context remains available after the original session files are rotated or deleted.
Run longhand setup to ingest existing history, install hooks, and configure MCP. The CLI also provides longhand recall and longhand status, while the server exposes session search and timeline access. Longhand targets Python 3.10+, so that requirement applies when you install it through uvx.
What it helps with
- find an old fix across Claude Code sessions
- recover context after a break
- inspect events from a previous session
- keep Claude Code history in local storage
Example prompts for the agent
- Find the earlier fix for the Stripe webhook problem from last week.
- Show the latest events from the session where authentication changed.
- Summarize the recent sessions for this project.
How to install Longhand
Platform CLI
claude mcp add longhand -- uvx longhanduvx runs the command named after the package; if the README names another one, use uvx --from longhand <command>
Platform CLI
codex mcp add longhand -- uvx longhanduvx runs the command named after the package; if the README names another one, use uvx --from longhand <command>
Config file
{
"mcpServers": {
"longhand": {
"command": "uvx",
"args": [
"longhand"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from longhand <command>
Config file
{
"servers": {
"longhand": {
"type": "stdio",
"command": "uvx",
"args": [
"longhand"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from longhand <command>
Platform CLI
gemini mcp add longhand uvx longhanduvx runs the command named after the package; if the README names another one, use uvx --from longhand <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Longhand
How do I install Longhand in Claude Code?
Run claude mcp add longhand -- uvx longhand.
What does Longhand do?
It keeps Claude Code session history in a local SQLite store and retrieves relevant context through natural-language queries. The server works without API requests.
What does longhand setup configure?
It imports existing history, installs hooks, and configures the MCP server.