agent-checkpoint-mcp

agent-checkpoint-mcp

A local MCP server that saves work-in-progress checkpoints to SQLite, enabling AI agents to resume interrupted sessions without redoing work.

Category
访问服务器

README

agent-checkpoint-mcp

Never lose your place when an AI agent session gets cut off.

A tiny, 100% local MCP server that saves work-in-progress checkpoints to SQLite. When a session dies mid-plan — context limit hit, quota exhausted, laptop closed — the next session (same agent or a different one: Claude Code, Codex, Cursor) reads the exact state and continues from the last sub-task instead of redoing work.

  • Local-first: SQLite on your machine. No network calls, no API keys, no LLM, zero cost.
  • Cross-agent: checkpoints are keyed by project directory, so Claude Code can resume what Codex started.
  • Cross-platform: macOS (incl. Apple Silicon), Linux, Windows. Python 3.11+, single dependency (mcp).

The problem

You're 40 minutes into a 6-step plan. The session hits the context limit and compacts — or your quota runs out and you switch agents. The new session sees the plan, maybe, but not that step 3 was half done: the migration file was written but not applied, two of five tests were fixed. So it starts step 3 over. This server makes "exactly where were we?" a tool call.

Install (one command)

macOS / Linux

curl -fsSL https://raw.githubusercontent.com/DiegoWare/agent-checkpoint-mcp/main/install/install.sh | bash

Windows (PowerShell)

irm https://raw.githubusercontent.com/DiegoWare/agent-checkpoint-mcp/main/install/install.ps1 | iex

That single command does everything:

  1. Installs the package with uv, pipx, or pip --user (whichever you have).
  2. Detects installed agents — Claude Code, Cursor, Codex — and registers the server in each one's MCP config (non-destructively).
  3. Installs the Claude Code recovery hooks (see below): every new, resumed, or compacted session automatically receives the latest checkpoint, and an emergency checkpoint is saved right before every compaction.
  4. Prints what it changed. Restart your agent and everything is live.

Re-running the installer upgrades and re-registers.

Don't want a piece of it? Everything is reversible with one command:

agent-checkpoint-mcp uninstall --hooks   # remove the Claude Code hooks only
agent-checkpoint-mcp uninstall --mcp     # remove the MCP registrations only
agent-checkpoint-mcp uninstall           # remove both

(Or skip hooks at install time: AGENT_CHECKPOINT_NO_HOOKS=1 curl ... | bash, and agent-checkpoint-mcp setup --no-hooks thereafter. --dry-run previews any of these without writing.)

Prefer manual control end to end?

pipx install agent-checkpoint-mcp   # or: uv tool install agent-checkpoint-mcp
agent-checkpoint-mcp setup          # same as the installer's registration step

Or register by hand — the server command is just agent-checkpoint-mcp:

// Claude Code (~/.claude.json) and Cursor (~/.cursor/mcp.json)
{ "mcpServers": { "agent-checkpoint": { "command": "agent-checkpoint-mcp", "args": [] } } }
# Codex (~/.codex/config.toml)
[mcp_servers.agent-checkpoint]
command = "agent-checkpoint-mcp"
args = []

Tools

Tool What it does
save_checkpoint(plan, current_step, total_steps, step_status, what_was_done, what_remains) Save progress. Designed to be called after every sub-task (a file edited, a test passing), not just when a numbered step completes.
get_checkpoint() The latest checkpoint for this project, formatted as a resume brief: current step, what's done (don't redo), the exact next action, remaining steps.
list_checkpoints(limit=20) Session history with timestamps, newest first.
clear_checkpoints(confirm=false) Wipe this project's history. Dry-run by default; requires confirm=true to delete.

All tools take an optional project_dir override. By default the project is detected from the server's working directory, walking up to the nearest .git root — so checkpoints saved from repo/src/ and repo/ land in the same bucket, and different projects never mix.

Example flow

Session A (Claude Code, dies at context limit):
  save_checkpoint(plan="1. Schema\n2. Endpoints\n3. Tests", current_step=2,
                  total_steps=3, step_status="in_progress",
                  what_was_done="- schema migrated\n- POST /users done",
                  what_remains="- GET /users/:id handler, then wire router")

Session B (Codex, next morning):
  get_checkpoint()
  → # Resume point — step 2/3 (in_progress)
    ## What was already done (do NOT redo this) ...
    ## What remains in the current step — continue HERE ...

How recovery works

Two mechanisms, both installed automatically by the one-command installer:

Claude Code hooks (installed for you)

The installer merges two hooks into ~/.claude/settings.json (non-destructively — your existing hooks are untouched):

  • SessionStart (startup|resume|compact) runs agent-checkpoint-mcp show, which prints the latest checkpoint — Claude Code injects that output into the fresh context. The resuming agent knows where it left off without even calling a tool. This is the main recovery mechanism.
  • PreCompact runs agent-checkpoint-mcp precompact-snapshot, which parses the session transcript locally (last todo-list state + last assistant messages) and stores an emergency checkpoint right before compaction. Honest caveat: hooks can't force the model to call an MCP tool, so this snapshot is reconstructed from the transcript — cruder than a proper save_checkpoint, but it means even a session that never saved manually leaves a trail.

Remove them anytime with agent-checkpoint-mcp uninstall --hooks. To merge them by hand instead (e.g. per-project in .claude/settings.json), use examples/claude-settings-hooks.json.

Per-project instructions (one command per project)

For the best checkpoints — saved deliberately after every sub-task, not just recovered from transcripts — run this once inside a project:

agent-checkpoint-mcp init

It appends a checkpoint-discipline section to the project's CLAUDE.md and AGENTS.md (creating them if needed, skipping if already present). The key rule it teaches: save after every concrete sub-task, and call get_checkpoint first when a task looks like a continuation. Prefer to copy by hand? See examples/.

Where data lives

One SQLite database, keyed by project path — nothing is written inside your repos:

OS Path
macOS ~/Library/Application Support/agent-checkpoint-mcp/checkpoints.db
Linux $XDG_DATA_HOME/agent-checkpoint-mcp/checkpoints.db (default ~/.local/share/...)
Windows %LOCALAPPDATA%\agent-checkpoint-mcp\checkpoints.db

Override with the AGENT_CHECKPOINT_HOME environment variable.

CLI

agent-checkpoint-mcp                      # run the MCP server (stdio) — what agent configs execute
agent-checkpoint-mcp show [--project D]   # print the latest checkpoint (used by the SessionStart hook)
agent-checkpoint-mcp list [--project D]   # checkpoint history
agent-checkpoint-mcp clear [--yes]        # delete this project's checkpoints
agent-checkpoint-mcp init [--project D]   # add checkpoint instructions to CLAUDE.md/AGENTS.md
agent-checkpoint-mcp setup [--no-hooks]   # (re)register with detected agents + install hooks
agent-checkpoint-mcp uninstall [--hooks|--mcp]  # remove what setup installed
agent-checkpoint-mcp precompact-snapshot  # used by the PreCompact hook (hook JSON on stdin)

setup and uninstall accept --dry-run to preview changes without writing.

Development

git clone https://github.com/DiegoWare/agent-checkpoint-mcp
cd agent-checkpoint-mcp
python3 -m venv .venv && .venv/bin/pip install -e '.[dev]'
.venv/bin/pytest

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选