ContextDeck 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.
ContextDeck
A local-first, Git-backed shared context board for keeping a human mental model and multiple AI coding agent sessions in sync across harnesses.
Working across Claude Code, Codex CLI, Cursor, Grok, Antigravity, and custom local skills creates two failure modes:
Cross-session drift: A decision reached in one agent session never reaches your other live sessions.
Mental-model erosion: Decisions evolve while your diagrams, explainer videos, quizzes, and own understanding quietly go out of date.
ContextDeck stores your project's living context in plain YAML, Markdown, and JSON files (.contextdeck/ in-repo or outside the repo via --global), paired with a local web UI, universal MCP server (stdio and Streamable HTTP), CLI (cdeck), harness lifecycle hooks, local refresh workers, and 1-click Context Packs for browser chats.
For how ContextDeck compares to existing tools, see Prior art.
Core Concepts
Term | Meaning |
Board | A topic, feature, or project workspace stored under |
Lens | A switchable view tab: Catch up, Brief, Sessions, Architecture & Decisions, Tasks, and Media & Mastery. |
Session | A workspace-scoped external agent chat or skill run ( |
Decision | A versioned choice ( |
Artifact | A versioned diagram, video/audio explainer, doc, HTML widget, or quiz referencing governing decisions ( |
Context Pack | A bounded Markdown snapshot of the Board prioritized for MCP agents, hooks, or pasting into web chats. |
Related MCP server: Context Cockpit
What's in v0.2
Human Catch up lens & reader cursors: Tracks what you have and have not seen per reader and per board (
.contextdeck/.runtime/readers/<readerId>.yaml, gitignored, zero reader noise inevents.jsonl). Opening the app lands on Catch up whenever unseen changes exist, showing changed decisions (old -> new), newly stale artifacts, moved tasks, new sessions, and other meaningful changes, with an unseen count badge in the header.Confirm vs. Refresh (no silent clearing): Stale artifacts offer two explicit actions:
Queue refresh (1-tap): creates a deduplicated refresh job (
.contextdeck/boards/<slug>/jobs/<id>.yaml) with atomic claiming, 15-minute lease TTL, claim-bound artifact writes (jobId+ activeleaseToken), and strict completion verification.Still accurate: records an auditable confirmation against the displayed replacement decision (
confirmationsmap) without rewritingbasedOnDecisions. Confirmations reject with409 Conflictif the artifact version or superseding decision changed since display, and automatically re-stale if superseded again. Agent confirmations via MCP require a non-blanknoteand are labeled as agent confirmations.
Versioned artifacts & media pruning: Diagrams, media, and quizzes track
versionand cappedhistory(last 10 versions). Media binaries are stored as immutable<id>.v<N>.<ext>files; quiz updates preserve all past human mastery attempts;cdeck media prunereclaims old media files while protecting current and open-job input files.Local refresh workers (
cdeck worker): Run user-local video-explainer, quiz, or diagram scripts against queued jobs with explicitcdeck worker trustSHA-256 verification andspawn(..., { shell: false }). See Refresh Job Handlers.Per-question quiz staleness & mastery trends: Quiz questions reference
relatedDecisionIdsso only questions affected by a superseded decision are flagged stale, alongside a per-quiz mastery score trend across attempts.Fast, mobile-ready UI with dark/light theme: Heavy visualizations (React Flow, Mermaid, Excalidraw) are lazy-loaded on demand; all 6 lenses fit a
390pxphone viewport with zero horizontal overflow and support dark/light theme switching.
Quickstart
Prerequisites
Node.js
>= 20pnpm >= 9
Install & Build
pnpm install
pnpm build
# Optional: put `cdeck` and `contextdeck` on your PATH globally
pnpm --filter @contextdeck/cli link --globalInitialize & Launch the Demo Board
cdeck init --demo
cdeck servecdeck serve binds to 127.0.0.1:4310 and prints a single-use launch URL (http://127.0.0.1:4310/auth?code=..., valid for 120 seconds). Open that launch URL in your browser to start an authenticated session. Need a fresh link later? Run:
cdeck openWorkspace Storage: In-Repo, Global, and Git Worktrees
In-repo (default):
cdeck initcreates.contextdeck/in your repository and adds.contextdeck/.runtime/,.contextdeck/.cache/, and.contextdeck/.lockto.gitignore. Entities stay plain YAML/Markdown/JSON so teams can diff and review context in Git.Global (out-of-repo):
cdeck init --global <name>stores the deck under~/.contextdeck/workspaces/<name>and writes a tiny.contextdeck.yamlpointer in the project root.Linked git worktrees: ContextDeck resolves linked git worktrees automatically (pure-filesystem
.git→commondirlookup) so parallel agent worktrees share one board without absolute machine paths in config files.Multi-board routing: Declare
pathsglobs and optionalparentBoardinboard.yaml; hooks route sessions to the most specific matching board. Switch default or per-session boards with:cdeck board use <slug> cdeck board use <slug> --session <sessionId>
Connecting Agent Harnesses
All cdeck setup <target> commands merge idempotently into existing project files, never write absolute machine paths, and support --uninstall to remove only ContextDeck-managed entries.
Team prerequisite: Project hook configs (
.claude/settings.json,.codex/hooks.json,.cursor/hooks.json) invokecdeckdirectly, socdeckmust be onPATH.
Harness Capabilities at a Glance
Harness | Setup Command | Automatic | Manual / Notes |
Claude Code |
| Stdio MCP ( | Requires |
Codex CLI |
| Project MCP ( | Requires |
Cursor |
| Stdio MCP ( | No prompt-submit injection — Cursor's |
Grok Bot |
| Project MCP ( | No lifecycle hooks — syncs via MCP tools guided by |
Gemini / Antigravity |
| Stdio MCP ( | No lifecycle hooks — syncs via MCP tools guided by |
Web Chats (Grok Web, ChatGPT, Claude Web) | (none) | — | Use Copy Context Pack and Paste Update in the header (or |
Claude Code
cdeck setup claude-code
cdeck setup claude-code --uninstallMerges contextdeck into .mcp.json and adds SessionStart, UserPromptSubmit, and SessionEnd hooks into .claude/settings.json.
Codex CLI
cdeck setup codex
cdeck setup agents-md
cdeck setup codex --uninstallMerges [mcp_servers.contextdeck] inside # contextdeck:start / # contextdeck:end markers in .codex/config.toml and writes SessionStart, UserPromptSubmit, and SessionEnd hooks into .codex/hooks.json.
Important: After running
cdeck setup codex, open Codex CLI in the repo and run/hooksto review and trust the project hooks. ContextDeck intentionally does not edit your personal~/.codex/config.toml.
Cursor
cdeck setup cursor
cdeck setup cursor --uninstallMerges .cursor/mcp.json, .cursor/hooks.json (sessionStart, throttled postToolUse, sessionEnd), and .cursor/rules/contextdeck.mdc. Because Cursor's beforeSubmitPrompt hook cannot inject additional context, live drift digests are delivered via postToolUse (at most once every 60 seconds per session).
Grok Bot, Antigravity, and AGENTS.md
cdeck setup grok
cdeck setup antigravity --apply
cdeck setup agents-mdRefresh Jobs & Local Workers
Queue refreshes from the UI (Queue refresh) or CLI:
cdeck job create media art_explainer --reason "Updated after dec_003"
cdeck job listTo process queued jobs locally with your own scripts or skills (video explainers, quiz generators, diagram pipelines), configure user-local ~/.contextdeck/worker.yaml, approve it, and start a worker:
cdeck worker trust
cdeck worker --once
# or poll continuously (seconds via --interval, or milliseconds via --poll-ms):
cdeck worker --interval 5See docs/handlers.md for the full worker configuration schema, environment contract, and worked video-explainer and quiz handler examples.
Security Model
Loopback by default:
cdeck servebinds strictly to127.0.0.1and enforces strictHostandOriginvalidation (rejecting DNS rebinding andOrigin: null). LAN/phone access requires explicit--allow-remoteand--allowed-hosts <csv>and prints a plain-HTTP warning.Cookie + CSRF browser auth, bearer token for API/MCP: A per-workspace 32-byte random bearer token lives in
<deck>/.runtime/token(mode0600). Browser sessions authenticate via single-use launch URLs (/auth?code=...) that set anHttpOnly; SameSite=Strictcookie paired with an in-memory CSRF token (X-CSRF-Token) — zero auth or CSRF tokens are ever stored inlocalStorage(only the optional UI theme preferencecontextdeck_themeis persisted).Sandboxed content rendering: Markdown and Mermaid SVGs are sanitized via DOMPurify; inline HTML artifacts render inside
<iframe sandbox="allow-scripts">(noallow-same-origin) with a strictdefault-src 'none'CSP meta header; direct downloads of HTML/SVG media files are forced toContent-Disposition: attachmentwithX-Content-Type-Options: nosniff.Safe file storage & worker isolation: Atomic temp-file-and-rename transactions with cross-process locking (
proper-lockfile), strict slug/ID path containment, streaming byte-capped multipart uploads, and zero server-side command execution (cdeck workerruns only user-local, explicitly SHA-256-trustedargvhandlers withshell: false).
MCP Tools Exposed
Tool | Purpose |
| List all boards in the workspace. |
| Fetch the bounded Context Pack (optionally syncing a |
| Update |
| Inspect stale artifacts and behind-revision sessions. |
| Register a session with harness badge, optional |
| Update session status, summary, or hierarchy links. |
| Record a decision (passing |
| Create or move a Kanban task. |
| Create or publish a new version of a Mermaid or Excalidraw diagram (supports |
| Attach a video, audio clip, Markdown doc, HTML widget, or custom artifact. |
| Publish a new immutable version ( |
| Publish an interactive knowledge-check quiz. |
| Publish a new version of a quiz while preserving past human mastery attempts (supports |
| Record an agent confirmation (requires non-blank |
| List refresh jobs ( |
| Atomically claim a queued refresh job (returns |
| Renew an active job lease using |
| Release a claimed job back to |
| Mark a claimed job |
Resources: contextdeck://brief (text/markdown), contextdeck://snapshot (application/json).
Monorepo Architecture
packages/
├── core/ # @contextdeck/core — Plain-file BoardStore, Zod schemas, drift/catch-up engine, Context Pack, worker config
├── server/ # @contextdeck/server — Hono REST/SSE API, Range media streaming, auth/CSP, MCP (stdio + Streamable HTTP)
├── cli/ # @contextdeck/cli — `cdeck` / `contextdeck` CLI, harness setup/hooks, local refresh worker
└── web/ # @contextdeck/web — React 19 + Vite + Tailwind v4 (lazy React Flow, Mermaid, Excalidraw)Development & Verification
pnpm typecheck # Strict TypeScript check across all packages
pnpm test # Unit, storage/concurrency, server/MCP, CLI/hook, and web security tests
pnpm build # Build all packages and production web UI bundle
pnpm test:e2e # Playwright end-to-end smoke, 390px layout, and browser isolation tests
pnpm pack:check # Pack core/server/cli tarballs and verify isolated install + `cdeck serve`License
MIT — see LICENSE.
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
Shared, versioned context that humans and AI agents can publish, review, annotate, and continue.
Shared project context for AI agents and teams: docs, tasks, and messages that stay current.
A shared, governed brain for AI agents: versioned context with approvals, local or hosted.
One shared project memory for your AI coding tools: recall, save and brief decisions anywhere.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables teams to share structured, git-synced context among AI coding agents working on the same repository, including living plans, task declarations, handoff briefs, file-provenance history, and conflict detection.1220 npm2MIT
- AlicenseBqualityBmaintenanceEnables multiple AI coding agents and humans to coordinate through a Git-native Markdown blackboard (.context/ + AGENTS.md), where they can inspect workspace overviews, claim and toggle ready tasks, record architecture decisions, synthesize shared prompts, and hand off work via atomic, lock-protected writes that prevent lost updates and formatting drift. It also serves a fully offline local web dashboard that live-syncs any blackboard change over WebSocket.71MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to persistently save, search, checkpoint, and restore project context across sessions, including decisions, progress, and file state. It supports shared channels, git-aware organization, and batch operations for long-running or parallel development workflows.150 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to persistently save, search, and restore project context across sessions, including decisions, progress, file caches, checkpoints, and channel-based memory. It supports git-aware organization, batch operations, and shared memory across parallel sessions.150 npmMIT