@mastra/mcp-docs-server 1.3.14-alpha.4 → 1.3.14-alpha.5

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.
@@ -43,18 +43,27 @@ Pass both or neither. [`embedderOptions`](https://mastra.ai/reference/knowledge/
43
43
 
44
44
  Pages and notes are embedded when they're written. Scope pages aren't embedded, but notes on them are. Long pages are embedded in parts, and search still returns each page once. See [Limits](https://mastra.ai/reference/knowledge/limits) for the sizes.
45
45
 
46
- Knowledge doesn't embed content that already exists. Pages and notes written before you add `vector` and `embedder` stay keyword-only until they change.
46
+ Pages and notes written before you add `vector` and `embedder` stay keyword-only until they change. To embed them, run [`reembed()`](https://mastra.ai/reference/knowledge/knowledge-class) in batches until it returns no cursor. It doesn't change the pages. If the embedder keeps rate limiting, a call stops early with `rateLimited: true`, so wait before going on:
47
47
 
48
- Avoid switching embedders on a store that already has embedded content. Knowledge can't re-embed it yet:
48
+ ```typescript
49
+ let cursor: string | undefined
50
+ do {
51
+ const result = await knowledge.reembed({ cursor })
52
+ if (result.rateLimited) await new Promise(resolve => setTimeout(resolve, 60_000))
53
+ cursor = result.nextCursor
54
+ } while (cursor)
55
+ ```
56
+
57
+ Run it again after you switch embedders. Until it finishes, search works less well:
49
58
 
50
- - **Different dimension:** search uses a new index, so existing content is keyword-only until it changes.
51
- - **Same dimension:** search keeps using the old vectors and compares them with the new model's queries, which gives poor matches until each page changes.
59
+ - **Different dimension:** search uses a new index, so content not yet embedded again is keyword-only.
60
+ - **Same dimension:** search compares the new model's queries with vectors from the old model, which gives poor matches.
52
61
 
53
62
  ### When embedding fails
54
63
 
55
64
  If embedding or the vector write fails when a page or note is written, Knowledge tries again after about half a second, 2 seconds and 7.5 seconds. That covers a database that scales to zero and takes a few seconds to wake. Errors the provider marks as not retryable, such as a bad API key, aren't tried again.
56
65
 
57
- If every attempt fails, the write still succeeds and Mastra logs a warning. A new page or note stays keyword-only. An updated one keeps its previous vectors, so meaning search matches its old content. Both last until it's written again with a change. An `upsertPage()` call that comes back `unchanged` writes nothing, so it doesn't embed the page either.
66
+ If every attempt fails, the write still succeeds and Mastra logs a warning. A new page or note stays keyword-only. An updated one keeps its previous vectors, so meaning search matches its old content. Both last until it's written again with a change, or until [`reembed()`](https://mastra.ai/reference/knowledge/knowledge-class) embeds it. An `upsertPage()` call that comes back `unchanged` writes nothing, so it doesn't embed the page either.
58
67
 
59
68
  If the embedder or vector store fails during a search, the search returns keyword results and logs a warning.
60
69
 
@@ -162,7 +162,7 @@ Returns the `displayLabel` for a scope address with its `$params` filled in: `'$
162
162
 
163
163
  ### Host writes
164
164
 
165
- `upsertPage()`, `removePage()`, `addNote()`, `updateNote()` and `removeNote()` are host-only: they check no run scopes or access rules. Don't expose them through an agent tool, or through a server route without admin-level auth.
165
+ `upsertPage()`, `removePage()`, `movePage()`, `addNote()`, `updateNote()` and `removeNote()` are host-only: they check no run scopes or access rules. Don't expose them through an agent tool, or through a server route without admin-level auth.
166
166
 
167
167
  #### `upsertPage()`
168
168
 
@@ -187,6 +187,23 @@ removePage(input: { scope: string; path: string; author?: string }): Promise<Kno
187
187
 
188
188
  Removes the page at `path` and resolves to it, or to `null` when no page is there. Throws `"<scope>#<path>" has child pages; remove them first.` for a page with children, and `"<scope>#<path>" is declared in config; change the scope's pages to remove it.` for a template page. Throws without retrying when another write changed the page first.
189
189
 
190
+ #### `movePage()`
191
+
192
+ ```typescript
193
+ movePage(input: {
194
+ scope: string
195
+ path: string
196
+ parent?: string
197
+ toScope?: string
198
+ expectedVersion?: number
199
+ author?: string
200
+ }): Promise<KnowledgePage>
201
+ ```
202
+
203
+ Moves the page at `path` in `scope`, with its child pages, under the page at `parent` and resolves to the moved page. `parent` is a key path in the destination scope. Leave it out to move the page to the top of the scope. `toScope` moves the page to another scope, creating that scope on first write like `upsertPage()`. The page keeps its ID, notes, pins and embeddings, so use it instead of removing and re-creating a page when its source moves. Paths below the page change, and links by path are re-resolved.
204
+
205
+ Throws `KnowledgeNotFoundError` when the page or the parent doesn't exist, `"<scope>#<path>" is declared in config; change the scope's pages to move it.` for a template page, `"<scope>#<path>" can't move under itself or its own subtree.`, and `"<parent>" already has a page with key "<key>"; move or rename that one first.` It also throws when the move would put pages more than 10 levels below the scope, and without retrying when another write changed the page first or when `expectedVersion` is stale.
206
+
190
207
  #### `addNote()`
191
208
 
192
209
  ```typescript
@@ -235,13 +252,39 @@ const [scope] = await store.getScopesByAddress(['team:acme:support'])
235
252
  const page = await store.getPageByPath({ scopeId: scope.id, path: ['handbook', 'refunds'], read })
236
253
  ```
237
254
 
255
+ #### `reembed()`
256
+
257
+ ```typescript
258
+ reembed(options?: { scope?: string; limit?: number; cursor?: string }): Promise<KnowledgeReembedResult>
259
+ ```
260
+
261
+ Embeds pages and notes that already exist, without changing them. Use it for content written before you added `vector` and `embedder`, or after you switch embedders. Each call handles up to `limit` pages (default 50, at most 500) with their notes, and resolves to:
262
+
263
+ - `embedded`: how many pages and notes this call embedded.
264
+ - `failed`: pages and notes whose embed still failed after Knowledge's own retries, each with its `kind`, `id` and `error`. The rest of the batch carries on, and a later run tries them again.
265
+ - `overChunkCap`: pages longer than the [chunk limit](https://mastra.ai/reference/knowledge/limits), with how many chunks they'd need. They're embedded up to the limit.
266
+ - `rateLimited`: `true` when the embedder kept rate limiting, so the call stopped early. Wait before you resume from `nextCursor`, or the next call is rate limited too.
267
+ - `nextCursor`: pass it as `cursor` to the next call. It's absent when everything has been handled.
268
+
269
+ `scope` limits the run to one scope's pages and the notes on them, such as `org:acme`. Without it, the run covers every page, then the notes on scope pages, where each scope counts toward `limit` like a page. Embedding a page again overwrites its vectors, so you can stop a run and resume it from the last cursor, or rerun it. The cursor isn't a snapshot. Pages added or removed during a run can be missed or handled twice, and a page read before a concurrent edit can overwrite the vectors that edit wrote. Run `reembed()` again after concurrent writes finish. Throws without `vector` and `embedder`.
270
+
271
+ ```typescript
272
+ let cursor: string | undefined
273
+ do {
274
+ const result = await knowledge.reembed({ cursor })
275
+ for (const failure of result.failed) console.warn(failure)
276
+ if (result.rateLimited) await new Promise(resolve => setTimeout(resolve, 60_000))
277
+ cursor = result.nextCursor
278
+ } while (cursor)
279
+ ```
280
+
238
281
  #### `reindexLinks()`
239
282
 
240
283
  ```typescript
241
284
  reindexLinks(): Promise<number>
242
285
  ```
243
286
 
244
- Rebuilds the page link index from every page body, and resolves to how many pages it indexed. Writes keep the index current, so this is for pages that predate it or were written straight to the store. It needs no vector store.
287
+ Rebuilds the page link index from every page body, and resolves to how many pages it indexed. Writes keep the index current, so this is for pages that predate it or were written straight to the store, and for links a write left as they were. A write re-resolves at most 100 linking pages, and checks at most 99 pages sharing a name. Past either limit it logs a warning that names `reindexLinks()`. It needs no vector store.
245
288
 
246
289
  #### `renameScopeDeclaration()`
247
290
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.3.14-alpha.4",
3
+ "version": "1.3.14-alpha.5",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "@mastra/mcp-legacy": "npm:@mastra/mcp@^1.18.0",
27
27
  "local-pkg": "^1.2.1",
28
28
  "zod": "^4.6.7",
29
- "@mastra/core": "1.84.0-alpha.4",
29
+ "@mastra/core": "1.84.0-alpha.5",
30
30
  "@mastra/mcp": "^2.10.0-alpha.0"
31
31
  },
32
32
  "devDependencies": {