claude-local-docs 1.0.2 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,42 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
3
  "name": "claude-local-docs",
4
- "description": "A local-first Context7 alternative. Indexes your JS/TS project dependency docs locally with a 4-stage RAG pipeline (vector + BM25 + RRF + cross-encoder reranking). No cloud APIs at query time — all models run on your machine.",
4
+ "description": "Local-first Context7 alternative indexes JS/TS dependency docs with a 4-stage RAG pipeline. GPU-accelerated via TEI Docker containers.",
5
5
  "owner": {
6
- "name": "matthew"
6
+ "name": "matthew",
7
+ "email": "matteodante@users.noreply.github.com"
8
+ },
9
+ "metadata": {
10
+ "version": "1.0.7"
7
11
  },
8
12
  "plugins": [
9
13
  {
10
14
  "name": "claude-local-docs",
11
- "description": "A local-first, offline-capable alternative to Context7 for dependency documentation. Reads your package.json, fetches docs (preferring llms.txt), and indexes them with a production-grade 4-stage RAG pipeline: vector search + BM25 keywords + RRF fusion + cross-encoder reranking. All models (nomic-embed-text-v1.5, ms-marco-MiniLM) run locally via ONNX no cloud API calls at query time, no rate limits, full privacy.",
12
- "version": "1.0.0",
15
+ "description": "Offline-capable documentation search for JS/TS projects. Reads your package.json, fetches docs (preferring llms.txt), and indexes them with a 4-stage RAG pipeline: vector search + BM25 keywords + RRF fusion + cross-encoder reranking. Embeddings and reranking run via TEI (HuggingFace Text Embeddings Inference) Docker containers with auto GPU detection (NVIDIA CUDA, Apple Metal).",
16
+ "version": "1.0.7",
13
17
  "author": {
14
18
  "name": "matthew"
15
19
  },
16
20
  "source": "./",
17
21
  "category": "development",
18
22
  "license": "MIT",
19
- "keywords": ["documentation", "search", "rag", "embeddings", "local-first", "semantic-search", "llms-txt", "context7-alternative", "offline", "vector-search", "bm25", "reranking", "dependency-docs"]
23
+ "keywords": [
24
+ "documentation",
25
+ "search",
26
+ "rag",
27
+ "embeddings",
28
+ "local-first",
29
+ "semantic-search",
30
+ "llms-txt",
31
+ "context7-alternative",
32
+ "offline",
33
+ "vector-search",
34
+ "bm25",
35
+ "reranking",
36
+ "dependency-docs",
37
+ "docker",
38
+ "tei"
39
+ ]
20
40
  }
21
41
  ]
22
42
  }
@@ -1,8 +1,29 @@
1
1
  {
2
2
  "name": "claude-local-docs",
3
- "description": "A local-first Context7 alternative. Indexes JS/TS dependency docs with a 4-stage RAG pipeline (vector + BM25 + reranking). All models run locally — no cloud APIs at query time.",
4
- "version": "1.0.0",
3
+ "version": "1.0.7",
4
+ "description": "Local-first Context7 alternative — indexes JS/TS dependency docs with a 4-stage RAG pipeline (vector + BM25 + RRF + cross-encoder reranking). Uses TEI Docker containers for GPU-accelerated embeddings and reranking.",
5
5
  "author": {
6
- "name": "matthew"
7
- }
6
+ "name": "matthew",
7
+ "url": "https://github.com/matteodante"
8
+ },
9
+ "homepage": "https://github.com/matteodante/claude-local-docs",
10
+ "repository": "https://github.com/matteodante/claude-local-docs",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "documentation",
14
+ "search",
15
+ "rag",
16
+ "embeddings",
17
+ "local-first",
18
+ "semantic-search",
19
+ "llms-txt",
20
+ "context7-alternative",
21
+ "offline",
22
+ "vector-search",
23
+ "bm25",
24
+ "reranking",
25
+ "dependency-docs",
26
+ "docker",
27
+ "tei"
28
+ ]
8
29
  }
package/.mcp.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
- "local-docs": {
3
- "command": "npx",
4
- "args": ["-y", "claude-local-docs"]
2
+ "mcpServers": {
3
+ "local-docs": {
4
+ "command": "npx",
5
+ "args": ["-y", "claude-local-docs@latest"],
6
+ "env": {
7
+ "TEI_EMBED_URL": "http://localhost:39281",
8
+ "TEI_RERANK_URL": "http://localhost:39282"
9
+ }
10
+ }
5
11
  }
6
12
  }
