@mastra/mcp-docs-server 0.0.7 → 0.0.8

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.
Files changed (68) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fastra.md +16 -16
  2. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +16 -16
  3. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +15 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +16 -16
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +21 -0
  6. package/.docs/organized/changelogs/%40mastra%2Fcore.md +14 -14
  7. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +26 -26
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +26 -26
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +26 -26
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +26 -26
  11. package/.docs/organized/changelogs/%40mastra%2Fevals.md +16 -16
  12. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +18 -18
  13. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +16 -16
  14. package/.docs/organized/changelogs/%40mastra%2Floggers.md +16 -16
  15. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -2
  16. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +16 -16
  17. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +15 -0
  18. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +16 -16
  19. package/.docs/organized/changelogs/%40mastra%2Fpg.md +16 -16
  20. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +16 -16
  21. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +21 -21
  22. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +16 -16
  23. package/.docs/organized/changelogs/%40mastra%2Frag.md +16 -16
  24. package/.docs/organized/changelogs/%40mastra%2Fragie.md +16 -16
  25. package/.docs/organized/changelogs/%40mastra%2Fserver.md +16 -16
  26. package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +16 -16
  27. package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +16 -16
  28. package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +16 -16
  29. package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +16 -16
  30. package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +16 -16
  31. package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +16 -16
  32. package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +16 -16
  33. package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +16 -16
  34. package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +16 -16
  35. package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +16 -16
  36. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +16 -16
  37. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +16 -16
  38. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +16 -16
  39. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +15 -0
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +15 -0
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +16 -16
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +16 -16
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +16 -16
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +16 -16
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +16 -10
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +16 -16
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +16 -16
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +15 -0
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +16 -16
  50. package/.docs/organized/changelogs/create-mastra.md +21 -21
  51. package/.docs/organized/changelogs/mastra.md +31 -31
  52. package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -2
  53. package/.docs/organized/code-examples/memory-with-mem0.md +0 -1
  54. package/.docs/raw/agents/agent-memory.mdx +1 -5
  55. package/.docs/raw/getting-started/installation.mdx +40 -51
  56. package/.docs/raw/memory/overview.mdx +1 -2
  57. package/.docs/raw/memory/semantic-recall.mdx +3 -4
  58. package/.docs/raw/memory/working-memory.mdx +1 -2
  59. package/dist/_tsup-dts-rollup.d.ts +84 -18
  60. package/dist/{chunk-J7WZZETH.js → chunk-QWYMT5LP.js} +3 -0
  61. package/dist/prepare-docs/prepare.js +1 -1
  62. package/dist/stdio.js +252 -90
  63. package/package.json +5 -6
  64. package/.docs/organized/code-examples/mcp-configuration.md +0 -341
  65. package/.docs/raw/guides/ai-recruiter.mdx +0 -187
  66. package/.docs/raw/guides/chef-michel.mdx +0 -242
  67. package/.docs/raw/guides/research-assistant.mdx +0 -297
  68. package/.docs/raw/guides/stock-agent.mdx +0 -182
package/dist/stdio.js CHANGED
@@ -1,77 +1,87 @@
1
1
  #!/usr/bin/env node
2
- import { fromPackageRoot, prepare } from './chunk-J7WZZETH.js';
2
+ import { fromPackageRoot, prepare } from './chunk-QWYMT5LP.js';
3
3
  import fs2 from 'node:fs/promises';
4
- import { FastMCP } from 'tylerbarnes-fastmcp-fix';
5
- import { JSDOM } from 'jsdom';
4
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
5
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
+ import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
7
  import { z } from 'zod';
8
+ import { zodToJsonSchema } from 'zod-to-json-schema';
9
+ import { JSDOM } from 'jsdom';
7
10
  import path2 from 'node:path';
8
11
 
