Git Branch History MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Git Branch History MCP Server
An MCP (Model Context Protocol) server that manages Claude conversation history per Git branch. When you switch branches, Claude automatically loads the relevant context. When history gets too long, it compacts and summarizes.
Features
Branch-aware history — Each Git branch has its own conversation context
Auto-detect branch — Detects current branch via
git branch --show-currentAuto-compact — Warns when approaching token limits, supports compaction with snapshot backup
Docker Desktop MCP Toolkit — Installs as a server in Docker Desktop's MCP Toolkit
Persistent storage — SQLite database persisted via Docker volume
Snapshots — Old history saved before compaction for reference
Host path mapping — Translates host filesystem paths to container paths automatically
Related MCP server: memory-mcp
Tools
Tool | Description |
| Detect current branch and check if history exists |
| Save/append conversation context to current branch |
| Load conversation history for current/specified branch |
| Replace history with a summary (saves snapshot of old) |
| List all branches with saved history and stats |
| Delete a branch's history permanently |
| Detect branch switches and auto-load new context |
Setup with Docker Desktop MCP Toolkit
1. Build the Docker Image
docker build -t git-branch-history-mcp .2. Create a Persistent Volume
docker volume create git-branch-history-data3. Create and Import the Catalog
Create a catalog.yaml file:
version: 3
name: git-branch-history
displayName: Git Branch History
registry:
git-branch-history:
description: Manages Claude conversation history per Git branch.
title: Git Branch History
type: server
image: git-branch-history-mcp:latest
tools:
- name: git_history_get_branch
- name: git_history_save
- name: git_history_load
- name: git_history_compact
- name: git_history_list_branches
- name: git_history_delete
- name: git_history_check_switch
env:
- name: MAX_TOKENS
value: "100000"
- name: COMPACT_THRESHOLD
value: "0.75"
- name: HOST_MOUNT_PREFIX
value: /Users/yourname
- name: CONTAINER_MOUNT_POINT
value: /host
volumes:
- '/Users/yourname:/host:ro'
- 'git-branch-history-data:/data'
metadata:
category: developer-tools
tags:
- git
- branch
- history
- context
license: MIT LicenseImportant: Replace /Users/yourname with your actual home directory path.
Import and enable:
docker mcp catalog import catalog.yaml
# When prompted, enter: git-branch-history
docker mcp server enable git-branch-history4. Connect to Your Client
docker mcp client connect claude-code
# Or: docker mcp client connect cursorRestart your client for the tools to appear.
Verify
docker mcp tools ls | grep git_historyManual Docker Run (without MCP Toolkit)
docker run -i --rm \
-v "/Users/yourname:/host:ro" \
-v "git-branch-history-data:/data" \
-e HOST_MOUNT_PREFIX=/Users/yourname \
-e CONTAINER_MOUNT_POINT=/host \
git-branch-history-mcpUsage Workflow
1. Start working on a branch
You: "Check my branch context for /Users/me/projects/my-app"
Claude: [calls git_history_check_switch] -> Detects branch `feature/gift-wrapping`
[calls git_history_load] -> Loads previous context for this branch2. Save progress during conversation
You: "Save our conversation progress"
Claude: [calls git_history_save] -> Saves summary of what was discussed/decided
-> Reports: "Saved. Token usage: 45% (45,000 / 100,000)"3. Switch branches
You: "I switched to the payment-fix branch, load that context"
Claude: [calls git_history_check_switch] -> Detects switch to `fix/payment-ux`
[calls git_history_load] -> Loads payment branch context
"Loading context for fix/payment-ux. Last session: you were fixing the credit card form validation..."4. Compact when approaching limits
Claude: "History is at 78% of token limit. Want me to compact?"
You: "Yes, compact it"
Claude: [summarizes the full history into key points]
[calls git_history_compact] -> Replaces with summary, saves snapshot
"Compacted! Went from 78,000 to 12,000 tokens (85% savings)"Environment Variables
Variable | Default | Description |
|
| Directory for SQLite database |
|
| Maximum token estimate before warning |
|
| Percentage of max before warning (0.0-1.0) |
|
| Host path prefix to strip (e.g., |
|
| Where the host filesystem is mounted in the container |
Architecture
+--------------------------+
| Claude / Claude Code |
| (Client) |
+-----------+--------------+
| stdio (MCP Protocol)
v
+--------------------------+
| Docker Desktop MCP |
| Toolkit Gateway |
+-----------+--------------+
| stdio
v
+--------------------------+
| Git Branch History MCP |
| (Docker Container) |
| |
| +----------------------+ |
| | FastMCP Server | |
| +----------+-----------+ |
| | |
| +----------v-----------+ |
| | SQLite Database | |
| | /data/branch_ | |
| | history.db | |
| +----------------------+ |
| | |
| +----------v-----------+ |
| | Git CLI | |
| | (branch detect) | |
| +----------------------+ |
+--------------------------+
| |
v v
/host (ro) /data (rw)
(your home) (persistent)Database Schema
projects — Tracks repositories by path
branch_histories — One row per branch per project, stores history text
history_snapshots — Backup of old history before compaction
Tips
Your home directory is mounted as read-only (
:ro) for safetyThe
/datavolume persists across container restartsUse
git_history_list_branchesto see all tracked branches and their token usageCompact early and often — don't wait until you hit the limit
The server auto-creates entries for new branches on first access
Add "Check my branch context" to your CLAUDE.md for automatic context loading
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Persistent context for Claude. Your AI always knows your projects and next actions across sessions.
Shared work memory for Claude Code, Codex, Cursor and chat, scoped to each repository.
Share context and questions between Claude instances — VS Code, claude.ai web, and mobile.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides persistent context management for Claude AI coding assistants, allowing you to save and restore conversation context, create checkpoints, and organize information across sessions to prevent losing important work history and decisions during long coding sessions.150 npm137MIT
- AlicenseAqualityDmaintenancePersistent memory and automatic git snapshots for Claude Code, capturing decisions, patterns, and architecture across sessions.1094 npm100MIT
- AlicenseNot gradedqualityAmaintenanceProvides a persistent memory layer for Claude coding assistants, enabling users to save, search, organize, and restore context, decisions, and progress across sessions using channels, checkpoints, and git-aware tracking. Multiple sessions can share the same stored context, so work survives context compaction, resets, or parallel sessions.150 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables persistent context management for Claude AI coding assistants by saving, searching, checkpointing, restoring, and sharing project context across sessions and parallel conversations.150 npmMIT