@mastra/mcp-docs-server 0.13.34 → 0.13.35

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 (42) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +2 -0
  2. package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +2 -0
  3. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +9 -9
  4. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +23 -23
  6. package/.docs/organized/changelogs/%40mastra%2Fcore.md +61 -61
  7. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +17 -17
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +17 -17
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +17 -17
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +17 -17
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +37 -37
  12. package/.docs/organized/changelogs/%40mastra%2Flance.md +19 -19
  13. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +15 -15
  14. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +19 -19
  15. package/.docs/organized/changelogs/%40mastra%2Fpg.md +19 -19
  16. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +31 -31
  17. package/.docs/organized/changelogs/%40mastra%2Freact.md +19 -19
  18. package/.docs/organized/changelogs/%40mastra%2Fserver.md +27 -27
  19. package/.docs/organized/changelogs/create-mastra.md +5 -5
  20. package/.docs/organized/changelogs/mastra.md +17 -17
  21. package/.docs/organized/code-examples/memory-with-mongodb.md +208 -0
  22. package/.docs/raw/getting-started/project-structure.mdx +1 -1
  23. package/.docs/raw/getting-started/studio.mdx +4 -4
  24. package/.docs/raw/memory/overview.mdx +1 -1
  25. package/.docs/raw/memory/semantic-recall.mdx +4 -3
  26. package/.docs/raw/memory/storage/memory-with-libsql.mdx +141 -0
  27. package/.docs/raw/memory/storage/memory-with-pg.mdx +138 -0
  28. package/.docs/raw/memory/storage/memory-with-upstash.mdx +147 -0
  29. package/.docs/raw/observability/ai-tracing/exporters/arize.mdx +201 -0
  30. package/.docs/raw/observability/ai-tracing/overview.mdx +12 -8
  31. package/.docs/raw/reference/observability/ai-tracing/exporters/arize.mdx +160 -0
  32. package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +2 -2
  33. package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +1 -1
  34. package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +2 -2
  35. package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +1 -1
  36. package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +48 -21
  37. package/.docs/raw/reference/storage/mongodb.mdx +146 -0
  38. package/.docs/raw/server-db/storage.mdx +1 -0
  39. package/.docs/raw/workflows/agents-and-tools.mdx +15 -1
  40. package/.docs/raw/workflows/human-in-the-loop.mdx +268 -0
  41. package/CHANGELOG.md +14 -0
  42. package/package.json +11 -4