9
12
  async function fetchBlogPosts() {
10
- try {
11
- const response = await fetch("https://mastra.ai/blog");
12
- if (!response.ok) {
13
- throw new Error("Failed to fetch blog posts");
14
- }
15
- const html = await response.text();
16
- const dom = new JSDOM(html);
17
- const document = dom.window.document;
18
- const blogLinks = Array.from(document.querySelectorAll('a[href^="/blog/"]')).filter((link) => {
19
- const href = link.getAttribute("href");
20
- return href !== "/blog" && !href?.includes("authors");
21
- }).map((link) => {
22
- const h2 = link.querySelector("h2");
23
- const title = h2?.textContent?.trim();
24
- const href = link.getAttribute("href");
25
- if (title && href) {
26
- return `[${title}](${href})`;
27
- }
28
- return null;
29
- }).filter(Boolean);
30
- return "Mastra.ai Blog Posts:\n\n" + blogLinks.join("\n");
31
- } catch (error) {
32
- throw new Error("Failed to fetch blog posts " + JSON.stringify(error));
13
+ const response = await fetch("https://mastra.ai/blog");
14
+ if (!response.ok) {
15
+ throw new Error("Failed to fetch blog posts");
33
16
  }
17
+ const html = await response.text();
18
+ const dom = new JSDOM(html);
19
+ const document = dom.window.document;
20
+ const blogLinks = Array.from(document.querySelectorAll('a[href^="/blog/"]')).filter((link) => {
21
+ const href = link.getAttribute("href");
22
+ return href !== "/blog" && !href?.includes("authors");
23
+ }).map((link) => {
24
+ const h2 = link.querySelector("h2");
25
+ const title = h2?.textContent?.trim();
26
+ const href = link.getAttribute("href");
27
+ if (title && href) {
28
+ return `[${title}](${href})`;
29
+ }
30
+ return null;
31
+ }).filter(Boolean);
32
+ return "Mastra.ai Blog Posts:\n\n" + blogLinks.join("\n");
34
33
  }
35
34
  async function fetchBlogPost(url) {
36
- try {
37
- const response = await fetch(url);
38
- if (!response.ok) {
39
- throw new Error("Failed to fetch blog post");
40
- }
41
- const html = await response.text();
42
- const dom = new JSDOM(html);
43
- const document = dom.window.document;
44
- const scripts = document.querySelectorAll("script");
45
- scripts.forEach((script) => script.remove());
46
- const content = document.body.textContent?.trim() || "";
47
- if (!content) {
48
- throw new Error("No content found in blog post");
49
- }
50
- return content;
51
- } catch (error) {
52
- throw new Error(`Failed to fetch blog post: ${error instanceof Error ? error.message : "Unknown error"}`);
35
+ const response = await fetch(url);
36
+ if (!response.ok) {
37
+ throw new Error("Failed to fetch blog post");
53
38
  }
39
+ const html = await response.text();
40
+ const dom = new JSDOM(html);
41
+ const document = dom.window.document;
42
+ const scripts = document.querySelectorAll("script");
43
+ scripts.forEach((script) => script.remove());
44
+ const content = document.body.textContent?.trim() || "";
45
+ if (!content) {
46
+ throw new Error("No content found in blog post");
47
+ }
48
+ return content;
54
49
  }
50
+ var blogInputSchema = z.object({
51
+ url: z.string().describe(
52
+ "URL of a specific blog post to fetch. If the string /blog is passed as the url it returns a list of all blog posts."
53
+ )
54
+ });
55
55
  var blogTool = {
56
56
  name: "mastraBlog",
57
57
  description: "Get Mastra.ai blog content. Without a URL, returns a list of all blog posts. With a URL, returns the specific blog post content in markdown format. The blog contains changelog posts as well as announcements and posts about Mastra features and AI news",
58
- parameters: z.object({
59
- url: z.string().describe(
60
- "URL of a specific blog post to fetch. If the string /blog is passed as the url it returns a list of all blog posts."
61
- )
62
- }),
63
58
  execute: async (args) => {
64
59
  try {
60
+ let content;
65
61
  if (args.url !== `/blog`) {
66
- return await fetchBlogPost(`https://mastra.ai${args.url}`);
62
+ content = await fetchBlogPost(`https://mastra.ai${args.url}`);
67
63
  } else {
68
- return await fetchBlogPosts();
64
+ content = await fetchBlogPosts();
69
65
  }
66
+ return {
67
+ content: [
68
+ {
69
+ type: "text",
70
+ text: content
71
+ }
72
+ ],
73
+ isError: false
74
+ };
70
75
  } catch (error) {
71
- if (error instanceof Error) {
72
- throw new Error("Failed to fetch blog posts");
73
- }
74
- throw error;
76
+ return {
77
+ content: [
78
+ {
79
+ type: "text",
80
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`
81
+ }
82
+ ],
83
+ isError: true
84
+ };
75
85
  }
76
86
  }
77
87
  };
@@ -111,20 +121,47 @@ ${availablePackages}`
111
121
  }
112
122
  var initialPackages = await listPackageChangelogs();
113
123
  var packagesListing = initialPackages.length > 0 ? "\n\nAvailable packages: " + initialPackages.map((pkg) => pkg.name).join(", ") : "\n\nNo package changelogs available yet. Run the documentation preparation script first.";
114
- var changesSchema = z.object({
124
+ var changesInputSchema = z.object({
115
125
  package: z.string().optional().describe("Name of the specific package to fetch changelog for. If not provided, lists all available packages.")
116
126
  });
117
127
  var changesTool = {
118
128
  name: "mastraChanges",
119
- description: "Get changelog information for Mastra.ai packages. " + packagesListing,
120
- parameters: changesSchema,
121
- execute: async (args, _context) => {
122
- if (!args.package) {
123
- const packages = await listPackageChangelogs();
124
- return ["Available package changelogs:", "", ...packages.map((pkg) => `- ${pkg.name}`)].join("\n");
129
+ description: `Get changelog information for Mastra.ai packages. ${packagesListing}`,
130
+ execute: async (args) => {
131
+ try {
132
+ if (!args.package) {
133
+ const packages = await listPackageChangelogs();
134
+ return {
135
+ content: [
136
+ {
137
+ type: "text",
138
+ text: ["Available package changelogs:", "", ...packages.map((pkg) => `- ${pkg.name}`)].join("\n")
139
+ }
140
+ ],
141
+ isError: false
142
+ };
143
+ }
144
+ const content = await readPackageChangelog(args.package);
145
+ return {
146
+ content: [
147
+ {
148
+ type: "text",
149
+ text: content
150
+ }
151
+ ],
152
+ isError: false
153
+ };
154
+ } catch (error) {
155
+ return {
156
+ content: [
157
+ {
158
+ type: "text",
159
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`
160
+ }
161
+ ],
162
+ isError: true
163
+ };
125
164
  }
126
- const content = await readPackageChangelog(args.package);
127
- return content;
128
165
  }
129
166
  };
130
167
  var docsBaseDir = fromPackageRoot(".docs/raw/");
@@ -177,7 +214,7 @@ ${content}`;
177
214
  return dirListing + fileContents;
178
215
  }
179
216
  return fs2.readFile(fullPath, "utf-8");
180
- } catch (error) {
217
+ } catch {
181
218
  throw new Error(`Path not found: ${docPath}`);
182
219
  }
183
220
  }
@@ -228,7 +265,7 @@ async function getAvailablePaths() {
228
265
  ].filter(Boolean).join("\n");
229
266
  }
230
267
  var availablePaths = await getAvailablePaths();
231
- var docsSchema = z.object({
268
+ var docsInputSchema = z.object({
232
269
  paths: z.array(z.string()).min(1).describe(`One or more documentation paths to fetch
233
270
  Available paths:
234
271
  ${availablePaths}`)
@@ -236,8 +273,7 @@ ${availablePaths}`)
236
273
  var docsTool = {
237
274
  name: "mastraDocs",
238
275
  description: "Get Mastra.ai documentation. Request paths to explore the docs. References contain API docs. Other paths contain guides. The user doesn't know about files and directories. This is your internal knowledge the user can't read. If the user asks about a feature check general docs as well as reference docs for that feature. Ex: with evals check in evals/ and in reference/evals/. Provide code examples so the user understands. If you build a URL from the path, only paths ending in .mdx exist. Note that docs about MCP are currently in reference/tools/. IMPORTANT: Be concise with your answers. The user will ask for more info. If packages need to be installed, provide the pnpm command to install them. Ex. if you see `import { X } from \"@mastra/$PACKAGE_NAME\"` in an example, show an install command. Always install latest tag, not alpha unless requested. If you scaffold a new project it may be in a subdir",
239
- parameters: docsSchema,
240
- execute: async (args, _context) => {
276
+ execute: async (args) => {
241
277
  try {
242
278
  const results = await Promise.all(
243
279
  args.paths.map(async (path4) => {
@@ -281,12 +317,25 @@ ${result.content}
281
317
  ---
282
318
  `;
283
319
  }).join("\n");
284
- return output;
320
+ return {
321
+ content: [
322
+ {
323
+ type: "text",
324
+ text: output
325
+ }
326
+ ],
327
+ isError: false
328
+ };
285
329
  } catch (error) {
286
- if (error instanceof Error) {
287
- throw new Error(`Failed to fetch documentation: ${error.message}`);
288
- }
289
- throw error;
330
+ return {
331
+ content: [
332
+ {
333
+ type: "text",
334
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`
335
+ }
336
+ ],
337
+ isError: true
338
+ };
290
339
  }
291
340
  }
292
341
  };
@@ -317,7 +366,7 @@ ${availableExamples}`);
317
366
  }
318
367
  var initialExamples = await listCodeExamples();
319
368
  var examplesListing = initialExamples.length > 0 ? "\n\nAvailable examples: " + initialExamples.map((ex) => ex.name).join(", ") : "\n\nNo examples available yet. Run the documentation preparation script first.";
320
- var examplesSchema = z.object({
369
+ var examplesInputSchema = z.object({
321
370
  example: z.string().optional().describe(
322
371
  "Name of the specific example to fetch. If not provided, lists all available examples." + examplesListing
323
372
  )
@@ -325,15 +374,42 @@ var examplesSchema = z.object({
325
374
  var examplesTool = {
326
375
  name: "mastraExamples",
327
376
  description: "Get code examples from the Mastra.ai examples directory. Without a specific example name, lists all available examples. With an example name, returns the full source code of that example.",
328
- parameters: examplesSchema,
329
- execute: async (args, _context) => {
330
- if (!args.example) {
331
- const examples = await listCodeExamples();
332
- return ["Available code examples:", "", ...examples.map((ex) => `- ${ex.name}`)].join("\n");
377
+ execute: async (args) => {
378
+ try {
379
+ if (!args.example) {
380
+ const examples = await listCodeExamples();
381
+ return {
382
+ content: [
383
+ {
384
+ type: "text",
385
+ text: ["Available code examples:", "", ...examples.map((ex) => `- ${ex.name}`)].join("\n")
386
+ }
387
+ ],
388
+ isError: false
389
+ };
390
+ }
391
+ const filename = args.example.endsWith(".md") ? args.example : `${args.example}.md`;
392
+ const content = await readCodeExample(filename);
393
+ return {
394
+ content: [
395
+ {
396
+ type: "text",
397
+ text: content
398
+ }
399
+ ],
400
+ isError: false
401
+ };
402
+ } catch (error) {
403
+ return {
404
+ content: [
405
+ {
406
+ type: "text",
407
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`
408
+ }
409
+ ],
410
+ isError: true
411
+ };
333
412
  }
334
- const filename = args.example.endsWith(".md") ? args.example : `${args.example}.md`;
335
- const content = await readCodeExample(filename);
336
- return content;
337
413
  }
338
414
  };
339
415
 
@@ -341,16 +417,102 @@ var examplesTool = {
341
417
  if (process.env.REBUILD_DOCS_ON_START === "true") {
342
418
  await prepare();
343
419
  }
344
- var server = new FastMCP({
345
- name: "Mastra Documentation Server",
346
- version: JSON.parse(await fs2.readFile(fromPackageRoot(`package.json`), "utf8")).version
420
+ var server = new Server(
421
+ {
422
+ name: "Mastra Documentation Server",
423
+ version: JSON.parse(await fs2.readFile(fromPackageRoot(`package.json`), "utf8")).version
424
+ },
425
+ {
426
+ capabilities: {
427
+ tools: {}
428
+ }
429
+ }
430
+ );
431
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
432
+ tools: [
433
+ {
434
+ name: "mastraBlog",
435
+ description: blogTool.description,
436
+ inputSchema: zodToJsonSchema(blogInputSchema)
437
+ },
438
+ {
439
+ name: "mastraDocs",
440
+ description: docsTool.description,
441
+ inputSchema: zodToJsonSchema(docsInputSchema)
442
+ },
443
+ {
444
+ name: "mastraExamples",
445
+ description: examplesTool.description,
446
+ inputSchema: zodToJsonSchema(examplesInputSchema)
447
+ },
448
+ {
449
+ name: "mastraChanges",
450
+ description: changesTool.description,
451
+ inputSchema: zodToJsonSchema(changesInputSchema)
452
+ }
453
+ ]
454
+ }));
455
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
456
+ try {
457
+ switch (request.params.name) {
458
+ case "mastraBlog": {
459
+ const args = blogInputSchema.parse(request.params.arguments);
460
+ return await blogTool.execute(args);
461
+ }
462
+ case "mastraDocs": {
463
+ const args = docsInputSchema.parse(request.params.arguments);
464
+ return await docsTool.execute(args);
465
+ }
466
+ case "mastraExamples": {
467
+ const args = examplesInputSchema.parse(request.params.arguments);
468
+ return await examplesTool.execute(args);
469
+ }
470
+ case "mastraChanges": {
471
+ const args = changesInputSchema.parse(request.params.arguments);
472
+ return await changesTool.execute(args);
473
+ }
474
+ default:
475
+ return {
476
+ content: [
477
+ {
478
+ type: "text",
479
+ text: `Unknown tool: ${request.params.name}`
480
+ }
481
+ ],
482
+ isError: true
483
+ };
484
+ }
485
+ } catch (error) {
486
+ if (error instanceof z.ZodError) {
487
+ return {
488
+ content: [
489
+ {
490
+ type: "text",
491
+ text: `Invalid arguments: ${error.errors.map((e) => `${e.path.join(".")}: ${e.message}`).join(", ")}`
492
+ }
493
+ ],
494
+ isError: true
495
+ };
496
+ }
497
+ return {
498
+ content: [
499
+ {
500
+ type: "text",
501
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`
502
+ }
503
+ ],
504
+ isError: true
505
+ };
506
+ }
347
507
  });
348
- server.addTool(blogTool);
349
- server.addTool(docsTool);
350
- server.addTool(examplesTool);
351
- server.addTool(changesTool);
508
+ async function runServer() {
509
+ const transport = new StdioServerTransport();
510
+ await server.connect(transport);
511
+ console.error("Mastra Docs MCP Server running on stdio");
512
+ }
352
513
 
353
514
  // src/stdio.ts
354
- void server.start({
355
- transportType: "stdio"
515
+ runServer().catch((error) => {
516
+ console.error("Fatal error running server:", error);
517
+ process.exit(1);
356
518
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,13 +27,12 @@
27
27
  "@modelcontextprotocol/sdk": "^1.7.0",
28
28
  "date-fns": "^4.1.0",
29
29
  "exit-hook": "^4.0.0",
30
- "fastmcp": "^1.20.4",
31
30
  "jsdom": "^26.0.0",
32
31
  "turndown": "^7.1.2",
33
- "tylerbarnes-fastmcp-fix": "^1.0.0",
34
32
  "uuid": "^11.1.0",
35
33
  "zod": "^3.22.4",
36
- "@mastra/core": "^0.8.1"
34
+ "zod-to-json-schema": "^3.22.4",
35
+ "@mastra/core": "^0.8.2"
37
36
  },
38
37
  "devDependencies": {
39
38
  "@hono/node-server": "^1.13.8",
@@ -48,8 +47,8 @@
48
47
  "tsx": "^4.19.3",
49
48
  "typescript": "^5.3.3",
50
49
  "vitest": "^3.0.9",
51
- "@mastra/mcp": "^0.3.8",
52
- "@internal/lint": "0.0.1"
50
+ "@internal/lint": "0.0.1",
51
+ "@mastra/mcp": "^0.3.9"
53
52
  },
54
53
  "scripts": {
55
54
  "prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",