Claude Project History MCP Server

Claude Project History MCP Server

Tracks workflows, tasks, blockers, and decisions locally for Claude Code, using PGlite with no cloud dependencies.

Category
访问服务器

README

Claude Project History MCP Server

Invisible project intelligence for Claude Code. Tracks workflows, tasks, blockers, and decisions locally. Zero Docker. Zero cloud. Just works.

Data lives in PGlite (Postgres WASM) at ~/.cph/db.


Install

git clone https://github.com/the-occom/occom-claude-project-history.git
cd occom-claude-project-history
npm install
npm run build
npm run install-hooks   # wires hooks + daemon + .mcp.json + CLAUDE.md

Register with Claude Code

Daemon mode (recommended)

The install script starts a background daemon and writes .mcp.json automatically:

{
  "mcpServers": {
    "cph": {
      "url": "http://localhost:3741/sse"
    }
  }
}

All Claude Code instances share one daemon process with atomic writes.

Stdio mode (single-session fallback)

{
  "mcpServers": {
    "cph": {
      "command": "node",
      "args": ["/absolute/path/to/occom-claude-project-history/dist/index.js"]
    }
  }
}

Or via npx:

{
  "mcpServers": {
    "cph": {
      "command": "npx",
      "args": ["github:the-occom/occom-claude-project-history"]
    }
  }
}

Daemon

A long-lived background process that owns the PGlite database. All MCP clients connect via HTTP/SSE.

npm run daemon:start     # spawn detached, write PID+port
npm run daemon:stop      # kill by PID, clean up state files
npm run daemon:status    # print running/stopped + port
npm run daemon:restart   # stop + start
node scripts/daemon.js ensure   # start only if not running (used by hooks)

State files live at ~/.cph/:

  • daemon.pid — PID of running daemon
  • daemon.port — port (default 3741, scans to 3751 if busy)
  • daemon.log — stdout/stderr

The first Claude Code hook invocation of the day auto-starts the daemon.


How it works

You do nothing. Claude Code does everything.

At session start, Claude Code calls cph_session_init automatically (via CLAUDE.md). It gets back a minimal context — active tasks, open blockers, relevant decisions — under 600 tokens. Then it works. Tasks, blockers, and decisions are recorded silently as side effects.

The hook system enforces this:

  • PreToolUse on Write/Edit/MultiEdit — blocks file writes if no active task
  • Stop — surfaces incomplete tasks and open blockers at session end
  • post-commit git hook — silently links commits to recent decisions

Atomic writes

State-changing tools (task_start, task_complete, task_cancel, blocker_resolve, blocker_escalate) use SELECT ... FOR UPDATE row locks inside transactions. Safe for concurrent access from multiple Claude Code sessions.


Tools

Session (call these)

Tool When
cph_session_init Start of every session — auto via CLAUDE.md
cph_detect_workflow When on a new branch with no workflow yet
cph_set_depth Once, to set your preferred context depth
cph_status To verify the plugin is working

Workflows

Tool Description
cph_workflow_create Create workflow — do this once per project/branch
cph_workflow_list List all workflows
cph_workflow_summary Task counts, blocker count, estimation accuracy
cph_workflow_update Update name, status, branch pattern

Tasks

Tool When
cph_task_create Before starting any discrete piece of work
cph_task_start Immediately after create — sets status + start time
cph_task_complete When done — provide actual_minutes
cph_task_get Full details including subtasks + blockers
cph_task_list List tasks (paginated, summaries only)
cph_task_update Update title/description/priority

Blockers

Tool When
cph_blocker_create Immediately when blocked — before asking for help
cph_blocker_resolve When unblocked — always provide resolution text
cph_blocker_escalate When blocker needs urgent human attention
cph_blocker_list List open/resolved blockers

Decisions

Tool When
cph_decision_record When choosing between approaches
cph_decision_search Before any architectural choice
cph_decision_get Full details on a specific decision
cph_decision_list List decisions (summaries only)
cph_decision_attach_commit Called by git hook automatically

Context depth

Set once per engineer, remembered forever:

minimal  = active tasks + open blockers (~300 tokens)
standard = + relevant decisions (~600 tokens) ← default
deep     = + teammate activity (~1200 tokens)
# In Claude Code:
cph_set_depth with depth="minimal"

Retrieval design

Lists return IDs + titles only. Full content requires a specific ID lookup. This is intentional — prevents context flood on large projects.

Pattern for using decisions:

  1. cph_decision_search with keyword — get IDs
  2. cph_decision_get with specific ID — get full record

Never load all decisions. Pull what you need.


Data

~/.cph/db/           ← PGlite database
~/.cph/daemon.pid    ← daemon process ID
~/.cph/daemon.port   ← daemon port
~/.cph/daemon.log    ← daemon logs
.cph-workflow        ← current project's workflow ID (gitignored)

Compression runs automatically at session end:

  • Decisions > 30 days: rationale/alternatives discarded, title+decision kept
  • Completed tasks > 7 days: description discarded, timing data kept
  • Resolved blockers > 7 days: description discarded, title+resolution kept

Contributing

After editing TypeScript files in src/, always rebuild before testing:

npm run build

The daemon runs from dist/, not src/. If you skip the build step, your changes won't take effect and you may get confusing version-mismatch restarts.


What's deliberately NOT here

  • No GraphQL — direct PGlite queries until multi-user sync is needed
  • No cloud sync — single-user local only; team sync is the paid tier
  • No ML inference — estimation intelligence is server-side (paid tier)
  • No semantic search — structural matching only; local LLM is enterprise tier
  • No auth — local tool, no auth needed

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选