scratchbook-mcp
The scratchbook-mcp server provides a persistent, searchable codebase memory for AI coding agents. It combines hybrid semantic+BM25 code search, exact identifier and event cross-referencing, structural outlining, a work journal, and isolated deep reasoning sessions, all backed by a local LanceDB store.
Key capabilities:
Incremental codebase indexing (respecting .gitignore), with optional force re-embedding.
Hybrid code search (scratchbook_search) fusing semantic and BM25 retrieval for concept-level recall and exact identifier precision.
Exact cross-referencing: find all definitions/references for an identifier (scratchbook_refs) and map event names to send/listen sites (scratchbook_events).
Structural outlines (scratchbook_outline) with imports and top-level symbols.
Work journal (scratchbook_journal, scratchbook_recall) for writing and semantically recalling dated notes, findings, or bugs.
Gaze-and-think deep reasoning (scratchbook_gaze, scratchbook_gaze_read): dump tangled problems to a board, launch isolated AI flow sessions, produce artifacts, and persist syntheses into recall.
Status monitoring (scratchbook_status) of embedding service and indexed projects.
Forget project index (scratchbook_forget) while keeping journal notes.
Zero-dependency fallback: lexical-only mode (BM25, refs, events, outline, journal) when no embedding service is available, auto-upgrading to hybrid search when detected.
Uses an Ollama embedding endpoint (default bge-m3) to enable semantic code search, powering hybrid semantic + BM25 retrieval.
Click on "Install 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., "@scratchbook-mcpsearch for code related to embedding and vector storage"
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.
scratchbook-mcp
A codebase-memory MCP server for AI coding agents (Claude Code and others): hybrid semantic + BM25 code search, a structural outline, a work journal, and gaze-and-think deep reasoning — over a local LanceDB.
給 AI 編碼代理(Claude Code 等)的程式碼記憶 MCP 伺服器: 混合語意 + BM25 的程式碼搜尋、結構大綱、工作日記,以及 gaze-and-think 深度推理 —— 全部建在本機 LanceDB 上。
Why / 為什麼
grep/rg only find what you can already name, and mostly within one
directory. When an agent works in a large or unfamiliar repo, it spends attention
locating code instead of understanding it. scratchbook gives the agent a
cross-directory, meaning-based index of the code, a lexical (exact-identifier)
arm fused in, a place to write notes it can recall later, and a way to think
deeply about a tangled subsystem in a clean, isolated session. It augments
grep/Read — it does not replace them.
grep/rg 只找得到你叫得出名字的東西,而且多半困在單一目錄。當代理在龐大或
陌生的 repo 裡工作,注意力都耗在「定位程式碼」而不是「理解它」。scratchbook 給代理
一份跨目錄、以意義為基礎的程式碼索引,融入一條詞彙(精確識別字)臂,一個可日後
回想的筆記空間,以及一種在乾淨隔離的 session 裡把糾結子系統想透的方法。它增強
grep/Read —— 不是取代它們。
Related MCP server: nexus-mcp-ci
Features / 特色
Hybrid retrieval / 混合檢索 — semantic (embedding) search fused with lexical BM25 via Reciprocal Rank Fusion. Meaning-based recall and exact-identifier precision (a query for
resolveAnnotatedMapsurfaces the exact symbol the embedding alone would rank below near-synonyms). Each hit is taggedsem/lex/lex+sem. 語意(向量)搜尋與詞彙 BM25 以 RRF 融合:兼得「概念召回」與「精確識別字」。每筆 結果標記由哪一臂命中(sem/lex/lex+sem)。Zero-dependency fallback / 零依賴降級 — no embedding service? Everything still works in lexical-only mode (BM25 + refs/events/outline/journal); the first index run after an embedder appears auto-upgrades to hybrid. 沒有 embedding 服務也能用:自動進入 lexical-only 模式(BM25 + 交叉引用/outline/ 日誌照常),之後偵測到端點會自動全量升級成混合檢索。
Exact cross-reference / 精確交叉引用 —
scratchbook_refsenumerates every definition and reference of an identifier: grep-shaped (LIKE prefilter + line-level regex), deliberately not BM25 — an FTS tokenizer splitssnake_caseinto an OR-flood and top-k truncation silently drops sites.scratchbook_eventscross-references string event names (.emit/.on+ wrapper methods) into an event → send sites / listen sites table and flags one-sided events — the string edges a syntactic call graph can't see.scratchbook_refs窮舉一個識別字的所有定義與引用:grep 形而非排序形(LIKE 預過濾 + 行級 regex),刻意不走 BM25 —— FTS tokenizer 會把snake_case切成 OR 洪水,top-k 截斷即靜默漏報。scratchbook_events交叉比對字串事件名 (.emit/.on與包裝方法),產出「事件 → 發送端/監聽端站點」對照表並標記單邊 事件 —— 這些字串邊是語法呼叫圖看不見的架構。Structural outline / 結構大綱 — each file's imports + top-level symbols with line numbers, to grasp organisation fast. 每個檔案的 imports + 頂層符號 + 行號,快速掌握專案組織。
Work journal + recall / 工作日記與回想 — write dated notes (decisions, findings, suspected bugs); recall them later by meaning, with an age shown so stale notes read as old. 寫下有日期的筆記(決策、發現、可疑 bug);日後以語意回想,並顯示年齡讓過時 筆記一眼看得出來。
gaze-and-think / 凝視與思考 — dump a tangled problem into a board, then launch a clean, isolated flow session that concentrates solely on it, reasons about the relationships between the pieces, writes inspectable intermediate artifacts, and converges on a synthesis you can persist into recall. 把糾結的問題丟進一個 board,再啟動一個乾淨隔離的心流 session,專注思考各片段間 的關係、產出可檢查的中間產物、收斂成綜合結論,並可持久化進 recall。
Control-char-safe snippets / 控制字元安全的片段 — invisible bytes (NUL, …) are rendered
cat -A-style (^@) so they can't be misread as spaces. 隱形位元組(NUL 等)以cat -A風格顯示(^@),避免被誤讀成空格。
Architecture / 架構
AI agent ──stdio (JSON-RPC)──▶ src/server.mjs (MCP, 11 tools)
│
┌───────────────┬──────────────┼──────────────┬───────────────┬──────────────┐
▼ ▼ ▼ ▼ ▼ ▼
indexer.mjs store.mjs embed.mjs gaze.mjs walk.mjs refs.mjs
walk→chunk LanceDB Ollama-style clean `claude git ls-files / exact xref:
→embed→upsert 3 tables + /api/embed -p` flow gitignore-aware LIKE + line
(incremental) FTS (BM25) (bge-m3, 1024) session chunk.mjs regex; event
~/.scratchbook (symbol-aware) send/listenRuntime / 執行環境: Node ESM, no build step (
node src/server.mjs).Storage / 儲存: one LanceDB at
~/.scratchbook/lancedb, every row namespaced by the canonical (realpath) project root — one server serves every project. 單一 LanceDB,每列以正規化的專案根路徑命名空間 —— 一個伺服器服務所有專案。Tables / 資料表:
chunks(symbol-aware code chunks + vectors + a BM25 FTS index),files(per-file imports + outline),journal(dated notes + vectors + FTS).Enumeration / 列舉檔案:
git ls-filesin a git repo (perfect.gitignorerespect); a manual walk with built-in ignores otherwise. Binaries, lockfiles, minified, and >512 KB files are skipped.Incremental / 增量: unchanged files skipped by
(mtime, size)then content hash; only changed files are re-read and re-embedded.
Requirements / 需求
Node ≥ 20 — that's all. Everything else is optional. 只需要 Node ≥ 20,其他都是可選的。
Quick start / 一鍵安裝
One command — no clone, no embedding service, works immediately: 一行指令 —— 不用 clone、不用 embedding 服務,立刻可用:
claude mcp add scratchbook --scope user -- npx -y github:jinyaolin/scratchbookOut of the box scratchbook runs in lexical-only mode: full-text (BM25)
search, exact cross-reference (refs / events), outline, and the journal all
work with zero external services. Semantic search switches on automatically once
an embedder is reachable (next section).
開箱即是 lexical-only 模式:BM25 全文檢索、精確交叉引用(refs / events)、
outline、日誌全部可用,零外部服務。偵測到 embedding 端點後,語意搜尋自動開啟(見下節)。
Remove with claude mcp remove scratchbook -s user.
Optional: semantic search / 可選:語意搜尋
Point scratchbook at any Ollama-style embedding endpoint — default is a local
Ollama with bge-m3 (1024-dim):
給 scratchbook 一個 Ollama 風格的 embedding 端點即可 —— 預設是本機 Ollama 的
bge-m3(1024 維):
# https://ollama.com
ollama pull bge-m3
# Ollama serves the embedding API at http://localhost:11434/api/embedThe next scratchbook_index detects the embedder and auto-upgrades the
project (full re-embed); hybrid semantic+BM25 search takes over from there.
Use SCRATCHBOOK_EMBED_URL / _MODEL / _DIM for a remote box or another model.
下一次 scratchbook_index 偵測到端點就會自動升級(全量重嵌入),之後就是語意+BM25
混合搜尋。遠端機器或其他模型用 SCRATCHBOOK_EMBED_URL / _MODEL / _DIM 指定。
Install from a clone / 從 clone 安裝
git clone https://github.com/jinyaolin/scratchbook.git
cd scratchbook
npm install
claude mcp add scratchbook --scope user \
-- node /absolute/path/to/scratchbook/src/server.mjsAny MCP client works — the server speaks stdio JSON-RPC. See your client's docs for how to register a local stdio MCP server. 任何 MCP 客戶端都行 —— 伺服器走 stdio JSON-RPC。註冊方式見你客戶端的文件。
Tools / 工具
Tool | Purpose / 用途 |
| Index/refresh a codebase (incremental). Run once per project, again after big edits. / 索引/刷新一個 codebase(增量)。 |
| Hybrid (semantic + BM25) code search → |
| Exact, exhaustive who-uses-X: every definition + reference line of one identifier (case-sensitive). / 精確窮舉某識別字的所有定義與引用行。 |
| String event-name cross-reference: event → send / listen sites, one-sided events flagged ⚠. / 字串事件名交叉引用表,單邊事件標 ⚠。 |
| Structural map: each file's imports + top-level symbols with line numbers. / 結構大綱。 |
| Write a dated work-note (decisions, findings, suspected bugs). / 寫工作日記。 |
| Hybrid search over past notes, with note age shown. / 回想筆記(顯示年齡)。 |
| Embedding health + indexed projects with counts. / 健康檢查與已索引專案。 |
| Drop a project's code index (journal kept). / 移除某專案的程式碼索引(日記保留)。 |
| Write to a board and/or launch a flow session over it. / 寫入 board 並/或啟動心流 session。 |
| Read a board (notebook, sessions, artifacts); |
Every tool takes an absolute project/path; it defaults to the server's cwd.
每個工具都可傳絕對 project/path,預設為伺服器的 cwd。
gaze-and-think / 凝視與思考
For a problem too tangled to hold in the working session, dump the pieces into a
board (a notebook), then launch a flow session — a fresh, isolated
claude -p that carries no other context and concentrates only on that board.
It reasons about the relationships between the pieces, writes intermediate
artifacts under the board's artifacts/, and converges on a synthesis. Runs in
the background; poll with scratchbook_gaze_read.
當問題糾結到裝不進當下的 session,把片段丟進一個 board(筆記本),再啟動一個
心流 session —— 一個乾淨隔離、不帶其他上下文、只專注在該 board 的 claude -p。
它思考各片段的關係、把中間產物寫進 board 的 artifacts/、收斂成綜合結論。背景
執行,用 scratchbook_gaze_read 取回。
scratchbook_gaze board="X" note="a hard piece…" # accumulate material / 累積素材
scratchbook_gaze board="X" focus="how do these relate?" project="/abs/repo"
scratchbook_gaze_read board="X" # read synthesis + artifacts
scratchbook_gaze_read board="X" remember=true # persist synthesis → recallThe flow session runs with --permission-mode acceptEdits and read/write/search
tools but no shell — it can build checkable artifacts and ground claims in
real code, but never runs arbitrary commands. A remembered synthesis is stamped
with the commit it was grounded in and its age is shown on recall, because it has
no source file to re-derive from and so does not auto-update — treat it as
understanding as of that commit, and verify against current code.
心流 session 以 --permission-mode acceptEdits 執行,有讀/寫/搜尋工具但無 shell
—— 能產出可檢查的產物、對真實程式碼 grounding,但不執行任意指令。被 remember 的
綜合結論會蓋上「當時所依據的 commit」戳記,recall 時顯示年齡:它沒有源檔可重新推導、
不會自動更新,請當成「截至該 commit 的理解」,並對照現行程式碼驗證。
Requires the
claudeCLI onPATHfor the flow session. 心流 session 需要PATH上有claudeCLI。
CLI (manual use / debugging) / 命令列(手動使用 / 除錯)
node src/cli.mjs index /path/to/your/repo # index a repo
node src/cli.mjs index /path/to/your/repo --reindex # force full re-embed
node src/cli.mjs search "where sessions are cached" --project /path/to/your/repo --full
node src/cli.mjs outline --project /path/to/your/repo --path src/lib
node src/cli.mjs status
node src/cli.mjs note "flagged N+1 in loader" --tags bug,perf --project /path/to/your/repo
node src/cli.mjs recall "what was I doing here" --project /path/to/your/repo
node src/cli.mjs forget --project /path/to/your/repoConfiguration (env) / 設定(環境變數)
Env | Default | Meaning / 意義 |
|
| LanceDB directory / LanceDB 目錄 |
|
| Ollama-style embed endpoint / embed 端點 |
|
| embedding model / 模型 |
|
| vector dimension (must match model) / 向量維度(須與模型一致) |
|
| texts per embed request / 每次請求文本數 |
|
| parallel embed requests / 並行請求數 |
|
| gaze boards directory / gaze board 目錄 |
|
| skip files larger than this / 略過超過此大小的檔 |
|
| max chunk size / chunk 上限 |
|
| min before a soft cut / chunk 下限 |
|
| overlap when window-splitting / 視窗切分重疊行數 |
Notes / limits / 注意事項與限制
The embedding dimension is baked into the LanceDB schema. Changing to a model of a different dimension means a fresh DB (delete
~/.scratchbook/lancedb). embedding 維度寫死進 LanceDB schema;換到不同維度的模型需重建 DB(刪掉該目錄)。A recalled note / remembered gaze synthesis reflects the code as it was when written and does not auto-update — it's a strong prior, not a substitute for reading current code. 回想到的筆記 / 記憶的 gaze 結論反映寫入當下的程式碼、不會自動更新 —— 是強力 的前導,不是「讀現行程式碼」的替身。
Chunking is heuristic (regex anchors), not a full parser — good enough for retrieval and outlines, not a semantic analyser. 切塊是啟發式(regex 錨點),不是完整 parser —— 對檢索/大綱夠用,不是語意分析器。
Data under
~/.scratchbook/is fully rebuildable from source — safe to delete.~/.scratchbook/下的資料完全可從原始碼重建 —— 可安心刪除。
License / 授權
Apache License 2.0 — Copyright 2026 Jinyao Lin.
Available Tools
9 toolsscratchbook_forgetForget codebase indexA
Remove a project's indexed code chunks and file outlines from the scratchbook (journal notes are kept). Use to clean up or before a fresh full re-index.
| Name | Required | Description | Default |
|---|---|---|---|
| project | No | Absolute project root. Defaults to the server's cwd. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description bears the transparency burden. It explicitly states what is removed (code chunks and file outlines) and what is preserved (journal notes), giving clear scope of the destructive operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with the purpose, and includes a parenthetical clarification. Every word earns its place with no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with one optional parameter and no output schema, the description fully covers behavior (what is removed/kept) and usage timing. The schema handles parameter details, so nothing important is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema covers the only parameter ('project') with a description, achieving 100% coverage. The description adds no additional parameter-specific semantics, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool removes a project's indexed code chunks and file outlines, using a specific verb (remove) and resource. It also distinguishes itself by noting journal notes are kept, separating it from sibling tools like scratchbook_journal.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit usage context: 'Use to clean up or before a fresh full re-index.' It does not explicitly name alternatives or when-not-to-use, but the context is clear enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_gazeGaze and think (flow session)A
gaze-and-think: write the hard, tangled parts of a problem into a BOARD (a notebook), then launch a CLEAN, isolated flow session — a fresh claude -p that carries no other context and concentrates SOLELY on that board — to reason about the RELATIONSHIPS between the pieces, write intermediate artifacts you can inspect/verify, and converge on a synthesis. Use it when a problem is too tangled to hold in the working session: dump the pieces with note=…, then focus a flow session on them with focus=…. The flow session runs in the BACKGROUND — poll with scratchbook_gaze_read; pass wait=true to block for the synthesis. Give project= to let it ground its thinking in real code. It can read/write files and search the codebase, but has no shell.
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | A piece of material to append to the board's notebook first. | |
| wait | No | Block until the flow session finishes and return its synthesis (bounded by timeout_s). Default false — runs in the background. | |
| board | Yes | Board name — a persistent thinking workspace; reuse it to accumulate material. | |
| focus | No | The relationship/question to concentrate on. When given, launches a flow session over the whole board. | |
| model | No | Model for the flow session (default: the configured claude -p model). | |
| title | No | Optional heading for the note. | |
| project | No | Absolute codebase root the flow session may search to ground claims in real code. | |
| timeout_s | No | Max seconds for the flow session (default 900). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does so thoroughly. It discloses that the flow session is 'CLEAN, isolated', 'runs in the BACKGROUND', 'can read/write files and search the codebase, but has no shell', and explains the wait=true blocking behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is dense but every sentence earns its place: it explains what, when, how, and the operational caveats. It is front-loaded with the tool's core purpose and structured to flow from action to use case to background behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (8 parameters, no output schema, no annotations), the description is rich enough to support correct selection and invocation. It covers the workflow, background vs. blocking behavior, and capabilities/restrictions, though it does not specify the exact structure of the returned synthesis.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds practical usage context for key parameters (note=, focus=, project=, wait=true), including the pattern of dumping pieces then focusing a session, going beyond raw schema text.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: write tangled problem pieces to a board, then launch an isolated flow session to reason about relationships. It distinguishes itself from the sibling scratchbook_gaze_read by explicitly referring to polling/blocking behavior.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives explicit guidance: 'Use it when a problem is too tangled to hold in the working session' and explains the workflow with note=..., focus=..., and wait=true. It clearly points to scratchbook_gaze_read for polling, but does not explicitly discuss when not to use it relative to all other sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_gaze_readRead a gaze boardA
Read a gaze board: its notebook, the flow sessions run against it (with status), their syntheses, and the intermediate artifacts they produced. Call with just board= to see the board plus the latest session's synthesis; add session= for a specific session, or artifact= to read one artifact file's full content. Pass remember=true to persist that session's converged synthesis into recall (scratchbook_recall) as durable memory — stamped with the commit it was grounded in, so a future session can reuse the understanding (and see how old it is).
| Name | Required | Description | Default |
|---|---|---|---|
| board | Yes | Board name. | |
| session | No | A specific flow-session id (default: the latest done one). | |
| artifact | No | An artifact filename to read in full. | |
| remember | No | Persist the (chosen) session's synthesis into recall/journal, grounded-at-stamped. Use once you've judged the synthesis worth keeping. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description fully carries the burden of disclosing behavior. It reveals the side effect of 'remember=true' (persisting synthesis into recall as durable memory), explains the default behavior (latest session), and discloses the grounding-stamp ('stamped with the commit it was grounded in') and future reusability. This is rich, non-obvious behavioral context beyond what the schema conveys.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences, each dense with information but neither redundant nor padded. The first sentence states the core purpose, the second gives parameter usage patterns, and the third explains the remember behavior. It front-loads the primary action and resource, and every clause earns its place given the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the main output content (notebook, sessions, syntheses, artifacts) and the optional write side effect (remember). It clearly states how to access specific items and what the default view is. Given no output schema, it sufficiently describes return content and behavior for a tool with this complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Although schema coverage is 100%, the description adds meaning by explaining the interplay between parameters: what happens with just 'board' (returns board plus latest synthesis), the role of 'session' and 'artifact' (specific vs full content), and the purpose of 'remember' (durable memory with commit stamping). It clarifies defaults and usage scenarios beyond the schema's per-parameter descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description uses a specific verb ('Read') and clearly identifies the resource ('a gaze board'), then enumerates the contents returned: 'its notebook, the flow sessions run against it (with status), their syntheses, and the intermediate artifacts they produced.' It distinguishes itself from sibling tools by mentioning the 'remember' parameter's persistence into scratchbook_recall, which sets it apart from pure read tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit invocation patterns: 'Call with just board= to see the board plus the latest session's synthesis; add session=<id> for a specific session, or artifact=<name> to read one artifact file's full content. Pass remember=true to persist...' This gives concrete when-to-use guidance for each parameter combination, and references scratchbook_recall as the target for persistence, effectively distinguishing use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_indexIndex codebaseA
Index or refresh a codebase into the scratchbook so it can be semantically searched. Incremental — only files changed since last run are re-read and re-embedded. Respects .gitignore (uses git ls-files when available). Run once when you start working on a project, and again after significant edits. Pass the absolute project root as path.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Absolute path to the codebase root. Defaults to the server's cwd. | |
| reindex | No | Force a full re-embed of every file, ignoring change detection. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description discloses key behavioral traits: incremental processing ('only files changed since last run are re-read and re-embedded'), respect for .gitignore, and use of `git ls-files`. Since no annotations are provided, the description carries the full burden and does a solid job, though it omits potential runtime costs or side effects (e.g., index storage impact).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences, each earning its place. It front-loads the core purpose, then adds incremental behavior, gitignore handling, and usage guidance. There is no redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the essential context: purpose, usage timing, and key behaviors. It does not explain return values, but for an indexing action with no output schema, that is less critical. The only minor gap is not explicitly detailing the `reindex` parameter in the description, though it is implied by the incremental explanation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with clear descriptions for both `path` and `reindex`. The description reinforces the `path` parameter ('Pass the absolute project root as path') and indirectly explains `reindex` through the incremental behavior, but it doesn't add substantial new meaning beyond the schema. The incremental description does provide context for why `reindex` might be needed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Index or refresh a codebase into the scratchbook so it can be semantically searched.' It uses a specific verb ('Index') and resource ('codebase'), and distinguishes itself from sibling tools like scratchbook_search and scratchbook_outline by focusing on the indexing/preparation step rather than querying or summarizing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit usage timing: 'Run once when you start working on a project, and again after significant edits.' This gives clear context on when to invoke the tool. It does not mention alternatives or when-not-to-use, but the context is sufficient for an agent to decide appropriately in most scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_journalWrite work-noteA
Write a dated work-note / diary entry into the scratchbook: what you're doing, a decision, a finding, or a suspected bug. Namespaced to a project (default) or 'global' for cross-project notes. Recall later with scratchbook_recall. Keep each note self-contained.
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | Comma-separated tags, e.g. 'bug, tts, cache'. | |
| text | Yes | The note. Be specific: what, where (file:line), why it matters. | |
| project | No | Absolute project root, or 'global'. Defaults to the server's cwd. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full behavioral disclosure. It discloses that notes are dated, namespaced, and persisted (recall later), but it omits details like whether notes append or overwrite, error behavior, or any permission requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three short sentences, front-loaded with the core purpose, and includes only relevant guidance on namespacing and self-containment. No fluff or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the what, when, and namespace behavior, and mentions persistence via recall. However, it does not specify the tool's return value, failure modes, or any limits, and there is no output schema to fill that gap. It is adequate but not exhaustive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already describes all three parameters comprehensively (100% coverage). The description adds modest context by explaining the project namespace and advising self-contained text, but it adds no new meaning for the tags parameter. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool writes a dated work-note/diary entry into the scratchbook, with specific examples (what you're doing, decision, finding, bug). It differentiates itself from sibling tools by explicitly pointing to scratchbook_recall for retrieval, making it clear this is the write operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives concrete usage contexts (what to record) and explains the namespace options (project vs global). It also names scratchbook_recall as the alternative for reading notes later, though it does not explicitly list when not to use this tool beyond that.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_outlineCodebase outlineA
Structural map of a codebase (or a subtree / single file): each file's imports and top-level symbols with line numbers. Use it to grasp how a project is organised without reading every file. Provide path to focus on a file or a directory prefix.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | File path or directory prefix to focus on, e.g. 'lib/ai'. | |
| limit | No | Max files to list (default 60). | |
| project | No | Absolute project root. Defaults to the server's cwd. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states that the tool lists each file's imports and top-level symbols with line numbers, and implies a read-only operation by focusing on structure rather than modification. It also hints at efficiency ('without reading every file'), which adds useful context beyond the schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences long, each serving a purpose: defining the output, stating the use case, and explaining how to focus the tool. It is front-loaded with the most important information and contains no filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is relatively simple, and the description plus schema cover all necessary aspects. Since there is no output schema, the description appropriately explains what the output contains (imports, symbols, line numbers). The parameter descriptions in the schema handle the rest, making the overall context complete for an agent to select and invoke the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already provides descriptions for all three parameters (100% coverage), so the baseline is 3. The description adds a small amount of extra guidance by explaining that `path` can focus on a file or directory prefix, but it does not elaborate on `limit` or `project` beyond what the schema already states.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: a structural map of a codebase, subtree, or single file, listing imports and top-level symbols with line numbers. It uses specific language that conveys the exact output, distinguishing it from generic 'outline' tools and sibling tools like search or index.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear guidance: 'Use it to grasp how a project is organised without reading every file.' It also tells the user to provide a path to focus on a specific file or directory prefix. However, it does not explicitly mention when not to use it or compare it to alternatives like search or index, which would elevate it to a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_recallRecall work-notesA
Search your past journal / work-notes by meaning. Use it to remember what you were doing, prior decisions, or issues you flagged. Scope to the current project, 'global', or all projects.
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | Number of notes (default 6). | |
| query | Yes | What you want to remember. | |
| scope | No | Where to look (default 'project'). | |
| project | No | Absolute project root. Defaults to the server's cwd. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the transparency burden. It discloses that the search is by meaning (semantic) and that scope can be set to project, global, or all, which is useful. However, it does not explicitly state whether the operation is read-only, how results are ranked, or whether prior indexing is required. This is adequate but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured: three short sentences that lead with the core action, then use cases, then scope. Every sentence adds value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the tool's purpose, typical use cases, and scope options, but it does not describe the output format or any prerequisites (e.g., whether notes must be indexed via scratchbook_index). Given no output schema and no annotations, this is a noticeable gap for a complete understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already covers all parameters with descriptions (100% coverage). The description adds minimal extra meaning, merely paraphrasing the scope enum. It does not clarify the 'k' parameter or the 'project' parameter, so the description adds little beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific action ('Search your past journal / work-notes by meaning'), identifies the resource, and distinguishes this tool from sibling 'scratchbook_search' by emphasizing semantic search ('by meaning'). It also enumerates concrete use cases like remembering prior decisions or flagged issues.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use the tool ('Use it to remember what you were doing, prior decisions, or issues you flagged'), but it does not explicitly mention alternatives or when not to use it. It implies a distinction from lexical search without naming siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_searchSemantic code searchA
Semantic search across a codebase's indexed code. Returns the most relevant code chunks with file:line locations, enclosing symbol and a snippet — across the whole repo, not just one directory (unlike grep). Use it to locate where a concept or behaviour lives before reading files. Ask in natural language ('where are TTS chunks cached', 'auth token verification'). The project must be indexed first.
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | Number of results (default 8). | |
| lang | No | Restrict to a language, e.g. 'typescript', 'python'. | |
| query | Yes | Natural-language description of the code/behaviour you're looking for. | |
| project | No | Absolute project root. Defaults to the server's cwd. | |
| path_prefix | No | Restrict to paths starting with this prefix, e.g. 'lib/tts'. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses the output format ('file:line locations, enclosing symbol and a snippet'), the scope ('across the whole repo'), and a state precondition ('must be indexed first'). This goes beyond generic 'search' descriptions, though it doesn't address error behavior or side effects, which are minimal for a read-only search.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three tight sentences that front-load the core purpose first, then usage guidance, then query mode and prerequisite. Every sentence adds new information without padding.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers what the tool returns, its scope, and a prerequisite, which is substantial for a search tool. With no output schema, it compensates by naming the return components. It could be even more complete by describing behavior when the project isn't indexed or when no results match, but overall it is well-rounded.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds value by clarifying the 'query' parameter with natural-language examples ('where are TTS chunks cached') and by implying that 'path_prefix' is an optional restrictor via the 'not just one directory' contrast. It also connects the 'project' parameter to the indexing prerequisite.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific verb and resource: 'Semantic search across a codebase's indexed code.' It distinguishes itself from grep by noting it operates 'across the whole repo, not just one directory.' The title 'Semantic code search' aligns, and the first sentence fully defines the tool's purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives explicit context for when to use: 'Use it to locate where a concept or behaviour lives before reading files.' It also provides a prerequisite ('The project must be indexed first') and demonstrates the natural-language query format with examples. However, it does not explicitly mention when to use alternative scratchbook sibling tools or when not to use this tool beyond the 'unlike grep' comparison.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scratchbook_statusScratchbook statusA
Scratchbook health and what's indexed: embedding-service status, the list of indexed projects with chunk / note counts, and detail for one project if given.
| Name | Required | Description | Default |
|---|---|---|---|
| project | No | Absolute project root to detail. Optional. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden of disclosing behavior. It describes the content of the response (health, project list, detail) but does not explicitly confirm the tool is read-only or non-mutating, nor mention any operational constraints like permissions or latency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One sentence compactly lists all key aspects: health, indexed projects with counts, and optional per-project detail. No redundancy or filler, information-dense and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a status tool with a single optional parameter and no output schema, the description covers the main return components (health, project list, detail) sufficiently. It lacks finer specifics like possible health values or output format, but these are not critical given the tool's simplicity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already provides 100% coverage for the single parameter 'project', describing it as 'Absolute project root to detail. Optional.' The description echoes this by saying 'detail for one project if given', adding no new semantics beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description explicitly states the tool reports scratchbook health and what's indexed, listing concrete outputs: embedding-service status, indexed projects with counts, and per-project detail. This clearly differentiates it from sibling tools like scratchbook_index or scratchbook_search, which perform actions rather than report state.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies this is the tool for checking health and index state, but it does not explicitly state when to use it over alternatives or provide exclusions. The context is inferred from the tool's purpose rather than directly instructed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool targets a distinct concern: indexing, semantic search, structural outline, journaling, recall, status, forget, and gaze (create/read). There is no overlap in purpose, and the descriptions make boundaries clear.
All tools share the `scratchbook_` prefix and use consistent lowercase snake_case. The suffixes are single verbs/nouns, and even the compound `gaze_read` follows the established pattern. No style mixing.
With 9 tools covering codebase indexing/search/outline, journaling/recall, status/forget, and the gaze subsystem, the count is well-scoped and each tool earns its place.
Core workflows are covered: index, search, outline, journal, recall, forget, status, gaze, and gaze_read. Minor gaps exist—journal notes cannot be updated or deleted, and gaze boards lack a list/delete capability—but these are workable.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Shared memory for coding agents. Stop re-explaining your codebase every session.
Project memory, semantic code search, and grounded agent context.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Related MCP Servers
- AlicenseBqualityCmaintenanceA local-first MCP server that provides AI agents with safe codebase access through file discovery, hybrid lexical-semantic search, and project introspection. It features durable local memory and semantic indexing while keeping all data and processing entirely on your local machine.74296MIT
- AlicenseAqualityBmaintenanceUnified MCP server combining hybrid search (vector + BM25 + code graph), structural code analysis, and persistent semantic memory. 15 tools, 25+ languages, <350MB RAM, fully local.10MIT
- AlicenseAqualityAmaintenancePersistent memory MCP server for AI coding agents (Claude Code, Codex, Gemini CLI). Hybrid retrieval (vector + BM25), cross-encoder reranking, knowledge graph, session checkpoint/resume, and multi-scope isolation. Local-first with LanceDB.3027615MIT
- AlicenseAqualityDmaintenanceMCP server for semantic code indexing using vector embeddings, enabling AI agents to maintain persistent memory of codebases through natural language queries and intelligent chunking.19764MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jinyaolin/scratchbook'
If you have feedback or need assistance with the MCP directory API, please join our Discord server