@@ -0,0 +1,160 @@
1
+ ---
2
+ title: "ArizeExporter | Exporters | AI Tracing | Reference"
3
+ description: Arize exporter for AI tracing using OpenInference
4
+ ---
5
+
6
+ import { PropertiesTable } from "@/components/properties-table";
7
+
8
+ # ArizeExporter
9
+
10
+ Sends AI tracing data to Arize Phoenix, Arize AX, or any OpenTelemetry-compatible observability platform that supports OpenInference semantic conventions.
11
+
12
+ ## Constructor
13
+
14
+ ```typescript
15
+ new ArizeExporter(config: ArizeExporterConfig)
16
+ ```
17
+
18
+ ## ArizeExporterConfig
19
+
20
+ ```typescript
21
+ interface ArizeExporterConfig {
22
+ // Phoenix / OpenTelemetry configuration
23
+ endpoint?: string;
24
+ apiKey?: string;
25
+
26
+ // Arize AX configuration
27
+ spaceId?: string;
28
+
29
+ // Common configuration
30
+ projectName?: string;
31
+ headers?: Record<string, string>;
32
+
33
+ // Inherited from OtelExporterConfig
34
+ timeout?: number;
35
+ batchSize?: number;
36
+ logLevel?: 'debug' | 'info' | 'warn' | 'error';
37
+ resourceAttributes?: Record<string, any>;
38
+ }
39
+ ```
40
+
41
+ <PropertiesTable
42
+ props={[
43
+ {
44
+ name: "endpoint",
45
+ type: "string",
46
+ description: "Collector endpoint for trace exports (e.g., 'http://localhost:6006/v1/traces' for Phoenix). Required for Phoenix. Optional for Arize AX (defaults to https://otlp.arize.com/v1/traces).",
47
+ required: false,
48
+ },
49
+ {
50
+ name: "apiKey",
51
+ type: "string",
52
+ description: "API key for authentication. Required for Phoenix Cloud and Arize AX. Optional for self-hosted Phoenix.",
53
+ required: false,
54
+ },
55
+ {
56
+ name: "spaceId",
57
+ type: "string",
58
+ description: "Arize AX space identifier. Required when sending traces to Arize AX.",
59
+ required: false,
60
+ },
61
+ {
62
+ name: "projectName",
63
+ type: "string",
64
+ description: "Project name added as OpenInference resource attribute",
65
+ required: false,
66
+ },
67
+ {
68
+ name: "headers",
69
+ type: "Record<string, string>",
70
+ description: "Additional headers for OTLP requests",
71
+ required: false,
72
+ },
73
+ {
74
+ name: "timeout",
75
+ type: "number",
76
+ description: "Timeout in milliseconds before exporting spans (default: 30000)",
77
+ required: false,
78
+ },
79
+ {
80
+ name: "batchSize",
81
+ type: "number",
82
+ description: "Number of spans to batch before export (default: 512)",
83
+ required: false,
84
+ },
85
+ {
86
+ name: "logLevel",
87
+ type: "'debug' | 'info' | 'warn' | 'error'",
88
+ description: "Logger level (default: 'warn')",
89
+ required: false,
90
+ },
91
+ {
92
+ name: "resourceAttributes",
93
+ type: "Record<string, any>",
94
+ description: "Custom resource attributes added to each span",
95
+ required: false,
96
+ },
97
+ ]}
98
+ />
99
+
100
+ ## Methods
101
+
102
+ ### exportEvent
103
+
104
+ ```typescript
105
+ async exportEvent(event: AITracingEvent): Promise<void>
106
+ ```
107
+
108
+ Exports a tracing event to the configured endpoint.
109
+
110
+ ### export
111
+
112
+ ```typescript
113
+ async export(spans: ReadOnlyAISpan[]): Promise<void>
114
+ ```
115
+
116
+ Batch exports spans using OpenTelemetry with OpenInference semantic conventions.
117
+
118
+ ### shutdown
119
+
120
+ ```typescript
121
+ async shutdown(): Promise<void>
122
+ ```
123
+
124
+ Flushes pending data and shuts down the client.
125
+
126
+ ## Usage
127
+
128
+ ### Phoenix Configuration
129
+
130
+ ```typescript
131
+ import { ArizeExporter } from '@mastra/arize';
132
+
133
+ const exporter = new ArizeExporter({
134
+ endpoint: 'http://localhost:6006/v1/traces',
135
+ apiKey: process.env.PHOENIX_API_KEY, // Optional for local Phoenix
136
+ projectName: 'my-ai-project',
137
+ });
138
+ ```
139
+
140
+ ### Arize AX Configuration
141
+
142
+ ```typescript
143
+ import { ArizeExporter } from '@mastra/arize';
144
+
145
+ const exporter = new ArizeExporter({
146
+ spaceId: process.env.ARIZE_SPACE_ID!,
147
+ apiKey: process.env.ARIZE_API_KEY!,
148
+ projectName: 'my-ai-project',
149
+ });
150
+ ```
151
+
152
+ ## OpenInference Semantic Conventions
153
+
154
+ The ArizeExporter implements [OpenInference Semantic Conventions](https://github.com/Arize-ai/openinference/tree/main/spec) for generative AI applications, providing standardized trace structure across different observability platforms.
155
+
156
+ ## Related
157
+
158
+ - [ArizeExporter Documentation](/docs/observability/ai-tracing/exporters/arize)
159
+ - [Phoenix Documentation](https://docs.arize.com/phoenix)
160
+ - [Arize AX Documentation](https://docs.arize.com/)
@@ -103,8 +103,8 @@ const exporter = new BraintrustExporter({
103
103
 
104
104
  | AI Span Type | Braintrust Type |
105
105
  |--------------|-----------------|
106
- | `LLM_GENERATION` | `llm` |
107
- | `LLM_CHUNK` | `llm` |
106
+ | `MODEL_GENERATION` | `llm` |
107
+ | `MODEL_CHUNK` | `llm` |
108
108
  | `TOOL_CALL` | `tool` |
109
109
  | `MCP_TOOL_CALL` | `tool` |
110
110
  | `WORKFLOW_CONDITIONAL_EVAL` | `function` |
@@ -111,6 +111,6 @@ const exporter = new LangfuseExporter({
111
111
  ## Span Mapping
112
112
 
113
113
  - Root spans → Langfuse traces
114
- - `LLM_GENERATION` spans → Langfuse generations
114
+ - `MODEL_GENERATION` spans → Langfuse generations
115
115
  - All other spans → Langfuse spans
116
116
  - Event spans → Langfuse events
@@ -105,8 +105,8 @@ const exporter = new LangSmithExporter({
105
105
 
106
106
  | AI Span Type | LangSmith Type |
107
107
  |--------------|----------------|
108
- | `LLM_GENERATION` | `llm` |
109
- | `LLM_CHUNK` | `llm` |
108
+ | `MODEL_GENERATION` | `llm` |
109
+ | `MODEL_CHUNK` | `llm` |
110
110
  | `TOOL_CALL` | `tool` |
111
111
  | `MCP_TOOL_CALL` | `tool` |
112
112
  | All others | `chain` |
@@ -317,7 +317,7 @@ const exporter = new OtelExporter({
317
317
  The exporter maps Mastra AI spans to OpenTelemetry spans following GenAI semantic conventions:
318
318
 
319
319
  ### Span Names
320
- - `LLM_GENERATION` → `chat {model}` or `tool_selection {model}`
320
+ - `MODEL_GENERATION` → `chat {model}` or `tool_selection {model}`
321
321
  - `TOOL_CALL` → `tool.execute {tool_name}`
322
322
  - `AGENT_RUN` → `agent.{agent_id}`
323
323
  - `WORKFLOW_RUN` → `workflow.{workflow_id}`
@@ -43,8 +43,9 @@ Mapping of span types to their corresponding attribute interfaces.
43
43
  interface AISpanTypeMap {
44
44
  AGENT_RUN: AgentRunAttributes;
45
45
  WORKFLOW_RUN: WorkflowRunAttributes;
46
- LLM_GENERATION: LLMGenerationAttributes;
47
- LLM_CHUNK: LLMChunkAttributes;
46
+ MODEL_GENERATION: ModelGenerationAttributes;
47
+ MODEL_STEP: ModelStepAttributes;
48
+ MODEL_CHUNK: ModelChunkAttributes;
48
49
  TOOL_CALL: ToolCallAttributes;
49
50
  MCP_TOOL_CALL: MCPToolCallAttributes;
50
51
  WORKFLOW_STEP: WorkflowStepAttributes;
@@ -160,16 +161,19 @@ AI-specific span types with their associated metadata.
160
161
  enum AISpanType {
161
162
  /** Agent run - root span for agent processes */
162
163
  AGENT_RUN = 'agent_run',
163
-
164
+
164
165
  /** Generic span for custom operations */
165
166
  GENERIC = 'generic',
166
-
167
- /** LLM generation with model calls, token usage, prompts, completions */
168
- LLM_GENERATION = 'llm_generation',
169
-
170
- /** Individual LLM streaming chunk/event */
171
- LLM_CHUNK = 'llm_chunk',
172
-
167
+
168
+ /** Model generation with model calls, token usage, prompts, completions */
169
+ MODEL_GENERATION = 'model_generation',
170
+
171
+ /** Single model execution step within a generation (one API call) */
172
+ MODEL_STEP = 'model_step',
173
+
174
+ /** Individual model streaming chunk/event */
175
+ MODEL_CHUNK = 'model_chunk',
176
+
173
177
  /** MCP (Model Context Protocol) tool execution */
174
178
  MCP_TOOL_CALL = 'mcp_tool_call',
175
179
 
@@ -235,19 +239,19 @@ interface AgentRunAttributes {
235
239
  }
236
240
  ```
237
241
 
238
- ### LLMGenerationAttributes
242
+ ### ModelGenerationAttributes
239
243
 
240
- LLM Generation attributes.
244
+ Model Generation attributes.
241
245
 
242
246
  ```typescript
243
- interface LLMGenerationAttributes {
247
+ interface ModelGenerationAttributes {
244
248
  /** Model name (e.g., 'gpt-4', 'claude-3') */
245
249
  model?: string;
246
250
 
247
251
  /** Model provider (e.g., 'openai', 'anthropic') */
248
252
  provider?: string;
249
253
 
250
- /** Type of result/output this LLM call produced */
254
+ /** Type of result/output this model call produced */
251
255
  resultType?: 'tool_selection' | 'response_generation' | 'reasoning' | 'planning';
252
256
 
253
257
  /** Token usage statistics */
@@ -280,12 +284,35 @@ interface LLMGenerationAttributes {
280
284
  }
281
285
  ```
282
286
 
283
- ### LLMChunkAttributes
287
+ ### ModelStepAttributes
284
288
 
285
- LLM Chunk attributes - for individual streaming chunks/events.
289
+ Model Step attributes - for a single model execution within a generation.
286
290
 
287
291
  ```typescript
288
- interface LLMChunkAttributes {
292
+ interface ModelStepAttributes {
293
+ /** Index of this step in the generation (0, 1, 2, ...) */
294
+ stepIndex?: number;
295
+
296
+ /** Token usage statistics */
297
+ usage?: UsageStats;
298
+
299
+ /** Reason this step finished (stop, tool-calls, length, etc.) */
300
+ finishReason?: string;
301
+
302
+ /** Should execution continue */
303
+ isContinued?: boolean;
304
+
305
+ /** Result warnings */
306
+ warnings?: Record<string, any>;
307
+ }
308
+ ```
309
+
310
+ ### ModelChunkAttributes
311
+
312
+ Model Chunk attributes - for individual streaming chunks/events.
313
+
314
+ ```typescript
315
+ interface ModelChunkAttributes {
289
316
  /** Type of chunk (text-delta, reasoning-delta, tool-call, etc.) */
290
317
  chunkType?: string;
291
318
 
@@ -626,10 +653,10 @@ enum InternalSpans {
626
653
 
627
654
  /** Tool spans are marked internal */
628
655
  TOOL = 1 << 2,
629
-
630
- /** LLM spans are marked internal */
631
- LLM = 1 << 3,
632
-
656
+
657
+ /** Model spans are marked internal */
658
+ MODEL = 1 << 3,
659
+
633
660
  /** All spans are marked internal */
634
661
  ALL = (1 << 4) - 1,
635
662
  }
@@ -0,0 +1,146 @@
1
+ ---
2
+ title: "MongoDB Storage | Storage System | Mastra Core"
3
+ description: Documentation for the MongoDB storage implementation in Mastra.
4
+ ---
5
+
6
+ # MongoDB Storage
7
+
8
+ The MongoDB storage implementation provides a scalable storage solution using MongoDB databases with support for both document storage and vector operations.
9
+
10
+ ## Installation
11
+
12
+ ```bash copy
13
+ npm install @mastra/mongodb@latest
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ Ensure you have a MongoDB Atlas Local (via Docker) or MongoDB Atlas Cloud instance with Atlas Search enabled. MongoDB 7.0+ is recommended.
19
+
20
+ ```typescript copy showLineNumbers
21
+ import { MongoDBStore } from "@mastra/mongodb";
22
+
23
+ const storage = new MongoDBStore({
24
+ url: process.env.MONGODB_URL,
25
+ dbName: process.env.MONGODB_DATABASE,
26
+ });
27
+ ```
28
+
29
+ ## Parameters
30
+
31
+ <PropertiesTable
32
+ content={[
33
+ {
34
+ name: "url",
35
+ type: "string",
36
+ description:
37
+ "MongoDB connection string (e.g., mongodb+srv://user:password@cluster.mongodb.net)",
38
+ isOptional: false,
39
+ },
40
+ {
41
+ name: "dbName",
42
+ type: "string",
43
+ description:
44
+ "The name of the database you want the storage to use.",
45
+ isOptional: false,
46
+ },
47
+ {
48
+ name: "options",
49
+ type: "MongoClientOptions",
50
+ description:
51
+ "MongoDB client options for advanced configuration (SSL, connection pooling, etc.). See advanced configuration [here](https://www.mongodb.com/docs/drivers/node/current/connect/connection-options/).",
52
+ isOptional: true,
53
+ }
54
+ ]}
55
+ />
56
+
57
+ ## Constructor Examples
58
+
59
+ You can instantiate `MongoDBStore` in the following ways:
60
+
61
+ ```ts
62
+ import { MongoDBStore } from "@mastra/mongodb";
63
+
64
+ // Basic connection without custom options
65
+ const store1 = new MongoDBStore({
66
+ url: "mongodb+srv://user:password@cluster.mongodb.net",
67
+ dbName: "mastra_storage",
68
+ });
69
+
70
+ // Using connection string with options
71
+ const store2 = new MongoDBStore({
72
+ url: "mongodb+srv://user:password@cluster.mongodb.net",
73
+ dbName: "mastra_storage",
74
+ options: {
75
+ retryWrites: true,
76
+ maxPoolSize: 10,
77
+ serverSelectionTimeoutMS: 5000,
78
+ socketTimeoutMS: 45000,
79
+ },
80
+ });
81
+ ```
82
+
83
+ ## Additional Notes
84
+
85
+ ### Collection Management
86
+
87
+ The storage implementation handles collection creation and management automatically. It creates the following collections:
88
+
89
+ - `mastra_workflow_snapshot`: Stores workflow state and execution data
90
+ - `mastra_evals`: Stores evaluation results and metadata
91
+ - `mastra_threads`: Stores conversation threads
92
+ - `mastra_messages`: Stores individual messages
93
+ - `mastra_traces`: Stores telemetry and tracing data
94
+ - `mastra_scorers`: Stores scoring and evaluation data
95
+ - `mastra_resources`: Stores resource working memory data
96
+
97
+ ## Vector Search Capabilities
98
+
99
+ MongoDB storage includes built-in vector search capabilities for AI applications:
100
+
101
+ ### Vector Index Creation
102
+
103
+ ```typescript copy
104
+ import { MongoDBVector } from "@mastra/mongodb";
105
+
106
+ const vectorStore = new MongoDBVector({
107
+ url: process.env.MONGODB_URL,
108
+ dbName: process.env.MONGODB_DATABASE,
109
+ });
110
+
111
+ // Create a vector index for embeddings
112
+ await vectorStore.createIndex({
113
+ indexName: "document_embeddings",
114
+ dimension: 1536,
115
+ });
116
+ ```
117
+
118
+ ### Vector Operations
119
+
120
+ ```typescript copy
121
+ // Store vectors with metadata
122
+ await vectorStore.upsert({
123
+ indexName: "document_embeddings",
124
+ vectors: [
125
+ {
126
+ id: "doc-1",
127
+ values: [0.1, 0.2, 0.3, ...], // 1536-dimensional vector
128
+ metadata: {
129
+ title: "Document Title",
130
+ category: "technical",
131
+ source: "api-docs",
132
+ },
133
+ },
134
+ ],
135
+ });
136
+
137
+ // Similarity search
138
+ const results = await vectorStore.query({
139
+ indexName: "document_embeddings",
140
+ vector: queryEmbedding,
141
+ topK: 5,
142
+ filter: {
143
+ category: "technical",
144
+ },
145
+ });
146
+ ```
@@ -512,3 +512,4 @@ Mastra supports the following providers:
512
512
  - For local development, check out [LibSQL Storage](../../reference/storage/libsql.mdx)
513
513
  - For production, check out [PostgreSQL Storage](../../reference/storage/postgresql.mdx)
514
514
  - For serverless deployments, check out [Upstash Storage](../../reference/storage/upstash.mdx)
515
+ - For document-based storage, check out [MongoDB Storage](../../reference/storage/mongodb.mdx)
@@ -63,7 +63,21 @@ export const testWorkflow = createWorkflow({
63
63
  .commit();
64
64
  ```
65
65
 
66
- > See [Input Data Mapping](./input-data-mapping.mdx) for more information.
66
+ > See [Input Data Mapping](./input-data-mapping.mdx) for more information.
67
+
68
+ Mastra agents use a default schema that expects a `prompt` string as input and returns a `text` string as output:
69
+
70
+ ```json
71
+ {
72
+ inputSchema: {
73
+ prompt: string
74
+ },
75
+ outputSchema: {
76
+ text: string
77
+ }
78
+ }
79
+ ```
80
+
67
81
 
68
82
  ## Using tools in workflows
69
83