OCD - Organized Context Datastore (MCP)
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OCD - Organized Context Datastore (MCP) Store the current architecture decisions as a new context branch"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OCD - Organized Context Datastore (MCP)
Give your AI persistent, structured memory — and let humans see it too.
OCD is an MCP server that stores project knowledge as Markdown files in a hierarchical tree. LLMs read and write via MCP tools; humans browse and edit via a built-in Web UI or any text editor. Both share the same source of truth.
Why OCD?
No more lost context — Project knowledge persists across sessions in a Git-backed store
Token-efficient — Fetch only the branches you need with
tree-textformat, not entire documentsHuman-friendly — Plain Markdown + frontmatter. Edit in VS Code, review on GitHub, or use the built-in Web UI
One command —
npx github:teamstove/organized-context-datastore-mcpstarts both the MCP server and the Web UI
Quick Start
One-Liner (stdio + Web UI enabled by default)
# Cursor connects via stdio + humans browse http://localhost:38291/viewer
npx github:teamstove/organized-context-datastore-mcp
# Read-only mode
npx github:teamstove/organized-context-datastore-mcp --readonlyHTTP Server Mode
# Local dev mode (with Web UI)
npx github:teamstove/organized-context-datastore-mcp --http --port 38291
# Remote server mode
npx github:teamstove/organized-context-datastore-mcp --http --mode remote-server --config ./config.jsonRelated MCP server: agent-memory
How It Works
┌──────────────┐ MCP (stdio / HTTP) ┌─────────────────┐
│ LLM / IDE │ ◄───────────────────► │ OCD Server │
│ (Cursor…) │ │ │
└──────────────┘ │ Markdown files │
│ + frontmatter │
┌──────────────┐ HTTP + Web UI │ + Git history │
│ Human │ ◄───────────────────► │ │
│ (Browser) │ └─────────────────┘
└──────────────┘For LLMs | For Humans |
Persistent memory across sessions | Plain Markdown — edit anywhere |
Hierarchical tree with pattern queries | Built-in Web UI with tree view & search |
Token-efficient | Git-backed history & diffs |
6 MCP tools: list, get, tree, search, mutate, commit | Review and refine what the AI writes |
CLI Options
Option | Description |
(none) | stdio mode (default) + Web UI on port 38291 |
| HTTP server mode |
| Disable write tools |
| HTTP port number (default: 38291) |
| Web UI port in stdio mode (default: 38291) |
| Disable the Web UI |
| HTTP only: |
| Config file for |
Duplicate launch behavior: If OCD is already running on the same port, subsequent launches log "OCD is already running on this port" and exit cleanly (exit 0). An error exit only occurs when the port is occupied by a different process. The server identity check uses GET /whois — if the response is OCD, it is recognized as an existing OCD instance.
CLI tool subcommands (same logic as MCP tools)
Run read/write operations without starting the MCP server. Results are printed as JSON on stdout (pipe to jq, etc.).
ocd-mcp tool --help
ocd-mcp tool --cwd . list-roots
ocd-mcp tool --cwd . get-contexts --patterns 'docs/**'
ocd-mcp tool --cwd . search --query "auth"Context | Flag | Meaning |
Project (usual) |
| Resolve |
Fixed storage |
|
|
--readonly: blocksmutateandcommit.Do not run
mutate/commitagainst the same Git repo while the stdio MCP server is writing — risk of lock/conflict.get-contexts --include-contentcan produce very large JSON.
Cursor / IDE Configuration
One-Liner (stdio + Web UI)
{
"mcpServers": {
"ocd-mcp": {
"command": "npx",
"args": [
"--package", "github:teamstove/organized-context-datastore-mcp",
"tsx", "src/cli.ts"
]
}
}
}Cursor connects via stdio
Humans browse
http://localhost:38291/viewer
stdio Only (Web UI disabled)
"args": [
"--package", "github:teamstove/organized-context-datastore-mcp",
"tsx", "src/cli.ts",
"--disable-web-ui"
]Via bin Entry (after package install)
{
"mcpServers": {
"ocd-mcp": {
"command": "npx",
"args": ["github:teamstove/organized-context-datastore-mcp"]
}
}
}HTTP Mode
# Start the server in a terminal
npx github:teamstove/organized-context-datastore-mcp --http --port 38291{
"mcpServers": {
"ocd-mcp": {
"url": "http://localhost:38291/api/mcp"
}
}
}Web UI is available at http://localhost:38291/viewer.
Context Roots Filtering (HTTP Mode)
{
"mcpServers": {
"ocd-pj-alpha": {
"url": "http://localhost:38291/api/mcp?roots=project-alpha,core-docs"
},
"ocd-pj-beta-readonly": {
"url": "http://localhost:38291/api/mcp?roots=project-beta,shared&readonly=shared"
}
}
}Parameter | Description | Example |
| Context Root IDs to include (comma-separated) |
|
| Context Root IDs to make read-only |
|
Configuration
Local Config (.ocd.config.js)
Place in the project root. OCD searches upward from cwd automatically.
export default {
contextRoots: [
{
path: './organized-context',
git: 'auto-commit'
},
{
path: './CORE/docs',
name: 'CORE Docs',
readOnly: true
}
],
inheritGlobal: true
}Global Config (~/.ocd/config.js)
Define Context Roots shared across all projects.
Git Modes
Value | Description |
| Automatically commit after each operation |
| Commit explicitly via the |
| Do not use Git |
MCP Tools
Tool | Description |
| List all Context Roots |
| Retrieve contexts by pattern and filters |
| Get the context tree (table of contents) |
| Search contexts by keyword |
| Mutate a context (create / update / delete / move) |
| Commit changes (for |
ocd_mutate_context — Performance Notes
Serialization: Within the same Context Root (same cwd),
ocd_mutate_contextandocd_commitexecute one at a time. When called in rapid succession, subsequent calls wait for the previous one to complete — this is a queue, not a freeze. This prevents Git operation conflicts.Move cost: A
moveoperation scans all.mdfiles under the Context Root to update internal links and prevent broken references. If the root contains many files, a single move may take noticeable time.
Directory Structure Example
my-context-store/
├── .ocd.config.js
├── project-a/
│ ├── index.md
│ ├── features/
│ │ ├── feature-1.md
│ │ └── feature-2.md
│ └── decisions/
│ └── adr-001.md
└── project-b/
└── ...Markdown Format
---
title: Feature Specification
status: draft
priority: high
---
# User Authentication
## Overview
Details about the user authentication implementation...All frontmatter fields other than title are treated as attrs.
Installation
git clone https://github.com/teamstove/organized-context-datastore-mcp.git
cd organized-context-datastore-mcp
npm installThe Web UI is built automatically on first launch. To build manually: npm run build:web-ui.
For Developers
See docs/DEVELOPMENT.md for local development, testing, and build instructions.
License
MIT
Available Tools
6 toolsocd_commitA
[OCD] 変更をコミット (git: 'manual' モード用)(cwd から設定を探索)
Inputs: cwd (required), message (required), paths.
ocd_get_contextsA
[OCD] Organized Context Datastore - 階層構造を持つコンテキストを LLM と人間が共同で読み書きする MCP サーバー。
パターンとフィルタでコンテキストを取得します。
パラメータ
patterns: glob パターン配列 (例: ['project/**', 'docs/*'])
filter: jq フィルタ式 (例: '.attrs.status == "draft"')
includeContent: コンテンツを含めるか (default: true)
cwd: 作業ディレクトリ(設定探索の起点)
jq フィルタ例
attrs でフィルタ: '.attrs.status == "draft"'
未完了TODOがあるもの: '.todos | any(.completed == false)'
Inputs: cwd (required), patterns (required), filter, includeContent.
ocd_get_context_treeA
[OCD] コンテキストツリー(目次)を取得
パラメータ
rootIds: Context Root の id 配列(list_context_roots で取得した id をそのまま使用)
patterns (optional): include glob(rootId 相対)。指定時は depth より優先
exclude (optional): exclude glob(rootId 相対)。tree から除外
重要: list_context_roots で返却された id を使用してください。 path フィールド(実際のファイルシステムパス)は使用しないでください。
例:
単一: rootIds: ["tairikut-docs"]
複数: rootIds: ["tairikut-docs", "CORE-docs-for-ai"]
フォーマット
tree-text (default): Token効率の良いテキストツリー形式
json: 従来のJSON配列形式
表示フォーマット (treeTextFormat)
デフォルト: "$path: $title $summary" 使用可能な変数: $path, $title, $summary
cwd: 作業ディレクトリ(設定探索の起点)
Inputs: cwd (required), rootIds (required), depth, format, +4 more.
ocd_list_context_rootsA
[OCD] Context Root 一覧を取得(cwd から設定を探索)
重要: 返却される id を以下のツールで使用してください:
get_context_tree: rootIds に id を配列で指定 例: rootIds: ["tairikut-docs"]
get_contexts: patterns に "id/" 形式で指定 例: patterns: ["tairikut-docs/"]
mutate_context: path に "id/subpath" 形式で指定 例: path: "tairikut-docs/features/new"
⚠️ 注意: path フィールドは実際のファイルシステムパスです。 ツール引数には使用しないでください。id を使用してください。
Inputs: cwd (required).
ocd_mutate_contextA
[OCD] コンテキストを変更 (create/update/delete/move 一括実行)
全ての書き込み操作を単一のツールで実行可能。 複数の操作を配列で渡すことで一括処理できます。
cwd: 作業ディレクトリ(設定探索の起点)
重要: path は Context Root の id で始まる完全なパスを指定してください。 例: "knowledge-base/new-doc", "src/plugins/MyPlugin/README"
操作タイプ
type | 必須フィールド | オプション |
create | path, title, summary, content | attrs |
update | path | title, summary, attrs, contentUpdates |
delete | path | - |
move | path, to | - |
title + summary の書き方
「ひとつづきのサマリ」として連結して読める形式で記述する
title: 見出し部分(10-50文字)
summary: 詳細部分(50-300文字)
両者の内容重複は禁止
path から想像できる以上の情報を含める
例:
title: "OAuth2.0認証フロー実装"
summary: "Google/GitHub連携対応。JWT発行、リフレッシュトークン管理、セッション有効期限7日。2FAはオプション対応"contentUpdates の操作タイプ
whole_replace - コンテンツ全置換
{ type: 'whole_replace', content: '新しいコンテンツ全体' }
replace - 部分置換(search / replacement / isRegex / flags)
search: '$', replacement: '\n\n追記内容', isRegex: true, flags: 'm'
Inputs: cwd (required), operations (required).
ocd_search_contextsA
[OCD] キーワードでコンテキストを検索(cwd から設定を探索)
Inputs: cwd (required), query (required), scope.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a distinctly defined responsibility: listing roots, retrieving contexts via patterns/filters, searching by keyword, getting a tree view, mutating (create/update/delete/move), and committing. The overlapping retrieval tools (get_contexts vs search_contexts) are differentiated by mechanism and purpose, and all descriptions include clear usage guidance.
All tool names follow a uniform pattern: 'ocd_' prefix + verb_noun in lowercase snake_case (list_context_roots, get_contexts, search_contexts, get_context_tree, mutate_context, commit). The only slight deviation is 'commit' without a noun, but it is still clear and consistent in style.
Six tools is a well-scoped set for a context datastore server. Each tool covers a distinct aspect (roots, retrieval, search, tree, mutation, git commit) without redundancy or bloat, fitting the typical 3-15 range comfortably.
The surface covers the full lifecycle: list/get/search/tree for reading, mutate_context for create/update/delete/move, and commit for persistence in manual git mode. There are no obvious dead ends or missing operations for the stated purpose.
Maintenance
Related MCP Connectors
Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that gives AI assistants persistent memory across sessions. It stores project context, decisions, and progress in structured markdown files as well as a knowledge graph and sequential thinking for better memory storage.3625 npm1MIT
- AlicenseAqualityBmaintenanceLocal, searchable project memory for AI coding agents. Markdown source of truth, MCP interface, safe structured updates315Apache 2.0
- AlicenseNot gradedqualityDmaintenanceProvides a file-first personal memory layer for AI agents, enabling them to store and retrieve memories as markdown files with an SQLite index. The MCP server offers read-only search by default, with optional write tools for manual memory addition and conflict resolution.6 npmMIT
- AlicenseNot gradedqualityCmaintenanceProvides persistent, shared memory for AI agents via MCP, enabling retrieval of relevant memories instead of loading entire context. Allows agents across projects, machines, and tools to share a single auditable, markdown-native brain.4AGPL 3.0