@mastra/mcp-docs-server 1.2.15 → 1.2.16-alpha.3

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 (141) hide show
  1. package/.docs/docs/agents/agent-approval.md +5 -5
  2. package/.docs/docs/agents/overview.md +4 -4
  3. package/.docs/docs/browser/overview.md +1 -1
  4. package/.docs/docs/capabilities/channels.md +5 -5
  5. package/.docs/docs/capabilities/subagents.md +1 -1
  6. package/.docs/docs/connections/overview.md +1 -1
  7. package/.docs/docs/datasets/overview.md +1 -1
  8. package/.docs/docs/deployment/cloud-providers.md +4 -2
  9. package/.docs/docs/deployment/mastra-server.md +1 -1
  10. package/.docs/docs/deployment/monorepo.md +1 -1
  11. package/.docs/docs/deployment/overview.md +4 -1
  12. package/.docs/docs/deployment/sandbox.md +1 -1
  13. package/.docs/docs/deployment/web-framework.md +1 -1
  14. package/.docs/docs/deployment/workers.md +248 -2
  15. package/.docs/docs/evals/overview.md +1 -1
  16. package/.docs/docs/evals/quick-checks.md +1 -1
  17. package/.docs/docs/guides/multi-agent-systems.md +1 -1
  18. package/.docs/docs/harness/agent-controller.md +5 -5
  19. package/.docs/docs/harness/overview.md +1 -1
  20. package/.docs/docs/index.md +3 -3
  21. package/.docs/docs/long-running-agents/signal-providers.md +2 -2
  22. package/.docs/docs/mastra-platform/deploy.md +1 -1
  23. package/.docs/docs/mastra-platform/observability.md +63 -18
  24. package/.docs/docs/mastra-platform/overview.md +1 -1
  25. package/.docs/docs/mcp/overview.md +1 -1
  26. package/.docs/docs/memory/working-memory.md +1 -1
  27. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +2 -2
  28. package/.docs/docs/observability/logging.md +1 -1
  29. package/.docs/docs/observability/metrics/overview.md +1 -1
  30. package/.docs/docs/observability/overview.md +1 -5
  31. package/.docs/docs/observability/tracing/overview.md +3 -6
  32. package/.docs/docs/server/auth/workers.md +1 -1
  33. package/.docs/docs/server/auth.md +5 -5
  34. package/.docs/docs/server/mastra-client.md +1 -1
  35. package/.docs/docs/server/mastra-server.md +1 -1
  36. package/.docs/docs/storage/overview.md +7 -6
  37. package/.docs/docs/workflows/human-in-the-loop.md +2 -2
  38. package/.docs/docs/workflows/overview.md +2 -2
  39. package/.docs/docs/workspace/lsp.md +27 -0
  40. package/.docs/docs/workspace/sandbox.md +11 -12
  41. package/.docs/integrations/agentic-ui/ai-sdk-ui.md +1 -1
  42. package/.docs/integrations/agentic-ui/assistant-ui.md +1 -1
  43. package/.docs/integrations/agentic-ui/copilotkit.md +1 -1
  44. package/.docs/integrations/agentic-ui/openui.md +1 -1
  45. package/.docs/integrations/databases/postgresql.md +8 -8
  46. package/.docs/integrations/deploy/amazon-ec2.md +2 -2
  47. package/.docs/integrations/deploy/aws-bedrock-agentcore.md +1 -1
  48. package/.docs/integrations/deploy/aws-lambda.md +2 -2
  49. package/.docs/integrations/deploy/azure-app-services.md +2 -2
  50. package/.docs/integrations/deploy/cloudflare.md +2 -2
  51. package/.docs/integrations/deploy/digital-ocean.md +2 -2
  52. package/.docs/integrations/deploy/inngest.md +1 -1
  53. package/.docs/integrations/deploy/kubernetes.md +2 -3
  54. package/.docs/integrations/deploy/netlify.md +2 -2
  55. package/.docs/integrations/deploy/temporal.md +1 -1
  56. package/.docs/integrations/deploy/vercel.md +2 -2
  57. package/.docs/integrations/file-storage/agentfs.md +1 -1
  58. package/.docs/integrations/file-storage/amazon-s3.md +1 -1
  59. package/.docs/integrations/file-storage/archil.md +1 -1
  60. package/.docs/integrations/file-storage/azure-blob.md +1 -1
  61. package/.docs/integrations/file-storage/google-cloud-storage.md +1 -1
  62. package/.docs/integrations/file-storage/google-drive.md +1 -1
  63. package/.docs/integrations/file-storage/mesa.md +1 -1
  64. package/.docs/integrations/file-storage/vercel-files.md +1 -1
  65. package/.docs/integrations/frameworks/astro.md +1 -1
  66. package/.docs/integrations/frameworks/electron.md +1 -1
  67. package/.docs/integrations/frameworks/express.md +1 -1
  68. package/.docs/integrations/frameworks/hono.md +1 -1
  69. package/.docs/integrations/frameworks/nestjs.md +1 -1
  70. package/.docs/integrations/frameworks/next-js.md +1 -1
  71. package/.docs/integrations/frameworks/nuxt.md +1 -1
  72. package/.docs/integrations/frameworks/sveltekit.md +1 -1
  73. package/.docs/integrations/frameworks/vite-react.md +1 -1
  74. package/.docs/integrations/sandboxes/agentcore.md +1 -1
  75. package/.docs/integrations/sandboxes/apple-container.md +1 -1
  76. package/.docs/integrations/sandboxes/blaxel.md +1 -1
  77. package/.docs/integrations/sandboxes/daytona.md +1 -1
  78. package/.docs/integrations/sandboxes/docker.md +1 -1
  79. package/.docs/integrations/sandboxes/e2b.md +1 -1
  80. package/.docs/integrations/sandboxes/modal.md +1 -1
  81. package/.docs/integrations/sandboxes/railway.md +1 -1
  82. package/.docs/integrations/sandboxes/vercel.md +3 -1
  83. package/.docs/integrations/tools/firecrawl.md +2 -2
  84. package/.docs/integrations/voice/livekit.md +3 -3
  85. package/.docs/integrations.md +108 -108
  86. package/.docs/models/environment-variables.md +2 -0
  87. package/.docs/models/gateways/openrouter.md +5 -1
  88. package/.docs/models/gateways/vercel.md +3 -2
  89. package/.docs/models/index.md +1 -1
  90. package/.docs/models/providers/aiand.md +3 -2
  91. package/.docs/models/providers/digitalocean.md +3 -2
  92. package/.docs/models/providers/edenai.md +88 -0
  93. package/.docs/models/providers/hyper.md +3 -3
  94. package/.docs/models/providers/inceptron.md +8 -9
  95. package/.docs/models/providers/kilo.md +11 -6
  96. package/.docs/models/providers/llmgateway.md +3 -1
  97. package/.docs/models/providers/merge-gateway.md +262 -0
  98. package/.docs/models/providers/nano-gpt.md +13 -37
  99. package/.docs/models/providers/opencode.md +2 -2
  100. package/.docs/models/providers/tinfoil.md +9 -8
  101. package/.docs/models/providers/xai.md +2 -1
  102. package/.docs/models/providers.md +2 -0
  103. package/.docs/reference/agents/getVoice.md +1 -1
  104. package/.docs/reference/configuration.md +1 -1
  105. package/.docs/reference/index.md +5 -1
  106. package/.docs/reference/manual-install.md +1 -1
  107. package/.docs/reference/migrations/network-to-supervisor.md +1 -1
  108. package/.docs/reference/migrations/upgrade-to-v1/tracing.md +1 -3
  109. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +0 -1
  110. package/.docs/reference/observability/tracing/exporters/console-exporter.md +0 -1
  111. package/.docs/reference/observability/tracing/exporters/default-exporter.md +0 -1
  112. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +0 -1
  113. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +0 -1
  114. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +111 -99
  115. package/.docs/reference/observability/tracing/span-filtering.md +1 -1
  116. package/.docs/reference/storage/overview.md +1 -1
  117. package/.docs/reference/templates/overview.md +1 -1
  118. package/.docs/{guides → reference}/voice/overview.md +3 -3
  119. package/.docs/{guides → reference}/voice/speech-to-speech.md +1 -1
  120. package/.docs/{guides → reference}/voice/speech-to-text.md +1 -1
  121. package/.docs/{guides → reference}/voice/text-to-speech.md +2 -2
  122. package/CHANGELOG.md +14 -0
  123. package/package.json +4 -4
  124. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +0 -201
  125. package/.docs/docs/observability/integrations/overview.md +0 -47
  126. package/.docs/docs/observability/integrations/processors/sensitive-data-filter.md +0 -302
  127. package/.docs/guides/deployment/mastra-workers.md +0 -578
  128. package/.docs/guides/getting-started/quickstart.md +0 -88
  129. package/.docs/guides/guide/ai-recruiter.md +0 -228
  130. package/.docs/guides/guide/code-review-bot.md +0 -228
  131. package/.docs/guides/guide/coding-agent.md +0 -392
  132. package/.docs/guides/guide/dev-assistant.md +0 -309
  133. package/.docs/guides/guide/docs-manager.md +0 -240
  134. package/.docs/guides/guide/github-actions-pr-description.md +0 -238
  135. package/.docs/guides/guide/notes-mcp-server.md +0 -418
  136. package/.docs/guides/guide/research-assistant.md +0 -350
  137. package/.docs/guides/guide/research-coordinator.md +0 -418
  138. package/.docs/guides/guide/signal-provider.md +0 -221
  139. package/.docs/guides/index.md +0 -24
  140. /package/.docs/{reference → docs}/mastra-platform/api.md +0 -0
  141. /package/.docs/{guides/agent-frameworks/ai-sdk.md → reference/ai-sdk/overview.md} +0 -0
