MCP server that checkpoints Claude Code session context to survive crashes and token limits
Runs on your machine from its package; the steps are below.
Not assessed yet.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
npx -y claude-checkpoint-mcp
MCP client config
{
"mcpServers": {
"claude-checkpoint": {
"command": "npx",
"args": [
"-y",
"claude-checkpoint-mcp"
]
}
}
}Save your Claude Code session state locally, so a crash, /clear, or context limit doesn't make Claude rebuild context from scratch.
claude-checkpoint-mcp is a local Model Context Protocol server with two tools:
save_session_checkpoint writes your session's working state to a small JSON file in the project.load_session_checkpoint turns that file back into a compact resume brief.It runs entirely on your machine. Nothing is sent anywhere.
.claude-checkpoint fileA long Claude Code session builds up a lot of context:
Several things can wipe that out mid-task:
/clear to get a fresh window.The next session starts cold. To get back to where you were, Claude has to rebuild that context:
grep, git diff, ls, test runs, all just to rediscover state.Each of those turns resends the growing conversation as input, so the cost compounds.
claude-checkpoint-mcp swaps that rebuild for one small, structured read:
| Without a checkpoint | With load_session_checkpoint | |
|---|---|---|
| Restoring the goal & constraints | You retype them, or Claude infers them | One section of the brief |
| Knowing what's done vs. pending | Re-derived from code and git | Task list with statuses |
| Knowing which files matter | Broad re-reading | Exact list of touched files, with notes |
| Knowing what changed since | Re-read everything to be safe | Only files whose content actually changed are flagged |
| Remembering failed attempts | Often repeated | Recorded under Decisions & gotchas |
The resume brief for a typical session is about 1.2 KB of markdown, a few hundred tokens. The example below is real output at that size.
The biggest saving comes from drift detection. At save time, the server records a content hash for every file with uncommitted changes. On load, it compares those hashes against the working tree and tells Claude exactly which files changed after the checkpoint. Everything else in the brief can be trusted as-is, so Claude re-reads only what it has to.
Session 1 Session 2 (after crash / /clear)
───────── ────────────────────────────────
Claude ──save_session_checkpoint──┐ ┌──load_session_checkpoint── Claude
goal, tasks, summary, │ │ compact markdown brief
next steps, decisions, ▼ │ + "changed since checkpoint"
files, commands ┌─────────────────────┐
│ <project>/ │
server adds: │ .claude-checkpoint │◀── git: branch, HEAD,
git branch/HEAD, │ .claude-checkpoint │ dirty files + hashes
dirty files + hashes, │ .prev (backup) │
redacts secrets └─────────────────────┘
Requirements: Node.js 20+ and git. Git is optional, but without it you lose drift detection.
git clone https://github.com/tenlean/claude-checkpoint-mcp.git
cd claude-checkpoint-mcp
npm install
npm run build
The server entry point is now at dist/index.js.
As a plugin (easiest). This repo is also a Claude Code plugin marketplace. You don't need to clone or build anything:
claude plugin marketplace add tenlean/claude-checkpoint-mcp
claude plugin install claude-checkpoint-mcp@tenlean
Restart Claude Code, then /mcp should show plugin:claude-checkpoint-mcp:claude-checkpoint as connected.
Manual setup. If you cloned the repo, register the server once for your user account, so it's available in every project:
# Run from the claude-checkpoint-mcp directory
claude mcp add --scope user checkpoint -- node "$PWD/dist/index.js"
Use an absolute path. A user-scoped server is launched from whichever project you open Claude Code in. A relative path like
./dist/index.jswould resolve against that project, not this repo."$PWD/dist/index.js"expands to the absolute path when you run the command, which is what gets saved.
Check that it's registered:
claude mcp list
Inside a session, /mcp should show checkpoint as connected.
Project-scoped alternative. To share the server with a team through version control, add it to the project's .mcp.json:
{
"mcpServers": {
"checkpoint": {
"command": "node",
"args": ["/absolute/path/to/claude-checkpoint-mcp/dist/index.js"]
}
}
}
Either way, add the checkpoint files to the project's .gitignore, or to your global gitignore:
.claude-checkpoint*
claude_desktop_config.json)Open the config file:
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
Add the server under mcpServers, using the absolute path to your local build:
{
"mcpServers": {
"checkpoint": {
"command": "node",
"args": ["/absolute/path/to/claude-checkpoint-mcp/dist/index.js"],
"env": {
"CHECKPOINT_PROJECT_ROOT": "/absolute/path/to/your/project"
}
}
}
}
Restart Claude Desktop after saving the file.
Claude Desktop has no notion of a "current project". Use
CHECKPOINT_PROJECT_ROOTto set the default project, or have Claude passprojectRooton each call ("save a checkpoint for /home/me/code/my-app"). See project root resolution.
Any MCP client that supports the stdio transport can run the server:
node /absolute/path/to/claude-checkpoint-mcp/dist/index.js
The server's built-in instructions cover the common cases automatically. You can also ask Claude directly.
Save:
Resume (in a fresh session):
This is real output from load_session_checkpoint. In the scenario, one file was committed unchanged after the save, and a teammate then edited session.ts:
# Resuming: my-app (checkpoint saved 2m ago, 2026-10-08 02:23:55 UTC)
Branch `feat/github-oauth` @ b2ef1b591 (uncommitted changes)
## Goal
Add GitHub OAuth login with persistent sessions
## Tasks
- [x] OAuth callback route
- [~] Session cookie persistence
- [ ] Logout endpoint
## Where things stand
Callback exchanges the code and creates a session, but the cookie is dropped on reload. Suspect SameSite/secure flags in dev.
## Next steps
1. Set sameSite: 'lax' and secure only in production in src/auth/session.ts
2. Re-run npm test -- auth
3. Start the logout endpoint
## Decisions & gotchas
- Use iron-session, not express-session (needs edge runtime support)
- Don't mock the GitHub API in e2e tests; use the recorded fixtures in test/fixtures
## Files touched (3)
- src/auth/session.ts (M) — cookie options
- src/auth/callback.ts (M)
- src/auth/session.spec.ts (??)
## Recent commands (last 2, oldest first)
- ✓ `GITHUB_CLIENT_SECRET=«redacted» npm run dev`
- ✗ exit 1 `npm test -- auth` — 2 failing in session.spec.ts: cookie missing after reload
## Since this checkpoint
- 1 new commit(s) on HEAD
- ⚠ Changed after the checkpoint, re-read before editing: `src/auth/session.ts`
callback.ts was committed after the save, but its content didn't change, so it isn't flagged. Only session.ts needs to be re-read.
Task markers: [x] done · [~] in progress · [ ] pending · [!] blocked.
save_session_checkpointWrites <projectRoot>/.claude-checkpoint.
| Parameter | Type | Required | Description |
|---|---|---|---|
goal | string (≤ 500) | ✅ | Primary objective of the session |
tasks | { description, status }[] (≤ 30) | status: pending · in_progress · done · blocked | |
summary | string (≤ 4000) | Where things stand: what works, what's broken, what you were in the middle of | |
nextSteps | string[] (≤ 20) | Ordered next actions for whoever resumes | |
decisions | string[] (≤ 20) | Key decisions, constraints, dead ends to avoid | |
modifiedFiles | { path, note? }[] (≤ 100) | Files to annotate, or committed files to include. Uncommitted git changes are detected automatically. Absolute paths inside the project are stored as relative. | |
recentCommands | { command, exitCode?, note? }[] (≤ 50) | Significant commands, oldest first. Secrets are redacted. | |
mode | "replace" | "merge" | Default replace. See below. | |
projectRoot | string (absolute) | Overrides root resolution |
Full save:
{
"goal": "Add GitHub OAuth login with persistent sessions",
"tasks": [
{ "description": "OAuth callback route", "status": "done" },
{ "description": "Session cookie persistence", "status": "in_progress" },
{ "description": "Logout endpoint", "status": "pending" }
],
"summary": "Callback exchanges the code and creates a session, but the cookie is dropped on reload. Suspect SameSite/secure flags in dev.",
"nextSteps": [
"Set sameSite: 'lax' and secure only in production in src/auth/session.ts",
"Re-run npm test -- auth"
],
"decisions": ["Use iron-session, not express-session (needs edge runtime support)"],
"modifiedFiles": [{ "path": "src/auth/session.ts", "note": "cookie options" }],
"recentCommands": [
{ "command": "GITHUB_CLIENT_SECRET=gh_live_8f2a91 npm run dev", "exitCode": 0 },
{ "command": "npm test -- auth", "exitCode": 1, "note": "2 failing in session.spec.ts" }
]
}
Response (text shown to the model):
Checkpoint saved to /home/me/code/my-app/.claude-checkpoint (2202 bytes, replace).
3 task(s), 3 file(s), 2 command(s) on feat/github-oauth@b2ef1b591.
⚠ Redacted 1 secret-looking value(s).
Incremental update with merge:
{
"goal": "Add GitHub OAuth login with persistent sessions",
"mode": "merge",
"tasks": [
{ "description": "Session cookie persistence", "status": "done" },
{ "description": "Logout endpoint", "status": "in_progress" }
],
"recentCommands": [{ "command": "npm test -- auth", "exitCode": 0, "note": "all green" }]
}
| Field | replace | merge |
|---|---|---|
goal | set | set |
tasks | set | updated by matching description; new tasks appended |
summary, nextSteps | set | replaced if provided, otherwise kept |
decisions | set | appended (deduplicated) |
recentCommands | set | appended; the oldest are dropped beyond 50 |
modifiedFiles | fresh git scan + provided | fresh git scan + provided + previously recorded |
id, createdAt | new | preserved |
Structured output (structuredContent):
{
"path": "/home/me/code/my-app/.claude-checkpoint",
"bytes": 2202,
"mode": "replace",
"counts": { "tasks": 3, "modifiedFiles": 3, "recentCommands": 2, "redactions": 1 },
"warnings": ["Redacted 1 secret-looking value(s)."]
}
load_session_checkpointRead-only. Reads the checkpoint, checks for drift, and returns the brief.
| Parameter | Type | Required | Description |
|---|---|---|---|
format | "brief" | "full" | Default brief (markdown, as above). full returns the complete checkpoint JSON plus drift. | |
projectRoot | string (absolute) | Overrides root resolution |
Examples:
{}
{ "format": "full", "projectRoot": "/home/me/code/my-app" }
Structured output (structuredContent):
{
"found": true,
"path": "/home/me/code/my-app/.claude-checkpoint",
"fromBackup": false,
"updatedAt": "2026-10-08T02:23:55.477Z",
"drift": {
"branchChanged": false,
"currentBranch": "feat/github-oauth",
"commitsSince": 1,
"changedSince": ["src/auth/session.ts"]
},
"warnings": []
}
If no checkpoint exists, the tool returns found: false with a "nothing to resume" message. That isn't treated as an error.
projectRoot argumentCHECKPOINT_PROJECT_ROOT environment variablefile:// root, if the client supports MCP rootsThe path must be absolute and must be an existing directory. Symlinks are resolved. The file is always written at exactly <root>/.claude-checkpoint.
.claude-checkpoint fileThis is plain, versioned JSON, so it's easy to read, diff, or edit by hand. Real example:
{
"version": 1,
"id": "ee5507c0-855e-44a5-85c1-d97b767537c9",
"createdAt": "2026-10-08T02:23:55.477Z",
"updatedAt": "2026-10-08T02:23:55.477Z",
"generator": { "name": "claude-checkpoint-mcp", "version": "0.1.0" },
"project": { "name": "my-app" },
"git": {
"branch": "feat/github-oauth",
"head": "b2ef1b5919ee5d456ea146c9362a7abc92b1e556",
"dirty": true
},
"goal": {
"primary": "Add GitHub OAuth login with persistent sessions",
"tasks": [
{ "description": "OAuth callback route", "status": "done" },
{ "description": "Session cookie persistence", "status": "in_progress" },
{ "description": "Logout endpoint", "status": "pending" }
]
},
"summary": "Callback exchanges the code and creates a session, but the cookie is dropped on reload. Suspect SameSite/secure flags in dev.",
"nextSteps": [
"Set sameSite: 'lax' and secure only in production in src/auth/session.ts",
"Re-run npm test -- auth",
"Start the logout endpoint"
],
"decisions": [
"Use iron-session, not express-session (needs edge runtime support)",
"Don't mock the GitHub API in e2e tests; use the recorded fixtures in test/fixtures"
],
"modifiedFiles": [
{ "path": "src/auth/session.ts", "status": "M", "source": "git", "note": "cookie options", "hash": "9ec893ef673dac860e7e2b6fcaad602983eeb0b1" },
{ "path": "src/auth/callback.ts", "status": "M", "source": "git", "hash": "f3ecc849c3875d4f11bb42ae0e5ab6c71931d7f1" },
{ "path": "src/auth/session.spec.ts", "status": "??", "source": "git", "hash": "9daeafb9864cf43055ae93beb0afd6c7d144bfa4" }
],
"recentCommands": [
{ "command": "GITHUB_CLIENT_SECRET=«redacted» npm run dev", "exitCode": 0, "at": "2026-10-08T02:23:55.477Z" },
{ "command": "npm test -- auth", "exitCode": 1, "note": "2 failing in session.spec.ts: cookie missing after reload", "at": "2026-10-08T02:23:55.477Z" }
],
"meta": { "redactions": 1, "truncated": false }
}
| Field | Notes |
|---|---|
version | Schema version. Older versions are migrated on load; unknown versions are rejected. |
id / createdAt | Stable across merge saves; new on replace |
git | null outside a git repo, or before the repo's first commit |
modifiedFiles[].status | Git porcelain code (M, A, D, R, ??), or M for files reported only by Claude |
modifiedFiles[].source | git (detected) or agent (reported by Claude, or carried over from an earlier merge) |
modifiedFiles[].hash | Git blob hash of the working-tree content at save time; drives drift detection |
meta.truncated | true if anything was dropped to fit list or size limits |
Paths are always relative to the project root. The file never stores absolute paths.
Local only. There are no network calls. The server reads git metadata and one file, and writes one file.
Secret redaction. The following are replaced with «redacted» in commands, notes, summaries, tasks and decisions before anything touches disk:
*_KEY=, *_TOKEN=, *_SECRET=, *PASSWORD= assignments, including Header: value and JSON formsAuthorization: Bearer … headerspostgres://user:pass@…)--password / --token / --api-key / --secret flagssk-…, ghp_…, github_pat_…, AKIA… and xox?-… tokensRedaction is a safety net, not a guarantee, so keep the file out of version control.
Owner-only, crash-safe writes. Files are written with mode 0600. Each save writes a temp file, fsyncs it, and renames it into place, so a crash mid-save can't leave a half-written checkpoint.
Automatic backup. The previous valid checkpoint is kept as .claude-checkpoint.prev. If the main file is corrupt, load falls back to the backup and says so. A corrupt file never overwrites a good backup.
Bounded size. Every field has a length cap, and the file is capped at 64 KB (the oldest commands are dropped first), so a checkpoint can't grow into a token sink.
No shell. Git runs through execFile with a 3-second timeout and GIT_OPTIONAL_LOCKS=0, so it never contends with your own git commands.
Doesn't touch your config. If the checkpoint isn't git-ignored, the save response warns you. It never edits .gitignore for you.
Safe with parallel tool calls. Tool calls are serialized inside the server, so concurrent merge saves can't lose updates.
| Symptom | Fix |
|---|---|
checkpoint doesn't appear in /mcp | Run claude mcp list and check that the path is absolute and dist/index.js exists (npm run build). |
| Checkpoint is written to the wrong directory | The server fell back to its working directory. Pass projectRoot, or set CHECKPOINT_PROJECT_ROOT. |
projectRoot must be an absolute path | Use a full path such as /home/me/code/app, not ./app. |
| Brief says "Saved commit … is no longer reachable" | The branch was rebased or reset after the save. Drift can't be computed against history, so treat the flagged files as needing a re-read. |
| Warning: "not git-ignored" | Add .claude-checkpoint* to .gitignore. |
| No "Since this checkpoint" section | The project isn't a git repo, or had no commits at save time. |
Server logs go to stderr. Stdout is reserved for the MCP protocol.
npm run typecheck # strict TypeScript, src + tests
npm test # unit tests + in-memory MCP end-to-end tests (vitest)
npm run build # compile to dist/
npm run inspect # open the MCP Inspector against dist/index.js
src/
├── index.ts # entry point: stdio transport, signals, stderr logging
├── server.ts # McpServer construction + server instructions
├── tools.ts # save/load tool schemas and handlers
├── schema.ts # zod schema for the checkpoint file (v1) + migrations
├── store.ts # project root resolution, atomic I/O, backup/fallback
├── git.ts # branch/HEAD/status snapshot, blob hashing, drift detection
├── redact.ts # secret scrubbing
└── render.ts # checkpoint → markdown resume brief
Built with the official @modelcontextprotocol/sdk and zod.