package/README.md CHANGED
@@ -1,57 +1,76 @@
1
1
  # claude-local-docs
2
2
 
3
- A local-first alternative to Context7 for Claude Code. Indexes your project's dependency documentation locally and provides production-grade semantic search no cloud APIs at query time, no rate limits, full privacy.
3
+ A local-first alternative to Context7 for Claude Code. Indexes your project's dependency documentation locally and provides production-grade semantic search. Embeddings and reranking run via TEI (HuggingFace Text Embeddings Inference) Docker containers with auto GPU detection.
4
4
 
5
5
  ## Why not Context7?
6
6
 
7
7
  | | **claude-local-docs** | **Context7** |
8
8
  |---|---|---|
9
- | **Runs where** | Your machine (ONNX models) | Upstash cloud servers |
9
+ | **Runs where** | Your machine (TEI Docker) | Upstash cloud servers |
10
10
  | **Privacy** | Docs never leave your machine | Queries sent to cloud API |
11
11
  | **Rate limits** | None | API-dependent |
12
12
  | **Offline** | Full search works offline | Requires internet |
13
+ | **GPU accelerated** | NVIDIA CUDA / Apple Metal | N/A |
13
14
  | **Search quality** | 4-stage RAG (vector + BM25 + RRF + cross-encoder reranking) | Single-stage retrieval |
14
15
  | **Doc sources** | Prefers llms.txt, falls back to official docs | Pre-indexed source repos |
15
16
  | **Scope** | Your project's actual dependencies | Any library |
16
- | **Setup** | `npm install` + `/fetch-docs` | Install plugin |
17
17
  | **Monorepo** | Detects pnpm/npm/yarn workspaces, resolves catalogs | N/A |
18
18
 
19
- ## How it works
19
+ ## Prerequisites
20
20
 