@@ -1,350 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # Building a research paper assistant with RAG
4
-
5
- In this guide, you'll create an AI research assistant that can analyze academic papers and answer specific questions about their content using Retrieval Augmented Generation (RAG).
6
-
7
- You'll use the original Transformer paper ["Attention Is All You Need"](https://arxiv.org/html/1706.03762) as your example. As a database you'll use a local libSQL database.
8
-
9
- ## Prerequisites
10
-
11
- - Node.js `v22.13.0` or later installed
12
- - An API key from a supported [Model Provider](https://mastra.ai/models)
13
- - An existing Mastra project (Follow the [installation guide](https://mastra.ai/guides/getting-started/quickstart) to set up a new project)
14
-
15
- ## How RAG works
16
-
17
- Let's understand how RAG works and how you'll implement each component.
18
-
19
- ### Knowledge Store/Index
20
-
21
- - Converting text into vector representations
22
- - Creating numerical representations of content
23
- - **Implementation**: You'll use OpenAI's `text-embedding-3-small` to create embeddings and store them in LibSQLVector
24
-
25
- ### Retriever
26
-
27
- - Finding relevant content via similarity search
28
- - Matching query embeddings with stored vectors
29
- - **Implementation**: You'll use LibSQLVector to perform similarity searches on the stored embeddings
30
-
31
- ### Generator
32
-
33
- - Processing retrieved content with an LLM
34
- - Creating contextually informed responses
35
- - **Implementation**: You'll use an OpenAI model to generate answers based on retrieved content
36
-
37
- Your implementation will:
38
-
39
- 1. Process the Transformer paper into embeddings
40
- 2. Store them in LibSQLVector for quick retrieval
41
- 3. Use similarity search to find relevant sections
42
- 4. Generate accurate responses using retrieved context
43
-
44
- ## Creating the agent
45
-
46
- Let's define the agent's behavior, connect it to your Mastra project, and create the vector store.
47
-
48
- 1. Install additional dependencies
49
-
50
- After running the [installation guide](https://mastra.ai/guides/getting-started/quickstart) you'll need to install additional dependencies:
51
-
52
- **npm**:
53
-
54
- ```bash
55
- npm install @mastra/rag@latest ai
56
- ```
57
-
58
- **pnpm**:
59
-
60
- ```bash
61
- pnpm add @mastra/rag@latest ai
62
- ```
63
-
64
- **Yarn**:
65
-
66
- ```bash
67
- yarn add @mastra/rag@latest ai
68
- ```
69
-
70
- **Bun**:
71
-
72
- ```bash
73
- bun add @mastra/rag@latest ai
74
- ```
75
-
76
- 2. Now you'll create your RAG-enabled research assistant. The agent uses:
77
-
78
- - A [Vector Query Tool](https://mastra.ai/reference/tools/vector-query-tool) for performing semantic search over the vector store to find relevant content in papers
79
- - An OpenAI model for understanding queries and generating responses
80
- - Custom instructions that guide the agent on how to analyze papers, use retrieved content effectively, and acknowledge limitations
81
-
82
- Create a new file `src/mastra/agents/researchAgent.ts` and define your agent:
83
-
84
- ```ts
85
- import { Agent } from '@mastra/core/agent'
86
- import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
87
- import { createVectorQueryTool } from '@mastra/rag'
88
-
89
- // Create a tool for semantic search over the paper embeddings
90
- const vectorQueryTool = createVectorQueryTool({
91
- vectorStoreName: 'libSqlVector',
92
- indexName: 'papers',
93
- model: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
94
- })
95
-
96
- export const researchAgent = new Agent({
97
- id: 'research-agent',
98
- name: 'Research Assistant',
99
- instructions: `You are a helpful research assistant that analyzes academic papers and technical documents.
100
- Use the provided vector query tool to find relevant information from your knowledge base,
101
- and provide accurate, well-supported answers based on the retrieved content.
102
- Focus on the specific content available in the tool and acknowledge if you cannot find sufficient information to answer a question.
103
- Base your responses only on the content provided, not on general knowledge.`,
104
- model: 'openai/gpt-5.6-sol',
105
- tools: {
106
- vectorQueryTool,
107
- },
108
- })
109
- ```
110
-
111
- 3. In the root of your project, grab the absolute path with the `pwd` command. The path might be similar to this:
112
-
113
- ```bash
114
- > pwd
115
- /Users/your-name/guides/research-assistant
116
- ```
117
-
118
- In your `src/mastra/index.ts` file, add the following to your existing file and configuration:
119
-
120
- ```ts
121
- import { Mastra } from '@mastra/core'
122
- import { LibSQLVector } from '@mastra/libsql'
123
-
124
- const libSqlVector = new LibSQLVector({
125
- id: 'research-vectors',
126
- url: 'file:/Users/your-name/guides/research-assistant/vector.db',
127
- })
128
-
129
- export const mastra = new Mastra({
130
- vectors: { libSqlVector },
131
- })
132
- ```
133
-
134
- For the `url` use the absolute path you got from the `pwd` command. This way the `vector.db` file is created at the root of your project.
135
-
136
- > **Note:** For the purpose of this guide you are using a hardcoded absolute path to your local libSQL file, however for production usage this won't work. You should use a remote persistent database then.
137
-
138
- 4. In the `src/mastra/index.ts` file, add the agent to Mastra:
139
-
140
- ```ts
141
- import { Mastra } from '@mastra/core'
142
- import { LibSQLVector } from '@mastra/libsql'
143
- import { researchAgent } from './agents/researchAgent'
144
-
145
- const libSqlVector = new LibSQLVector({
146
- id: 'research-vectors',
147
- url: 'file:/Users/your-name/guides/research-assistant/vector.db',
148
- })
149
-
150
- export const mastra = new Mastra({
151
- agents: { researchAgent },
152
- vectors: { libSqlVector },
153
- })
154
- ```
155
-
156
- ## Processing documents
157
-
158
- In the following steps, you'll fetch the research paper and split it into smaller chunks. You'll then generate embeddings and store the chunks in the vector database.
159
-
160
- 1. In this step the research paper is retrieved by providing an URL, then converted to a document object, and split into smaller, manageable chunks. By splitting into chunks the processing is faster and more efficient.
161
-
162
- Create a new file `src/store.ts` and add the following:
163
-
164
- ```ts
165
- import { MDocument } from '@mastra/rag'
166
-
167
- // Load the paper
168
- const paperUrl = 'https://arxiv.org/html/1706.03762'
169
- const response = await fetch(paperUrl)
170
- const paperText = await response.text()
171
-
172
- // Create document and chunk it
173
- const doc = MDocument.fromText(paperText)
174
- const chunks = await doc.chunk({
175
- strategy: 'recursive',
176
- maxSize: 512,
177
- overlap: 50,
178
- separators: ['\n\n', '\n', ' '],
179
- })
180
-
181
- console.log('Number of chunks:', chunks.length)
182
- ```
183
-
184
- Run the file in your terminal:
185
-
186
- ```bash
187
- npx bun src/store.ts
188
- ```
189
-
190
- You should get back this response:
191
-
192
- ```bash
193
- Number of chunks: 892
194
- ```
195
-
196
- 2. Finally, you'll prepare the content for RAG by:
197
-
198
- 1. Generating embeddings for each chunk of text
199
- 2. Creating a vector store index to hold the embeddings
200
- 3. Storing both the embeddings and metadata (original text and source information) in the vector database
201
-
202
- > **Note:** This metadata is crucial as it allows for returning the actual content when the vector store finds relevant matches.
203
-
204
- The agent uses the vector index to search for and retrieve relevant information.
205
-
206
- Open the `src/store.ts` file and add the following:
207
-
208
- ```ts
209
- import { MDocument } from '@mastra/rag'
210
- import { embedMany } from 'ai'
211
- import { mastra } from './mastra'
212
-
213
- // Load the paper
214
- const paperUrl = 'https://arxiv.org/html/1706.03762'
215
- const response = await fetch(paperUrl)
216
- const paperText = await response.text()
217
-
218
- // Create document and chunk it
219
- const doc = MDocument.fromText(paperText)
220
- const chunks = await doc.chunk({
221
- strategy: 'recursive',
222
- maxSize: 512,
223
- overlap: 50,
224
- separators: ['\n\n', '\n', ' '],
225
- })
226
-
227
- // Generate embeddings
228
- const { embeddings } = await embedMany({
229
- model: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
230
- values: chunks.map(chunk => chunk.text),
231
- })
232
-
233
- // Get the vector store instance from Mastra
234
- const vectorStore = mastra.getVector('libSqlVector')
235
-
236
- // Create an index for paper chunks
237
- await vectorStore.createIndex({
238
- indexName: 'papers',
239
- dimension: 1536,
240
- })
241
-
242
- // Store embeddings
243
- await vectorStore.upsert({
244
- indexName: 'papers',
245
- vectors: embeddings,
246
- metadata: chunks.map(chunk => ({
247
- text: chunk.text,
248
- source: 'transformer-paper',
249
- })),
250
- })
251
- ```
252
-
253
- Lastly, you'll now need to store the embeddings by running the script again:
254
-
255
- ```bash
256
- npx bun src/store.ts
257
- ```
258
-
259
- If the operation was successful you should see no output/errors in your terminal.
260
-
261
- ## Test the assistant
262
-
263
- Now that the vector database has all embeddings, you can test the research assistant with different types of queries.
264
-
265
- Create a new file `src/ask-agent.ts` and add different types of queries:
266
-
267
- ```ts
268
- import { mastra } from './mastra'
269
- const agent = mastra.getAgent('researchAgent')
270
-
271
- // Basic query about concepts
272
- const query1 = 'What problems does sequence modeling face with neural networks?'
273
- const response1 = await agent.generate(query1)
274
- console.log('\nQuery:', query1)
275
- console.log('Response:', response1.text)
276
- ```
277
-
278
- Run the script:
279
-
280
- ```bash
281
- npx bun src/ask-agent.ts
282
- ```
283
-
284
- You should see output like:
285
-
286
- ```bash
287
- Query: What problems does sequence modeling face with neural networks?
288
- Response: Sequence modeling with neural networks faces several key challenges:
289
- 1. Vanishing and exploding gradients during training, especially with long sequences
290
- 2. Difficulty handling long-term dependencies in the input
291
- 3. Limited computational efficiency due to sequential processing
292
- 4. Challenges in parallelizing computations, resulting in longer training times
293
- ```
294
-
295
- Try another question:
296
-
297
- ```ts
298
- import { mastra } from './mastra'
299
- const agent = mastra.getAgent('researchAgent')
300
-
301
- // Query about specific findings
302
- const query2 = 'What improvements were achieved in translation quality?'
303
- const response2 = await agent.generate(query2)
304
- console.log('\nQuery:', query2)
305
- console.log('Response:', response2.text)
306
- ```
307
-
308
- Output:
309
-
310
- ```text
311
- Query: What improvements were achieved in translation quality?
312
- Response: The model showed significant improvements in translation quality, achieving more than 2.0
313
- BLEU points improvement over previously reported models on the WMT 2014 English-to-German translation
314
- task, while also reducing training costs.
315
- ```
316
-
317
- ### Serve the Application
318
-
319
- Start the Mastra server to expose your research assistant via API:
320
-
321
- ```bash
322
- mastra dev
323
- ```
324
-
325
- Your research assistant will be available at:
326
-
327
- ```text
328
- http://localhost:4111/api/agents/researchAgent/generate
329
- ```
330
-
331
- Test with curl:
332
-
333
- ```bash
334
- curl -X POST http://localhost:4111/api/agents/researchAgent/generate \
335
- -H "Content-Type: application/json" \
336
- -d '{
337
- "messages": [
338
- { "role": "user", "content": "What were the main findings about model parallelization?" }
339
- ]
340
- }'
341
- ```
342
-
343
- ## Advanced RAG examples
344
-
345
- Explore these examples for more advanced RAG techniques:
346
-
347
- - [Filter RAG](https://github.com/mastra-ai/mastra/tree/main/examples/basics/rag/filter-rag) for filtering results using metadata
348
- - [Cleanup RAG](https://github.com/mastra-ai/mastra/tree/main/examples/basics/rag/cleanup-rag) for optimizing information density
349
- - [Chain of Thought RAG](https://github.com/mastra-ai/mastra/tree/main/examples/basics/rag/cot-rag) for complex reasoning queries using workflows
350
- - [Rerank RAG](https://github.com/mastra-ai/mastra/tree/main/examples/basics/rag/rerank-rag) for improved result relevance