21
- ```
22
- /fetch-docs search_docs("how to use useState")
23
- │ │
24
- ▼ ▼
25
- Detect monorepo ┌─── Vector search (LanceDB) ───┐
26
- Scan all workspace pkgs │ nomic-embed-text-v1.5 │
27
- Resolve catalog: versions │ │
28
- │ │ ├─→ RRF Fusion
29
- ▼ │ │ (k=60)
30
- For each runtime dep: ├── BM25 search (LanceDB FTS) ──┘
31
- - Search for llms.txt │ keyword + stemming │
32
- - Raw fetch (no truncation)│ ▼
33
- - Chunk + embed + store │ Cross-encoder rerank
34
- │ ms-marco-MiniLM-L-6-v2
35
- │ │
36
- └──────────────────────────────────┘
37
-
38
-
39
- Top-K results
40
- ```
21
+ - **Docker** — [Docker Desktop](https://www.docker.com/products/docker-desktop/) for TEI containers
22
+ - **Node.js 20+**
23
+ - **NVIDIA GPU** (optional) — auto-detected, uses architecture-optimized TEI images
24
+ - **Apple Silicon** (optional) — native Metal build via Rust/cargo (no Docker needed)
41
25
 
42
26
  ## Installation
43
27
 
28
+ ### As a Claude Code plugin (recommended)
29
+
44
30
  ```bash
45
- # Clone into your Claude Code plugins directory
46
- git clone <repo-url> ~/.claude/plugins/claude-local-docs
31
+ # Add the marketplace
32
+ /plugin marketplace add matteodante/claude-local-docs
33
+
34
+ # Install the plugin
35
+ /plugin install claude-local-docs
36
+ ```
37
+
38
+ The plugin starts TEI containers automatically on session start via a SessionStart hook.
47
39
 
48
- # Install dependencies and build
49
- cd ~/.claude/plugins/claude-local-docs
40
+ ### Manual / development setup
41
+
42
+ ```bash
43
+ git clone https://github.com/matteodante/claude-local-docs.git
44
+ cd claude-local-docs
50
45
  npm install
51
46
  npm run build
47
+
48
+ # Start TEI (auto-detects GPU)
49
+ ./start-tei.sh
52
50
  ```
53
51
 
54
- Or install as a project-local plugin by cloning into your project and referencing it in your Claude Code settings.
52
+ ## How it works
53
+
54
+ ```
55
+ /fetch-docs search_docs("how to use useState")
56
+ | |
57
+ v v
58
+ Detect monorepo +--- Vector search (LanceDB) ---+
59
+ Scan all workspace pkgs | nomic-embed-text-v1.5 |
60
+ Resolve catalog: versions | |
61
+ | | +-> RRF Fusion
62
+ v | | (k=60)
63
+ For each runtime dep: +-- BM25 search (LanceDB FTS) --+
64
+ - Search for llms.txt | keyword + stemming |
65
+ - Raw fetch (no truncation)| v
66
+ - Chunk + embed + store | Cross-encoder rerank
67
+ | ms-marco-MiniLM-L-6-v2
68
+ | (via TEI :39282)
69
+ +----------------------------------+
70
+ |
71
+ v
72
+ Top-K results
73
+ ```
55
74
 
56
75
  ## Usage
57
76
 
@@ -61,7 +80,7 @@ Or install as a project-local plugin by cloning into your project and referencin
61
80
  /fetch-docs
62
81
  ```
63
82
 
64
- Claude analyzes your project (including monorepo workspaces), finds all runtime dependencies, searches the web for the best documentation for each one (preferring `llms-full.txt` > `llms.txt` > official docs), and indexes everything locally. Progress is reported one library at a time.
83
+ Claude analyzes your project (including monorepo workspaces), finds all runtime dependencies, searches the web for the best documentation for each one (preferring `llms-full.txt` > `llms.txt` > official docs), and indexes everything locally.
65
84
 
66
85
  ### 2. Search
67
86
 
@@ -80,38 +99,49 @@ Show me the API for zod's .refine()
80
99
  - **`analyze_dependencies`** — List all deps (monorepo-aware, catalog-resolved, runtime/dev tagged)
81
100
  - **`fetch_and_store_doc`** — Fetch a URL and index it directly (no AI truncation)
82
101
 
83
- ## Search pipeline
102
+ ## TEI backend
84
103
 
85
- This plugin implements a 4-stage advanced RAG pipeline, the current production standard:
104
+ ML inference runs in TEI (HuggingFace Text Embeddings Inference) containers:
86
105
 
87
- | Stage | Technology | Purpose |
88
- |---|---|---|
89
- | **Vector search** | LanceDB + nomic-embed-text-v1.5 | Semantic similarity (understands meaning) |
90
- | **BM25 search** | LanceDB native FTS (BM25, stemming, stop words) | Keyword matching (exact terms like `useEffect`) |
91
- | **RRF fusion** | Reciprocal Rank Fusion (k=60) | Merges both ranked lists, handles different score scales |
92
- | **Cross-encoder rerank** | ms-marco-MiniLM-L-6-v2 | Rescores top 30 candidates with deep relevance model |
93
-
94
- ### Why this matters
106
+ | Container | Port | Model | Purpose |
107
+ |---|---|---|---|
108
+ | tei-embed | `:39281` | `nomic-ai/nomic-embed-text-v1.5` | Text embeddings (384-dim Matryoshka) |
109
+ | tei-rerank | `:39282` | `cross-encoder/ms-marco-MiniLM-L-6-v2` | Cross-encoder reranking |
95
110
 
96
- - **Vector-only** search misses exact API names and error codes
97
- - **Keyword-only** search misses semantic meaning ("state management" won't find "useState")
98
- - **Hybrid + reranking** catches both, then a cross-encoder picks the truly relevant results
111
+ ### Starting TEI
99
112
 
100
- ## Models
113
+ ```bash
114
+ ./start-tei.sh # Auto-detect GPU
115
+ ./start-tei.sh --metal # Force Apple Metal (native, no Docker)
116
+ ./start-tei.sh --cpu # Force CPU Docker
117
+ ./start-tei.sh --stop # Stop all TEI
118
+ ```
101
119
 
102
- All models run locally via ONNX. Downloaded once on first use, then cached.
120
+ Auto-detection selects the optimal backend:
103
121
 
104
- | Model | Size | Purpose |
122
+ | Platform | Backend | Image tag |
105
123
  |---|---|---|
106
- | `nomic-ai/nomic-embed-text-v1.5` | ~270MB | Text embeddings (86% top-5 accuracy, Matryoshka 384-dim) |
107
- | `Xenova/ms-marco-MiniLM-L-6-v2` | ~23MB | Cross-encoder reranking |
124
+ | NVIDIA RTX 50x0 (Blackwell) | Docker CUDA | `120-1.9` |
125
+ | NVIDIA RTX 40x0 (Ada) | Docker CUDA | `89-1.9` |
126
+ | NVIDIA RTX 30x0 (Ampere) | Docker CUDA | `86-1.9` |
127
+ | Apple Silicon | Native Metal | `cargo install --features metal` |
128
+ | No GPU | Docker CPU | `cpu-1.9` |
129
+
130
+ GPU override for NVIDIA:
131
+ ```bash
132
+ docker compose -f docker-compose.yml -f docker-compose.nvidia.yml up -d
133
+ ```
134
+
135
+ ## Search pipeline
108
136
 
109
- ## Chunking strategy
137
+ 4-stage RAG pipeline:
110
138
 
111
- - Split markdown by headings (`##`, `###`, `####`) preserving the heading path
112
- - Target ~1500 characters per chunk
113
- - 10% overlap between chunks to prevent losing context at boundaries
114
- - Large sections split at paragraph boundaries
139
+ | Stage | Technology | Purpose |
140
+ |---|---|---|
141
+ | **Vector search** | LanceDB + nomic-embed-text-v1.5 via TEI | Semantic similarity (understands meaning) |
142
+ | **BM25 search** | LanceDB native FTS (BM25, stemming, stop words) | Keyword matching (exact terms like `useEffect`) |
143
+ | **RRF fusion** | Reciprocal Rank Fusion (k=60) | Merges both ranked lists, handles different score scales |
144
+ | **Cross-encoder rerank** | ms-marco-MiniLM-L-6-v2 via TEI | Rescores top 30 candidates with deep relevance model |
115
145
 
116
146
  ## Storage
117
147
 
@@ -132,36 +162,33 @@ your-project/.claude/docs/
132
162
  | Tool | Description |
133
163
  |---|---|
134
164
  | `analyze_dependencies` | Monorepo-aware dep analysis: detects workspaces, resolves catalog versions, tags runtime/dev |
135
- | `store_and_index_doc` | Receive markdown, chunk, embed, store in LanceDB |
165
+ | `store_and_index_doc` | Receive markdown, chunk, embed via TEI, store in LanceDB |
136
166
  | `fetch_and_store_doc` | Fetch URL directly (raw HTTP, no truncation), then chunk + embed + store |
137
- | `search_docs` | Full RAG pipeline: vector + BM25 + RRF + rerank |
167
+ | `search_docs` | Full RAG pipeline: vector + BM25 + RRF + rerank via TEI |
138
168
  | `list_docs` | List indexed libraries with metadata |
139
169
  | `get_doc_section` | Get specific chunks by library + heading or chunk ID |
140
170
 
141
171
  ## Dependencies
142
172
 
143
- All open source:
144
-
145
173
  | Package | License | Purpose |
146
174
  |---|---|---|
147
175
  | `@lancedb/lancedb` | Apache 2.0 | Embedded vector database + native FTS |
148
- | `@huggingface/transformers` | Apache 2.0 | Run ONNX models locally |
149
176
  | `@modelcontextprotocol/sdk` | MIT | MCP server framework |
150
177
  | `zod` | MIT | Schema validation |
151
178
 
152
- No additional dependencies were added for monorepo support or HTTP fetching — everything uses Node built-ins.
179
+ TEI containers (Docker):
180
+
181
+ | Image | Model | Purpose |
182
+ |---|---|---|
183
+ | `text-embeddings-inference:*` | `nomic-ai/nomic-embed-text-v1.5` | Text embeddings |
184
+ | `text-embeddings-inference:*` | `cross-encoder/ms-marco-MiniLM-L-6-v2` | Cross-encoder reranking |
153
185
 
154
186
  ## Development
155
187
 
156
188
  ```bash
157
189
  npm run dev # Watch mode — rebuilds on file changes
158
190
  npm run build # One-time build
159
- ```
160
-
161
- ### Testing with MCP Inspector
162
-
163
- ```bash
164
- npx @modelcontextprotocol/inspector node dist/index.js
191
+ npm test # Integration test (requires TEI running)
165
192
  ```
166
193
 
167
194
  ## Project structure
@@ -169,25 +196,60 @@ npx @modelcontextprotocol/inspector node dist/index.js
169
196
  ```
170
197
  claude-local-docs/
171
198
  ├── .claude-plugin/
172
- │ ├── plugin.json # Plugin manifest
173
- │ └── marketplace.json # Marketplace listing
174
- ├── .mcp.json # MCP server config (stdio transport)
199
+ │ ├── plugin.json # Plugin manifest
200
+ │ └── marketplace.json # Marketplace listing
201
+ ├── .mcp.json # MCP server config (stdio transport)
175
202
  ├── commands/
176
- │ └── fetch-docs.md # /fetch-docs command — Claude as research agent
203
+ │ └── fetch-docs.md # /fetch-docs — Claude as research agent
204
+ ├── hooks/
205
+ │ └── hooks.json # SessionStart hook for TEI containers
206
+ ├── scripts/
207
+ │ └── ensure-tei.sh # Idempotent TEI health check + start
208
+ ├── docker-compose.yml # TEI containers (uses ${TEI_TAG})
209
+ ├── docker-compose.nvidia.yml # NVIDIA GPU device passthrough
210
+ ├── start-tei.sh # Auto-detect GPU, start TEI
177
211
  ├── src/
178
- │ ├── index.ts # MCP server entry, 6 tool definitions
179
- │ ├── indexer.ts # Chunking + nomic-embed-text-v1.5 embeddings
180
- │ ├── search.ts # 4-stage pipeline: vector + BM25 + RRF + rerank
181
- │ ├── reranker.ts # Cross-encoder (ms-marco-MiniLM-L-6-v2)
182
- │ ├── store.ts # LanceDB storage + metadata persistence
183
- │ ├── fetcher.ts # Raw HTTP fetch (no AI truncation)
184
- │ ├── workspace.ts # Monorepo detection + pnpm catalog + dep collection
185
- │ └── types.ts # Shared TypeScript interfaces
212
+ │ ├── index.ts # MCP server entry, 6 tool definitions
213
+ │ ├── indexer.ts # Chunking + TEI embeddings
214
+ │ ├── search.ts # 4-stage pipeline: vector + BM25 + RRF + rerank
215
+ │ ├── reranker.ts # TEI cross-encoder reranking
216
+ │ ├── store.ts # LanceDB storage + metadata persistence
217
+ │ ├── fetcher.ts # Raw HTTP fetch (no AI truncation)
218
+ │ ├── workspace.ts # Monorepo detection + pnpm catalog
219
+ │ └── types.ts # Shared TypeScript interfaces
186
220
  ├── LICENSE
187
221
  ├── package.json
188
222
  └── tsconfig.json
189
223
  ```
190
224
 
225
+ ## Troubleshooting
226
+
227
+ ### TEI containers not starting
228
+ ```bash
229
+ # Check Docker is running
230
+ docker info
231
+
232
+ # Check container logs
233
+ docker compose logs tei-embed
234
+ docker compose logs tei-rerank
235
+
236
+ # Restart
237
+ ./start-tei.sh --stop && ./start-tei.sh
238
+ ```
239
+
240
+ ### Port conflicts
241
+ If 39281/39282 are in use, override via env vars:
242
+ ```bash
243
+ TEI_EMBED_URL=http://localhost:49281 TEI_RERANK_URL=http://localhost:49282 node dist/index.js
244
+ ```
245
+
246
+ ### Apple Silicon — slow performance
247
+ The default Docker CPU image runs via Rosetta 2. Use native Metal instead:
248
+ ```bash
249
+ ./start-tei.sh --metal
250
+ ```
251
+ Requires Rust (`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`). First build takes a few minutes.
252
+
191
253
  ## License
192
254
 
193
255
  MIT
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  description: "Fetch and index documentation for all project dependencies"
3
- allowed-tools: ["mcp__local-docs__analyze_dependencies", "mcp__local-docs__list_docs", "mcp__local-docs__store_and_index_doc", "mcp__local-docs__fetch_and_store_doc", "WebFetch", "WebSearch"]
3
+ allowed-tools: ["mcp__local-docs__analyze_dependencies", "mcp__local-docs__list_docs", "mcp__local-docs__discover_and_fetch_docs", "mcp__local-docs__fetch_and_store_doc", "WebSearch", "WebFetch"]
4
4
  ---
5
5
 
6
6
  # Fetch Documentation for Project Dependencies
7
7
 
8
- You are a documentation research agent. Your job is to find and fetch the best available documentation for each dependency in this project, then store it locally for semantic search.
8
+ You are a documentation indexing agent. Your job is to discover and index the best available documentation for each runtime dependency in this project.
9
9
 
10
10
  ## Steps
11
11
 
@@ -31,32 +31,54 @@ This leaves only **runtime dependencies** that actually need documentation.
31
31
 
32
32
  Call `list_docs` to see which libraries are already indexed. **Skip** any library that was fetched within the last 7 days unless the user explicitly asks to refresh.
33
33
 
34
- ### 4. Fetch Documentation — One Library at a Time
34
+ ### 4. Fetch Documentation
35
35
 
36
- Process each remaining library **one at a time** with clear progress reporting. For each library:
36
+ For each remaining library, follow this multi-step strategy. The goal is to find the **best quality** source `llms-full.txt` > `llms.txt` (expanded index) > homepage HTML > README.
37
37
 
38
- #### a. Search for llms-full.txt (best source)
39
- 1. **WebSearch** for `"{library name} llms-full.txt"`
40
- 2. If you find a direct URL to `llms-full.txt`:
41
- - Call **`fetch_and_store_doc`** with the URL (this fetches raw content — no truncation)
42
- - Report: `[1/N] library-name — chunks from llms-full.txt (size)`
38
+ #### Step A: Check Known URLs first
43
39
 
44
- #### b. Search for llms.txt (good source)
45
- If no llms-full.txt found:
46
- 1. **WebSearch** for `"{library name} llms.txt"`
47
- 2. If you find a direct URL to `llms.txt`:
48
- - Call **`fetch_and_store_doc`** with the URL
49
- - Report: `[2/N] library-name — chunks from llms.txt (size)`
40
+ Before any searching, check if the library is in the **Known URLs Reference** below. If there's a known `llms-full.txt` or `llms.txt` URL, use it directly with `fetch_and_store_doc`. This is the fastest path.
50
41
 
51
- #### c. Fallback: Official docs via WebFetch
52
- If no llms.txt exists:
53
- 1. **WebSearch** for `"{library name} official documentation"`
54
- 2. **WebFetch** the main documentation page
55
- 3. Call **`store_and_index_doc`** with the fetched content
56
- 4. Report: `[3/N] library-name — chunks from official docs`
42
+ #### Step B: WebSearch for llms.txt
57
43
 
58
- #### d. If all attempts fail
59
- Report: `[4/N] library-name — SKIPPED (no docs found)` and move on.
44
+ For libraries NOT in the known list, use **WebSearch** to find the actual `llms.txt` or `llms-full.txt` URL. Use queries like:
45
+
46
+ > `{library-name} llms-full.txt site:{homepage-domain}`
47
+
48
+ or more broadly:
49
+
50
+ > `{library-name} llms-full.txt OR llms.txt documentation`
51
+
52
+ If the search finds a concrete URL to an `llms.txt` or `llms-full.txt` file, pass it directly to **`fetch_and_store_doc`**. Prefer `llms-full.txt` over `llms.txt` when both exist.
53
+
54
+ **Batch the searches**: Run WebSearch for multiple libraries in parallel (up to 5 at a time) to collect URLs upfront. Then fetch them one by one.
55
+
56
+ #### Step C: `discover_and_fetch_docs` (automatic probing)
57
+
58
+ If neither known URLs nor WebSearch found an `llms.txt` URL, call **`discover_and_fetch_docs`**. This tool automatically:
59
+ 1. Checks npm registry for `llms`/`llmsFull` fields in package.json (newest convention)
60
+ 2. Probes homepage, `docs.{domain}`, `llms.{domain}`, `/docs/` subpath for llms-full.txt/llms.txt
61
+ 3. Probes GitHub raw for llms-full.txt/llms.txt on main/master branches
62
+ 4. Falls back to README.md from GitHub
63
+ 5. Falls back to homepage HTML → markdown conversion
64
+ 6. Detects index files and expands them by fetching linked pages
65
+
66
+ #### Step D: Training data fallback
67
+
68
+ If all above fail, try **`fetch_and_store_doc`** with documentation URLs you know from your training data (GitHub raw docs, official doc site pages, etc.).
69
+
70
+ #### Evaluating results
71
+
72
+ After each library is fetched, check the chunk count:
73
+ - **< 5 chunks**: Very thin. Use WebSearch to find additional doc pages (API reference, guides) and fetch with `fetch_and_store_doc` to supplement.
74
+ - **5-20 chunks**: Acceptable for small libraries.
75
+ - **20+ chunks**: Good coverage.
76
+
77
+ #### Progress reporting
78
+
79
+ After each library, report:
80
+ - `[1/N] library-name — X chunks from {source} (size)`
81
+ - `[2/N] library-name — FAILED: {error message}`
60
82
 
61
83
  ### 5. Final Summary
62
84
 
@@ -66,22 +88,113 @@ After processing all libraries, report:
66
88
  Done! Indexed X/Y libraries.
67
89
 
68
90
  react — 85 chunks (llms-full.txt, 340KB)
69
- next — 120 chunks (llms-full.txt, 510KB)
70
- zod — 45 chunks (llms.txt, 95KB)
71
- express — 30 chunks (official docs)
72
- lodash — SKIPPED (no docs found)
91
+ next — 120 chunks (llms.txt-index, expanded 45 pages)
92
+ zod — 45 chunks (llms-full.txt, 95KB)
93
+ express — 30 chunks (homepage-html)
94
+ lodash — FAILED (no docs found)
73
95
 
74
96
  Total: 280 chunks across 4 libraries.
75
97
  Use search_docs to query your documentation.
76
98
  ```
77
99
 
100
+ ## Known URLs Reference
101
+
102
+ Use these URLs directly with `fetch_and_store_doc` — no searching needed. Prefer `llms-full.txt` when available.
103
+
104
+ ### Frameworks & Core
105
+
106
+ | Library | Best URL |
107
+ |---|---|
108
+ | react | `https://react.dev/llms.txt` |
109
+ | react-dom | (use react URL above) |
110
+ | next | `https://nextjs.org/docs/llms-full.txt` |
111
+ | nuxt | `https://nuxt.com/llms-full.txt` |
112
+ | svelte | `https://svelte.dev/llms-full.txt` |
113
+ | @sveltejs/kit | `https://svelte.dev/llms-full.txt` |
114
+ | vue | (no official llms.txt — use `discover_and_fetch_docs`) |
115
+ | react-native | `https://reactnative.dev/llms.txt` |
116
+ | expo | `https://docs.expo.dev/llms-full.txt` |
117
+ | hono | `https://hono.dev/llms.txt` |
118
+ | bun | `https://bun.sh/llms.txt` |
119
+
120
+ ### Styling & UI
121
+
122
+ | Library | Best URL |
123
+ |---|---|
124
+ | tailwindcss | `https://tailwindcss.com/llms.txt` |
125
+ | @shadcn/ui / shadcn | `https://ui.shadcn.com/llms.txt` |
126
+ | @chakra-ui/react | `https://chakra-ui.com/llms-full.txt` |
127
+ | daisyui | `https://daisyui.com/llms.txt` |
128
+ | tamagui | `https://tamagui.dev/llms.txt` |
129
+ | @mantine/core | (check `https://mantine.dev/llms.txt`) |
130
+ | react-native-unistyles | `https://www.unistyl.es/llms.txt` |
131
+
132
+ ### Data & State
133
+
134
+ | Library | Best URL |
135
+ |---|---|
136
+ | zod | `https://zod.dev/llms-full.txt` |
137
+ | @tanstack/react-query | `https://tanstack.com/query/llms-full.txt` |
138
+ | @tanstack/react-router | `https://tanstack.com/llms.txt` |
139
+ | drizzle-orm | `https://orm.drizzle.team/llms-full.txt` |
140
+ | @prisma/client | `https://prisma.io/docs/llms-full.txt` |
141
+ | convex | `https://docs.convex.dev/llms.txt` |
142
+
143
+ ### Backend & APIs
144
+
145
+ | Library | Best URL |
146
+ |---|---|
147
+ | stripe | `https://docs.stripe.com/llms.txt` |
148
+ | @supabase/supabase-js | `https://supabase.com/llms.txt` |
149
+ | resend | `https://resend.com/docs/llms-full.txt` |
150
+ | @medusajs/medusa | `https://docs.medusajs.com/llms-full.txt` |
151
+ | better-auth | `https://www.better-auth.com/llms.txt` |
152
+
153
+ ### AI & LLM
154
+
155
+ | Library | Best URL |
156
+ |---|---|
157
+ | ai (Vercel AI SDK) | `https://sdk.vercel.ai/llms.txt` |
158
+ | @anthropic-ai/sdk | `https://docs.anthropic.com/llms-full.txt` |
159
+ | langchain | `https://js.langchain.com/llms.txt` |
160
+ | @modelcontextprotocol/sdk | `https://modelcontextprotocol.io/llms-full.txt` |
161
+ | mastra | `https://mastra.ai/llms-full.txt` |
162
+
163
+ ### Dev Tools & Infra
164
+
165
+ | Library | Best URL |
166
+ |---|---|
167
+ | turbo | `https://turbo.build/llms.txt` |
168
+ | @trigger.dev/sdk | `https://trigger.dev/docs/llms-full.txt` |
169
+ | @cloudflare/workers-types | `https://developers.cloudflare.com/llms-full.txt` |
170
+ | @upstash/redis | `https://upstash.com/docs/llms-full.txt` |
171
+ | @netlify/functions | `https://docs.netlify.com/llms.txt` |
172
+ | @liveblocks/client | `https://liveblocks.io/llms-full.txt` |
173
+
174
+ ### Animation
175
+
176
+ | Library | Best URL |
177
+ |---|---|
178
+ | motion / framer-motion | Special: `https://llms.motion.dev/docs/react-quick-start.md` (or use WebSearch for full index) |
179
+
180
+ ### Notes on special patterns
181
+
182
+ - **Stripe**: Any Stripe doc page becomes markdown by appending `.md` (e.g. `https://docs.stripe.com/payments.md`)
183
+ - **Motion (Framer Motion)**: Uses `llms.motion.dev` subdomain — `motion.dev/docs/{page}` becomes `llms.motion.dev/docs/{page}.md`
184
+ - **Mintlify-hosted docs**: Sites using Mintlify auto-generate `/llms.txt` and `/llms-full.txt` (Anthropic, Cursor, CrewAI, Pinecone, etc.)
185
+ - **GitBook-hosted docs**: Auto-generates `/llms.txt` since Jan 2025
186
+ - **Nuxt Content docs**: May have separate `https://content.nuxt.com/llms-full.txt`
187
+ - **package.json `llms`/`llmsFull` fields**: Some libraries (like Zod) include doc URLs directly in their npm package metadata — `discover_and_fetch_docs` checks this automatically
188
+
78
189
  ## Critical Rules
79
190
 
80
- - **NEVER write files to the filesystem directly.** Do NOT use the Write tool, Bash tool, or any other method to save documentation content to disk. ALL storage goes through the MCP tools (`fetch_and_store_doc` and `store_and_index_doc`), which save everything inside `.claude/docs/`. No exceptions.
81
- - **NEVER create markdown files, text files, or any other files** in the project directory. The MCP tools handle all file storage internally.
82
- - **Use `fetch_and_store_doc` for all llms.txt URLs** this fetches raw content without AI truncation, preserving full documentation
83
- - **Use `store_and_index_doc` only for WebFetch fallback** — pass the WebFetch result content directly to the tool, do NOT save it to a file first
84
- - **One library at a time** — clear progress, no batching
191
+ - **Check known URLs first** the reference table above is faster and more reliable than searching.
192
+ - **Search second, probe third** use WebSearch to find llms.txt URLs before falling back to blind URL probing via `discover_and_fetch_docs`.
193
+ - **Prefer `llms-full.txt` over `llms.txt`**the full version has complete documentation without truncation.
194
+ - **Use `fetch_and_store_doc` when you have a known URL** — from the reference table, WebSearch results, or training data.
195
+ - **Use `discover_and_fetch_docs` when you have no URL** — it will probe common patterns automatically.
196
+ - **Supplement thin results** — if a library has < 5 chunks, search for additional doc pages and fetch them.
197
+ - **NEVER write files to the filesystem directly.** Do NOT use the Write tool, Bash tool, or any other method to save documentation content to disk. ALL storage goes through the MCP tools.
198
+ - **One library at a time for fetching** — clear progress, no batching (but WebSearch can be batched)
85
199
  - **Skip dev deps by default** — runtime deps only
86
- - For scoped packages like `@scope/package`, search for both the full name and just the package part
87
200
  - Handle errors gracefully: if a library fails, log it and move to the next one