@mastra/mcp-docs-server 1.0.0-beta.11 → 1.0.0-beta.14
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.
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +51 -51
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +180 -180
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +68 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +331 -331
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +96 -96
- package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Freact.md +49 -2
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +122 -122
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +39 -39
- package/.docs/organized/changelogs/create-mastra.md +31 -31
- package/.docs/organized/changelogs/mastra.md +51 -51
- package/.docs/organized/code-examples/agent-v6.md +151 -0
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/quick-start.md +0 -4
- package/.docs/organized/code-examples/stock-price-tool.md +21 -2
- package/.docs/raw/agents/adding-voice.mdx +2 -3
- package/.docs/raw/agents/agent-approval.mdx +139 -6
- package/.docs/raw/agents/agent-memory.mdx +24 -32
- package/.docs/raw/agents/guardrails.mdx +61 -51
- package/.docs/raw/agents/networks.mdx +9 -13
- package/.docs/raw/agents/overview.mdx +40 -24
- package/.docs/raw/agents/processors.mdx +20 -19
- package/.docs/raw/agents/structured-output.mdx +11 -7
- package/.docs/raw/agents/using-tools.mdx +5 -6
- package/.docs/raw/course/01-first-agent/07-creating-your-agent.md +1 -2
- package/.docs/raw/course/01-first-agent/12-connecting-tool-to-agent.md +1 -1
- package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +1 -2
- package/.docs/raw/course/02-agent-tools-mcp/05-updating-your-agent.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +1 -1
- package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -2
- package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -2
- package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +1 -2
- package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +3 -4
- package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +2 -3
- package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +2 -3
- package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +1 -2
- package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +2 -3
- package/.docs/raw/course/04-workflows/11-creating-an-ai-agent.md +2 -3
- package/.docs/raw/deployment/cloud-providers.mdx +20 -0
- package/.docs/raw/deployment/{building-mastra.mdx → mastra-server.mdx} +5 -5
- package/.docs/raw/deployment/monorepo.mdx +23 -44
- package/.docs/raw/deployment/overview.mdx +32 -50
- package/.docs/raw/deployment/web-framework.mdx +15 -19
- package/.docs/raw/evals/custom-scorers.mdx +9 -6
- package/.docs/raw/evals/overview.mdx +3 -6
- package/.docs/raw/evals/running-in-ci.mdx +2 -2
- package/.docs/raw/getting-started/manual-install.mdx +20 -20
- package/.docs/raw/getting-started/mcp-docs-server.mdx +2 -2
- package/.docs/raw/getting-started/start.mdx +10 -1
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +4 -4
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +1033 -79
- package/.docs/raw/guides/build-your-ui/assistant-ui.mdx +8 -8
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +11 -11
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/amazon-ec2.mdx +9 -9
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/aws-lambda.mdx +13 -16
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/azure-app-services.mdx +5 -7
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/cloudflare-deployer.mdx +8 -5
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/digital-ocean.mdx +12 -15
- package/.docs/raw/guides/deployment/index.mdx +32 -0
- package/.docs/raw/guides/deployment/inngest.mdx +386 -0
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/netlify-deployer.mdx +7 -3
- package/.docs/raw/{deployment/cloud-providers → guides/deployment}/vercel-deployer.mdx +8 -5
- package/.docs/raw/guides/getting-started/astro.mdx +292 -451
- package/.docs/raw/guides/getting-started/express.mdx +72 -153
- package/.docs/raw/guides/getting-started/hono.mdx +227 -0
- package/.docs/raw/guides/getting-started/next-js.mdx +170 -61
- package/.docs/raw/guides/getting-started/quickstart.mdx +4 -4
- package/.docs/raw/guides/getting-started/sveltekit.mdx +238 -409
- package/.docs/raw/guides/getting-started/vite-react.mdx +317 -147
- package/.docs/raw/guides/guide/ai-recruiter.mdx +10 -10
- package/.docs/raw/guides/guide/chef-michel.mdx +9 -11
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +15 -15
- package/.docs/raw/guides/guide/research-assistant.mdx +17 -17
- package/.docs/raw/guides/guide/stock-agent.mdx +5 -5
- package/.docs/raw/guides/guide/web-search.mdx +8 -8
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +7 -7
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +2 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +17 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +6 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +0 -2
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +21 -23
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/dashboard.mdx +2 -6
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/observability.mdx +1 -5
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/overview.mdx +2 -6
- package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/setting-up.mdx +8 -7
- package/.docs/raw/mcp/overview.mdx +31 -13
- package/.docs/raw/mcp/publishing-mcp-server.mdx +2 -2
- package/.docs/raw/memory/memory-processors.mdx +9 -9
- package/.docs/raw/memory/message-history.mdx +69 -0
- package/.docs/raw/memory/overview.mdx +34 -76
- package/.docs/raw/memory/semantic-recall.mdx +58 -49
- package/.docs/raw/memory/storage.mdx +188 -0
- package/.docs/raw/memory/working-memory.mdx +7 -7
- package/.docs/raw/observability/logging.mdx +10 -11
- package/.docs/raw/observability/overview.mdx +0 -1
- package/.docs/raw/observability/tracing/bridges/otel.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/cloud.mdx +1 -1
- package/.docs/raw/observability/tracing/exporters/default.mdx +3 -3
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +1 -2
- package/.docs/raw/observability/tracing/overview.mdx +23 -25
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/rag/chunking-and-embedding.mdx +18 -31
- package/.docs/raw/rag/graph-rag.mdx +220 -0
- package/.docs/raw/rag/overview.mdx +2 -3
- package/.docs/raw/rag/retrieval.mdx +34 -51
- package/.docs/raw/rag/vector-databases.mdx +29 -25
- package/.docs/raw/reference/agents/agent.mdx +3 -3
- package/.docs/raw/reference/agents/generate.mdx +1 -1
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +3 -3
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +3 -3
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +3 -3
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +3 -3
- package/.docs/raw/reference/agents/getLLM.mdx +3 -3
- package/.docs/raw/reference/agents/getMemory.mdx +3 -3
- package/.docs/raw/reference/agents/getModel.mdx +3 -3
- package/.docs/raw/reference/agents/getTools.mdx +2 -2
- package/.docs/raw/reference/agents/getVoice.mdx +2 -2
- package/.docs/raw/reference/agents/listAgents.mdx +2 -2
- package/.docs/raw/reference/agents/listScorers.mdx +3 -3
- package/.docs/raw/reference/agents/listTools.mdx +2 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +2 -2
- package/.docs/raw/reference/agents/network.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/network-route.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +6 -6
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +127 -0
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +107 -0
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +3 -3
- package/.docs/raw/reference/auth/auth0.mdx +2 -3
- package/.docs/raw/reference/auth/clerk.mdx +2 -3
- package/.docs/raw/reference/auth/firebase.mdx +3 -5
- package/.docs/raw/reference/auth/jwt.mdx +2 -3
- package/.docs/raw/reference/auth/supabase.mdx +2 -3
- package/.docs/raw/reference/auth/workos.mdx +2 -3
- package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
- package/.docs/raw/reference/cli/mastra.mdx +10 -10
- package/.docs/raw/reference/client-js/agents.mdx +1 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +2 -2
- package/.docs/raw/reference/client-js/workflows.mdx +20 -0
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +1 -1
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServer.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServerById.mdx +1 -1
- package/.docs/raw/reference/core/getMemory.mdx +2 -2
- package/.docs/raw/reference/core/getServer.mdx +3 -3
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getStoredAgentById.mdx +3 -3
- package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
- package/.docs/raw/reference/core/getVector.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/listMCPServers.mdx +1 -1
- package/.docs/raw/reference/core/listMemory.mdx +2 -2
- package/.docs/raw/reference/core/listStoredAgents.mdx +4 -4
- package/.docs/raw/reference/core/listVectors.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setStorage.mdx +2 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/deployer/cloudflare.mdx +1 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -1
- package/.docs/raw/reference/deployer/netlify.mdx +1 -1
- package/.docs/raw/reference/deployer/vercel.mdx +2 -4
- package/.docs/raw/reference/evals/answer-relevancy.mdx +1 -1
- package/.docs/raw/reference/evals/answer-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/bias.mdx +1 -1
- package/.docs/raw/reference/evals/completeness.mdx +1 -1
- package/.docs/raw/reference/evals/content-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/context-precision.mdx +1 -1
- package/.docs/raw/reference/evals/faithfulness.mdx +1 -1
- package/.docs/raw/reference/evals/hallucination.mdx +1 -1
- package/.docs/raw/reference/evals/keyword-coverage.mdx +1 -1
- package/.docs/raw/reference/evals/prompt-alignment.mdx +7 -7
- package/.docs/raw/reference/evals/textual-difference.mdx +1 -1
- package/.docs/raw/reference/evals/tone-consistency.mdx +1 -1
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +10 -10
- package/.docs/raw/reference/evals/toxicity.mdx +1 -1
- package/.docs/raw/reference/logging/pino-logger.mdx +7 -8
- package/.docs/raw/reference/memory/createThread.mdx +2 -2
- package/.docs/raw/reference/memory/deleteMessages.mdx +2 -2
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +2 -2
- package/.docs/raw/reference/memory/memory-class.mdx +3 -3
- package/.docs/raw/reference/memory/query.mdx +2 -2
- package/.docs/raw/reference/memory/recall.mdx +2 -2
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +2 -2
- package/.docs/raw/reference/processors/language-detector.mdx +2 -2
- package/.docs/raw/reference/processors/message-history-processor.mdx +2 -2
- package/.docs/raw/reference/processors/moderation-processor.mdx +3 -3
- package/.docs/raw/reference/processors/pii-detector.mdx +3 -3
- package/.docs/raw/reference/processors/processor-interface.mdx +13 -13
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +2 -2
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +2 -2
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
- package/.docs/raw/reference/processors/tool-call-filter.mdx +3 -3
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +2 -2
- package/.docs/raw/reference/processors/working-memory-processor.mdx +3 -3
- package/.docs/raw/reference/rag/chunk.mdx +1 -1
- package/.docs/raw/reference/rag/database-config.mdx +1 -1
- package/.docs/raw/reference/rag/extract-params.mdx +2 -2
- package/.docs/raw/reference/rag/metadata-filters.mdx +7 -7
- package/.docs/raw/reference/server/create-route.mdx +14 -14
- package/.docs/raw/reference/server/express-adapter.mdx +10 -11
- package/.docs/raw/reference/server/hono-adapter.mdx +10 -11
- package/.docs/raw/reference/server/mastra-server.mdx +22 -22
- package/.docs/raw/reference/server/routes.mdx +28 -1
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +3 -3
- package/.docs/raw/reference/storage/cloudflare.mdx +2 -2
- package/.docs/raw/reference/storage/convex.mdx +6 -6
- package/.docs/raw/reference/storage/dynamodb.mdx +4 -4
- package/.docs/raw/reference/storage/lance.mdx +3 -3
- package/.docs/raw/reference/storage/libsql.mdx +69 -54
- package/.docs/raw/reference/storage/mongodb.mdx +80 -7
- package/.docs/raw/reference/storage/mssql.mdx +4 -4
- package/.docs/raw/{server-db/storage.mdx → reference/storage/overview.mdx} +13 -111
- package/.docs/raw/reference/storage/postgresql.mdx +78 -7
- package/.docs/raw/reference/storage/upstash.mdx +74 -2
- package/.docs/raw/reference/streaming/agents/stream.mdx +27 -5
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/resumeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +35 -22
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +4 -4
- package/.docs/raw/reference/templates/overview.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +24 -5
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +3 -3
- package/.docs/raw/reference/tools/vector-query-tool.mdx +4 -4
- package/.docs/raw/reference/vectors/astra.mdx +3 -3
- package/.docs/raw/reference/vectors/chroma.mdx +3 -3
- package/.docs/raw/reference/vectors/convex.mdx +12 -12
- package/.docs/raw/reference/vectors/couchbase.mdx +5 -5
- package/.docs/raw/reference/vectors/duckdb.mdx +10 -10
- package/.docs/raw/reference/vectors/elasticsearch.mdx +4 -4
- package/.docs/raw/reference/vectors/lance.mdx +4 -4
- package/.docs/raw/reference/vectors/libsql.mdx +61 -11
- package/.docs/raw/reference/vectors/mongodb.mdx +58 -5
- package/.docs/raw/reference/vectors/pg.mdx +53 -6
- package/.docs/raw/reference/vectors/pinecone.mdx +3 -3
- package/.docs/raw/reference/vectors/qdrant.mdx +3 -3
- package/.docs/raw/reference/vectors/s3vectors.mdx +6 -6
- package/.docs/raw/reference/vectors/turbopuffer.mdx +4 -4
- package/.docs/raw/reference/vectors/upstash.mdx +55 -6
- package/.docs/raw/reference/vectors/vectorize.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +1 -3
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/start.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +143 -0
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +5 -5
- package/.docs/raw/reference/workflows/run.mdx +1 -1
- package/.docs/raw/reference/workflows/step.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +37 -2
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +6 -6
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +7 -7
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow.mdx +17 -3
- package/.docs/raw/{auth → server/auth}/auth0.mdx +20 -14
- package/.docs/raw/{auth → server/auth}/clerk.mdx +16 -9
- package/.docs/raw/{auth → server/auth}/firebase.mdx +21 -15
- package/.docs/raw/{auth → server/auth}/index.mdx +6 -6
- package/.docs/raw/{auth → server/auth}/jwt.mdx +14 -7
- package/.docs/raw/{auth → server/auth}/supabase.mdx +16 -9
- package/.docs/raw/{auth → server/auth}/workos.mdx +19 -13
- package/.docs/raw/{server-db → server}/custom-adapters.mdx +13 -13
- package/.docs/raw/{server-db → server}/custom-api-routes.mdx +3 -5
- package/.docs/raw/{server-db → server}/mastra-client.mdx +26 -15
- package/.docs/raw/{server-db → server}/mastra-server.mdx +8 -8
- package/.docs/raw/{server-db → server}/middleware.mdx +9 -9
- package/.docs/raw/{server-db → server}/request-context.mdx +33 -32
- package/.docs/raw/{server-db → server}/server-adapters.mdx +12 -12
- package/.docs/raw/streaming/events.mdx +14 -7
- package/.docs/raw/streaming/overview.mdx +21 -10
- package/.docs/raw/streaming/tool-streaming.mdx +6 -6
- package/.docs/raw/streaming/workflow-streaming.mdx +6 -8
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +31 -12
- package/.docs/raw/tools-mcp/overview.mdx +10 -11
- package/.docs/raw/voice/overview.mdx +1 -1
- package/.docs/raw/workflows/agents-and-tools.mdx +28 -19
- package/.docs/raw/workflows/control-flow.mdx +27 -40
- package/.docs/raw/workflows/error-handling.mdx +172 -18
- package/.docs/raw/workflows/human-in-the-loop.mdx +6 -7
- package/.docs/raw/workflows/inngest-workflow.mdx +8 -9
- package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
- package/.docs/raw/workflows/overview.mdx +34 -23
- package/.docs/raw/workflows/snapshots.mdx +14 -44
- package/.docs/raw/workflows/suspend-and-resume.mdx +7 -7
- package/.docs/raw/workflows/time-travel.mdx +16 -16
- package/.docs/raw/workflows/workflow-state.mdx +5 -8
- package/CHANGELOG.md +23 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/stdio.js +53 -0
- package/package.json +4 -4
- package/.docs/organized/changelogs/%40internal%2Fai-sdk-v4.md +0 -1
- package/.docs/raw/deployment/cloud-providers/index.mdx +0 -55
- package/.docs/raw/memory/conversation-history.mdx +0 -24
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +0 -140
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -150
- package/.docs/raw/memory/storage/memory-with-pg.mdx +0 -138
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +0 -146
- package/.docs/raw/memory/threads-and-resources.mdx +0 -95
|
@@ -106,7 +106,7 @@ See the following API references for more information:
|
|
|
106
106
|
|
|
107
107
|
No `format` option: Always return AI SDK v4 types
|
|
108
108
|
|
|
109
|
-
```typescript
|
|
109
|
+
```typescript
|
|
110
110
|
// Mastra native format (default)
|
|
111
111
|
const result = await agent.stream(messages);
|
|
112
112
|
```
|
|
@@ -118,7 +118,7 @@ Use `format` option to choose output:
|
|
|
118
118
|
- `'mastra'` (default)
|
|
119
119
|
- `'aisdk'` (AI SDK v5 compatible)
|
|
120
120
|
|
|
121
|
-
```typescript
|
|
121
|
+
```typescript
|
|
122
122
|
// AI SDK v5 compatibility
|
|
123
123
|
const result = await agent.stream(messages, {
|
|
124
124
|
format: "aisdk",
|
|
@@ -131,7 +131,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
131
131
|
|
|
132
132
|
- `format` - Choose between 'mastra' or 'aisdk' output format:
|
|
133
133
|
|
|
134
|
-
```typescript
|
|
134
|
+
```typescript copy
|
|
135
135
|
const result = await agent.stream(messages, {
|
|
136
136
|
format: "aisdk", // or 'mastra' (default)
|
|
137
137
|
});
|
|
@@ -139,7 +139,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
139
139
|
|
|
140
140
|
- `system` - Custom system message (separate from instructions).
|
|
141
141
|
|
|
142
|
-
```typescript
|
|
142
|
+
```typescript copy
|
|
143
143
|
const result = await agent.stream(messages, {
|
|
144
144
|
system: "You are a helpful assistant",
|
|
145
145
|
});
|
|
@@ -153,7 +153,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
153
153
|
- 'error' - throw an error
|
|
154
154
|
- 'fallback' - return a fallback value you provide
|
|
155
155
|
|
|
156
|
-
```typescript
|
|
156
|
+
```typescript copy
|
|
157
157
|
const result = await agent.generate(messages, {
|
|
158
158
|
structuredOutput: {
|
|
159
159
|
schema: z.object({
|
|
@@ -170,7 +170,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
170
170
|
|
|
171
171
|
- `stopWhen` - Flexible stop conditions (step count, token limit, etc).
|
|
172
172
|
|
|
173
|
-
```typescript
|
|
173
|
+
```typescript copy
|
|
174
174
|
const result = await agent.stream(messages, {
|
|
175
175
|
stopWhen: ({ steps, totalTokens }) => steps >= 5 || totalTokens >= 10000,
|
|
176
176
|
});
|
|
@@ -178,7 +178,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
178
178
|
|
|
179
179
|
- `providerOptions` - Provider-specific options (e.g., OpenAI-specific settings)
|
|
180
180
|
|
|
181
|
-
```typescript
|
|
181
|
+
```typescript copy
|
|
182
182
|
const result = await agent.stream(messages, {
|
|
183
183
|
providerOptions: {
|
|
184
184
|
openai: {
|
|
@@ -191,7 +191,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
191
191
|
|
|
192
192
|
- `onChunk` - Callback for each streaming chunk.
|
|
193
193
|
|
|
194
|
-
```typescript
|
|
194
|
+
```typescript copy
|
|
195
195
|
const result = await agent.stream(messages, {
|
|
196
196
|
onChunk: (chunk) => {
|
|
197
197
|
console.log("Received chunk:", chunk);
|
|
@@ -201,7 +201,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
201
201
|
|
|
202
202
|
- `onError` - Error callback.
|
|
203
203
|
|
|
204
|
-
```typescript
|
|
204
|
+
```typescript copy
|
|
205
205
|
const result = await agent.stream(messages, {
|
|
206
206
|
onError: (error) => {
|
|
207
207
|
console.error("Stream error:", error);
|
|
@@ -211,7 +211,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
211
211
|
|
|
212
212
|
- `onAbort` - Abort callback.
|
|
213
213
|
|
|
214
|
-
```typescript
|
|
214
|
+
```typescript copy
|
|
215
215
|
const result = await agent.stream(messages, {
|
|
216
216
|
onAbort: () => {
|
|
217
217
|
console.log("Stream aborted");
|
|
@@ -221,7 +221,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
221
221
|
|
|
222
222
|
- `activeTools` - Specify which tools are active for this execution.
|
|
223
223
|
|
|
224
|
-
```typescript
|
|
224
|
+
```typescript copy
|
|
225
225
|
const result = await agent.stream(messages, {
|
|
226
226
|
activeTools: ["search", "calculator"], // Only these tools will be available
|
|
227
227
|
});
|
|
@@ -229,7 +229,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
229
229
|
|
|
230
230
|
- `abortSignal` - AbortSignal for cancellation.
|
|
231
231
|
|
|
232
|
-
```typescript
|
|
232
|
+
```typescript copy
|
|
233
233
|
const controller = new AbortController();
|
|
234
234
|
const result = await agent.stream(messages, {
|
|
235
235
|
abortSignal: controller.signal,
|
|
@@ -240,7 +240,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
240
240
|
|
|
241
241
|
- `prepareStep` - Callback before each step in multi-step execution.
|
|
242
242
|
|
|
243
|
-
```typescript
|
|
243
|
+
```typescript copy
|
|
244
244
|
const result = await agent.stream(messages, {
|
|
245
245
|
prepareStep: ({ step, state }) => {
|
|
246
246
|
console.log("About to execute step:", step);
|
|
@@ -253,7 +253,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
253
253
|
|
|
254
254
|
- `requireToolApproval` - Require approval for all tool calls.
|
|
255
255
|
|
|
256
|
-
```typescript
|
|
256
|
+
```typescript copy
|
|
257
257
|
const result = await agent.stream(messages, {
|
|
258
258
|
requireToolApproval: true,
|
|
259
259
|
});
|
|
@@ -265,7 +265,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
265
265
|
|
|
266
266
|
Unified in `modelSettings`
|
|
267
267
|
|
|
268
|
-
```typescript
|
|
268
|
+
```typescript copy
|
|
269
269
|
const result = await agent.stream(messages, {
|
|
270
270
|
modelSettings: {
|
|
271
271
|
temperature: 0.7,
|
|
@@ -279,7 +279,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
279
279
|
|
|
280
280
|
Moved to memory object.
|
|
281
281
|
|
|
282
|
-
```typescript
|
|
282
|
+
```typescript copy
|
|
283
283
|
const result = await agent.stream(messages, {
|
|
284
284
|
memory: {
|
|
285
285
|
resource: "user-123",
|
|
@@ -294,7 +294,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
294
294
|
|
|
295
295
|
Use `structuredOutput` instead to allow for tool calls and an object return.
|
|
296
296
|
|
|
297
|
-
```typescript
|
|
297
|
+
```typescript copy
|
|
298
298
|
const result = await agent.generate(messages, {
|
|
299
299
|
structuredOutput: {
|
|
300
300
|
schema: z.object({
|
|
@@ -309,7 +309,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
309
309
|
|
|
310
310
|
The `output` property is deprecated in favor of `structuredOutput`, to achieve the same results, omit the model and only pass `structuredOutput.schema`, optionally add `jsonPromptInjection: true` if your model does not natively support `response_format`.
|
|
311
311
|
|
|
312
|
-
```typescript
|
|
312
|
+
```typescript copy
|
|
313
313
|
const result = await agent.generate(messages, {
|
|
314
314
|
structuredOutput: {
|
|
315
315
|
schema: {
|
|
@@ -325,11 +325,9 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
325
325
|
|
|
326
326
|
Use `memory` instead.
|
|
327
327
|
|
|
328
|
-
```typescript
|
|
328
|
+
```typescript copy
|
|
329
329
|
const result = await agent.generate(messages, {
|
|
330
|
-
memory: {
|
|
331
|
-
// ...
|
|
332
|
-
},
|
|
330
|
+
memory: {},
|
|
333
331
|
});
|
|
334
332
|
```
|
|
335
333
|
|
|
@@ -350,7 +348,7 @@ See the following API references for more information:
|
|
|
350
348
|
|
|
351
349
|
`toolChoice` uses the AI SDK v5 `ToolChoice` type.
|
|
352
350
|
|
|
353
|
-
```typescript
|
|
351
|
+
```typescript copy
|
|
354
352
|
type ToolChoice<TOOLS extends Record<string, unknown>> =
|
|
355
353
|
| "auto"
|
|
356
354
|
| "none"
|
package/.docs/raw/index.mdx
CHANGED
|
@@ -27,9 +27,9 @@ Some highlights include:
|
|
|
27
27
|
|
|
28
28
|
- [**Workflows**](/docs/v1/workflows/overview) - When you need explicit control over execution, use Mastra's graph-based workflow engine to orchestrate complex multi-step processes. Mastra workflows use an intuitive syntax for control flow (`.then()`, `.branch()`, `.parallel()`).
|
|
29
29
|
|
|
30
|
-
- [**Human-in-the-loop**](/docs/v1/workflows/suspend-and-resume) - Suspend an agent or workflow and await user input or approval before resuming. Mastra uses
|
|
30
|
+
- [**Human-in-the-loop**](/docs/v1/workflows/suspend-and-resume) - Suspend an agent or workflow and await user input or approval before resuming. Mastra uses storage to remember execution state, so you can pause indefinitely and resume where you left off.
|
|
31
31
|
|
|
32
|
-
- **Context management** - Give your agents the right context at the right time. Provide [
|
|
32
|
+
- **Context management** - Give your agents the right context at the right time. Provide [message history](/docs/v1/memory/message-history), [retrieve](/docs/v1/rag/overview) data from your sources (APIs, databases, files), and add human-like [working](/docs/v1/memory/working-memory) and [semantic](/docs/v1/memory/semantic-recall) memory so your agents behave coherently.
|
|
33
33
|
|
|
34
34
|
- **Integrations** - Bundle agents and workflows into existing React, Next.js, or Node.js apps, or ship them as standalone endpoints. When building UIs, integrate with agentic libraries like Vercel's AI SDK UI and CopilotKit to bring your AI assistant to life on the web.
|
|
35
35
|
|
|
@@ -3,13 +3,9 @@ title: "Navigating the Dashboard | Mastra Cloud"
|
|
|
3
3
|
description: Details of each feature available in Mastra Cloud
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { MastraCloudCallout } from "@site/src/components/MastraCloudCallout";
|
|
7
|
-
|
|
8
6
|
# Navigating the Dashboard
|
|
9
7
|
|
|
10
|
-
This page explains how to navigate the Mastra Cloud dashboard, where you can configure your project, view deployment details, and interact with agents and workflows using the built-in [Studio](/docs/v1/
|
|
11
|
-
|
|
12
|
-
<MastraCloudCallout />
|
|
8
|
+
This page explains how to navigate the Mastra Cloud dashboard, where you can configure your project, view deployment details, and interact with agents and workflows using the built-in [Studio](/docs/v1/mastra-cloud/dashboard#studio).
|
|
13
9
|
|
|
14
10
|
## Overview
|
|
15
11
|
|
|
@@ -97,4 +93,4 @@ Each MCP Server includes API endpoints for HTTP and SSE, along with IDE configur
|
|
|
97
93
|
|
|
98
94
|
## Next steps
|
|
99
95
|
|
|
100
|
-
- [Understanding Tracing and Logs](/docs/v1/
|
|
96
|
+
- [Understanding Tracing and Logs](/docs/v1/mastra-cloud/observability)
|
|
@@ -3,16 +3,12 @@ title: "Understanding Tracing and Logs | Mastra Cloud"
|
|
|
3
3
|
description: Monitoring and debugging tools for Mastra Cloud deployments
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { MastraCloudCallout } from "@site/src/components/MastraCloudCallout";
|
|
7
|
-
|
|
8
6
|
# Understanding Tracing and Logs
|
|
9
7
|
|
|
10
8
|
Mastra Cloud provides full observability for production applications, giving you insight into how your agents and workflows behave. Observability can be enabled whether your application is deployed to Mastra Cloud, running locally, or hosted on your own infrastructure. Any Mastra project can send traces and logs to the platform regardless of where it's running.
|
|
11
9
|
|
|
12
10
|
For details on configuring observability, see the [Cloud Exporter](/docs/v1/observability/tracing/exporters/cloud) docs.
|
|
13
11
|
|
|
14
|
-
<MastraCloudCallout />
|
|
15
|
-
|
|
16
12
|
## Traces
|
|
17
13
|
|
|
18
14
|
More detailed traces are available for both agents and workflows by enabling [observability](/docs/v1/observability/tracing/overview) using one of our [supported providers](/docs/v1/observability/tracing/overview#exporters).
|
|
@@ -39,7 +35,7 @@ Workflow traces capture each step in the run, including transitions, branching,
|
|
|
39
35
|
|
|
40
36
|
## Logs
|
|
41
37
|
|
|
42
|
-
You can view detailed logs for debugging and monitoring your application's behavior on the [Logs](/docs/v1/
|
|
38
|
+
You can view detailed logs for debugging and monitoring your application's behavior on the [Logs](/docs/v1/mastra-cloud/dashboard#logs) page of the Dashboard.
|
|
43
39
|
|
|
44
40
|

|
|
45
41
|
|
|
@@ -3,13 +3,9 @@ title: "Mastra Cloud | Mastra Cloud"
|
|
|
3
3
|
description: Deployment and monitoring service for Mastra applications
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { MastraCloudCallout } from "@site/src/components/MastraCloudCallout";
|
|
7
|
-
|
|
8
6
|
# Mastra Cloud
|
|
9
7
|
|
|
10
|
-
[Mastra Cloud](https://mastra.ai/cloud) is a platform for deploying, managing, monitoring, and debugging Mastra applications. When you [deploy](/docs/v1/
|
|
11
|
-
|
|
12
|
-
<MastraCloudCallout />
|
|
8
|
+
[Mastra Cloud](https://mastra.ai/cloud) is a platform for deploying, managing, monitoring, and debugging Mastra applications. When you [deploy](/docs/v1/mastra-cloud/setting-up) your application, Mastra Cloud exposes your agents, tools, and workflows as REST API endpoints.
|
|
13
9
|
|
|
14
10
|
## Platform features
|
|
15
11
|
|
|
@@ -62,4 +58,4 @@ Mastra Cloud is purpose-built for Mastra agents, tools, and workflows. It handle
|
|
|
62
58
|
|
|
63
59
|
## Next steps
|
|
64
60
|
|
|
65
|
-
- [Setting Up and Deploying](/docs/v1/
|
|
61
|
+
- [Setting Up and Deploying](/docs/v1/mastra-cloud/setting-up)
|
|
@@ -3,7 +3,6 @@ title: "Setting Up and Deploying | Mastra Cloud"
|
|
|
3
3
|
description: Configuration steps for Mastra Cloud projects
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { MastraCloudCallout } from "@site/src/components/MastraCloudCallout";
|
|
7
6
|
import Steps from "@site/src/components/Steps";
|
|
8
7
|
import StepItem from "@site/src/components/StepItem";
|
|
9
8
|
|
|
@@ -11,14 +10,16 @@ import StepItem from "@site/src/components/StepItem";
|
|
|
11
10
|
|
|
12
11
|
This page explains how to set up a project on [Mastra Cloud](https://mastra.ai/cloud) with automatic deployments using our GitHub integration.
|
|
13
12
|
|
|
14
|
-
<MastraCloudCallout />
|
|
15
|
-
|
|
16
13
|
## Prerequisites
|
|
17
14
|
|
|
18
15
|
- A [Mastra Cloud](https://mastra.ai/cloud) account
|
|
19
16
|
- A GitHub account / repository containing a Mastra application
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
:::info
|
|
19
|
+
|
|
20
|
+
Visit our [Getting started](/guides/v1/getting-started/quickstart) guide to scaffold out a new Mastra project with sensible defaults.
|
|
21
|
+
|
|
22
|
+
:::
|
|
22
23
|
|
|
23
24
|
## Setup and Deploy process
|
|
24
25
|
|
|
@@ -73,7 +74,7 @@ Mastra Cloud automatically detects the right build settings, but you can customi
|
|
|
73
74
|
- **Install command**: Runs pre-build to install project dependencies
|
|
74
75
|
- **Project setup command**: Runs pre-build to prepare any external dependencies
|
|
75
76
|
- **Port**: The network port the server will use
|
|
76
|
-
- **Store settings**: Use Mastra Cloud's built-in [LibSQLStore](/
|
|
77
|
+
- **Store settings**: Use Mastra Cloud's built-in [LibSQLStore](/reference/v1/storage/libsql) storage
|
|
77
78
|
- **Deploy Project**: Starts the deployment process
|
|
78
79
|
|
|
79
80
|
</StepItem>
|
|
@@ -98,8 +99,8 @@ Your project is now configured with automatic deployments which occur whenever y
|
|
|
98
99
|
|
|
99
100
|
## Testing your application
|
|
100
101
|
|
|
101
|
-
After a successful deployment you can test your agents and workflows [Studio](/docs/v1/
|
|
102
|
+
After a successful deployment you can test your agents and workflows [Studio](/docs/v1/mastra-cloud/dashboard#studio) in Mastra Cloud, or interact with them using our [Client SDK](/docs/v1/server/mastra-client).
|
|
102
103
|
|
|
103
104
|
## Next steps
|
|
104
105
|
|
|
105
|
-
- [Navigating the Dashboard](/docs/v1/
|
|
106
|
+
- [Navigating the Dashboard](/docs/v1/mastra-cloud/dashboard)
|
|
@@ -29,7 +29,7 @@ npm install @mastra/mcp@beta
|
|
|
29
29
|
|
|
30
30
|
The `MCPClient` connects Mastra primitives to external MCP servers, which can be local packages (invoked using `npx`) or remote HTTP(S) endpoints. Each server must be configured with either a `command` or a `url`, depending on how it's hosted.
|
|
31
31
|
|
|
32
|
-
```typescript title="src/mastra/mcp/test-mcp-client.ts"
|
|
32
|
+
```typescript title="src/mastra/mcp/test-mcp-client.ts"
|
|
33
33
|
import { MCPClient } from "@mastra/mcp";
|
|
34
34
|
|
|
35
35
|
export const testMcpClient = new MCPClient({
|
|
@@ -48,13 +48,17 @@ export const testMcpClient = new MCPClient({
|
|
|
48
48
|
});
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
:::info
|
|
52
|
+
|
|
53
|
+
Visit [MCPClient](/reference/v1/tools/mcp-client) for a full list of configuration options.
|
|
54
|
+
|
|
55
|
+
:::
|
|
52
56
|
|
|
53
57
|
## Using `MCPClient` with an agent
|
|
54
58
|
|
|
55
59
|
To use tools from an MCP server in an agent, import your `MCPClient` and call `.getTools()` in the `tools` parameter. This loads from the defined MCP servers, making them available to the agent.
|
|
56
60
|
|
|
57
|
-
```typescript {3,15} title="src/mastra/agents/test-agent.ts"
|
|
61
|
+
```typescript {3,15} title="src/mastra/agents/test-agent.ts"
|
|
58
62
|
import { Agent } from "@mastra/core/agent";
|
|
59
63
|
|
|
60
64
|
import { testMcpClient } from "../mcp/test-mcp-client";
|
|
@@ -73,13 +77,17 @@ export const testAgent = new Agent({
|
|
|
73
77
|
});
|
|
74
78
|
```
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
:::info
|
|
81
|
+
|
|
82
|
+
Visit [Agent Class](/reference/v1/agents/agent) for a full list of configuration options.
|
|
83
|
+
|
|
84
|
+
:::
|
|
77
85
|
|
|
78
86
|
## Configuring `MCPServer`
|
|
79
87
|
|
|
80
88
|
To expose agents, tools, and workflows from your Mastra application to external systems over HTTP(S) use the `MCPServer` class. This makes them accessible to any system or agent that supports the protocol.
|
|
81
89
|
|
|
82
|
-
```typescript title="src/mastra/mcp/test-mcp-server.ts"
|
|
90
|
+
```typescript title="src/mastra/mcp/test-mcp-server.ts"
|
|
83
91
|
import { MCPServer } from "@mastra/mcp";
|
|
84
92
|
|
|
85
93
|
import { testAgent } from "../agents/test-agent";
|
|
@@ -96,19 +104,22 @@ export const testMcpServer = new MCPServer({
|
|
|
96
104
|
});
|
|
97
105
|
```
|
|
98
106
|
|
|
99
|
-
|
|
107
|
+
:::info
|
|
108
|
+
|
|
109
|
+
Visit [MCPServer](/reference/v1/tools/mcp-server) for a full list of configuration options.
|
|
110
|
+
|
|
111
|
+
:::
|
|
100
112
|
|
|
101
113
|
## Registering an `MCPServer`
|
|
102
114
|
|
|
103
115
|
To make an MCP server available to other systems or agents that support the protocol, register it in the main `Mastra` instance using `mcpServers`.
|
|
104
116
|
|
|
105
|
-
```typescript title="src/mastra/index.ts"
|
|
117
|
+
```typescript title="src/mastra/index.ts"
|
|
106
118
|
import { Mastra } from "@mastra/core/mastra";
|
|
107
119
|
|
|
108
120
|
import { testMcpServer } from "./mcp/test-mcp-server";
|
|
109
121
|
|
|
110
122
|
export const mastra = new Mastra({
|
|
111
|
-
// ...
|
|
112
123
|
mcpServers: { testMcpServer },
|
|
113
124
|
});
|
|
114
125
|
```
|
|
@@ -128,15 +139,18 @@ export const mastra = new Mastra({
|
|
|
128
139
|
|
|
129
140
|
Use the `.getTools()` method to fetch tools from all configured MCP servers. This is suitable when configuration (such as API keys) is static and consistent across users or requests. Call it once and pass the result to the `tools` property when defining your agent.
|
|
130
141
|
|
|
131
|
-
|
|
142
|
+
:::info
|
|
143
|
+
|
|
144
|
+
Visit [getTools()](/reference/v1/tools/mcp-client#gettools) for more information.
|
|
145
|
+
|
|
146
|
+
:::
|
|
132
147
|
|
|
133
|
-
```typescript {
|
|
148
|
+
```typescript {6} title="src/mastra/agents/test-agent.ts"
|
|
134
149
|
import { Agent } from "@mastra/core/agent";
|
|
135
150
|
|
|
136
151
|
import { testMcpClient } from "../mcp/test-mcp-client";
|
|
137
152
|
|
|
138
153
|
export const testAgent = new Agent({
|
|
139
|
-
// ...
|
|
140
154
|
tools: await testMcpClient.getTools(),
|
|
141
155
|
});
|
|
142
156
|
```
|
|
@@ -145,7 +159,7 @@ export const testAgent = new Agent({
|
|
|
145
159
|
|
|
146
160
|
Use the `.getToolsets()` method when tool configuration may vary by request or user, such as in a multi-tenant system where each user provides their own API key. This method returns toolsets that can be passed to the `toolsets` option in the agent's `.generate()` or `.stream()` calls.
|
|
147
161
|
|
|
148
|
-
```typescript {5-16,21}
|
|
162
|
+
```typescript {5-16,21}
|
|
149
163
|
import { MCPClient } from "@mastra/mcp";
|
|
150
164
|
import { mastra } from "./mastra";
|
|
151
165
|
|
|
@@ -177,7 +191,11 @@ async function handleRequest(userPrompt: string, userApiKey: string) {
|
|
|
177
191
|
}
|
|
178
192
|
```
|
|
179
193
|
|
|
180
|
-
|
|
194
|
+
:::info
|
|
195
|
+
|
|
196
|
+
Visit [getToolsets()](/reference/v1/tools/mcp-client#gettoolsets) for more information.
|
|
197
|
+
|
|
198
|
+
:::
|
|
181
199
|
|
|
182
200
|
## Connecting to an MCP registry
|
|
183
201
|
|
|
@@ -32,7 +32,7 @@ Create a file for your stdio server, for example, `/src/mastra/stdio.ts`.
|
|
|
32
32
|
|
|
33
33
|
Add the following code to the file. Remember to import your actual Mastra tools and name the server appropriately.
|
|
34
34
|
|
|
35
|
-
```typescript title="src/mastra/stdio.ts"
|
|
35
|
+
```typescript title="src/mastra/stdio.ts"
|
|
36
36
|
#!/usr/bin/env node
|
|
37
37
|
import { MCPServer } from "@mastra/mcp";
|
|
38
38
|
import { weatherTool } from "./tools";
|
|
@@ -55,7 +55,7 @@ server.startStdio().catch((error) => {
|
|
|
55
55
|
|
|
56
56
|
Update your `package.json` to include the `bin` entry pointing to your built server file and a script to build the server with both ESM and CJS outputs.
|
|
57
57
|
|
|
58
|
-
```json title="package.json"
|
|
58
|
+
```json title="package.json"
|
|
59
59
|
{
|
|
60
60
|
"bin": "dist/stdio.mjs",
|
|
61
61
|
"scripts": {
|
|
@@ -7,7 +7,7 @@ description: "Learn how to use memory processors in Mastra to filter, trim, and
|
|
|
7
7
|
|
|
8
8
|
Memory processors transform and filter messages as they pass through an agent with memory enabled. They manage context window limits, remove unnecessary content, and optimize the information sent to the language model.
|
|
9
9
|
|
|
10
|
-
When memory is enabled on an agent, Mastra adds memory processors to the agent's processor pipeline. These processors retrieve
|
|
10
|
+
When memory is enabled on an agent, Mastra adds memory processors to the agent's processor pipeline. These processors retrieve message history, working memory, and semantically relevant messages, then persist new messages after the model responds.
|
|
11
11
|
|
|
12
12
|
Memory processors are [processors](/docs/v1/agents/processors) that operate specifically on memory-related messages and state.
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@ Mastra automatically adds these processors when memory is enabled:
|
|
|
17
17
|
|
|
18
18
|
### MessageHistory
|
|
19
19
|
|
|
20
|
-
Retrieves
|
|
20
|
+
Retrieves message history and persists new messages.
|
|
21
21
|
|
|
22
22
|
**When you configure:**
|
|
23
23
|
|
|
@@ -40,7 +40,7 @@ memory: new Memory({
|
|
|
40
40
|
|
|
41
41
|
**Example:**
|
|
42
42
|
|
|
43
|
-
```typescript
|
|
43
|
+
```typescript
|
|
44
44
|
import { Agent } from "@mastra/core/agent";
|
|
45
45
|
import { Memory } from "@mastra/memory";
|
|
46
46
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -89,7 +89,7 @@ memory: new Memory({
|
|
|
89
89
|
|
|
90
90
|
**Example:**
|
|
91
91
|
|
|
92
|
-
```typescript
|
|
92
|
+
```typescript
|
|
93
93
|
import { Agent } from "@mastra/core/agent";
|
|
94
94
|
import { Memory } from "@mastra/memory";
|
|
95
95
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -145,7 +145,7 @@ memory: new Memory({
|
|
|
145
145
|
|
|
146
146
|
**Example:**
|
|
147
147
|
|
|
148
|
-
```typescript
|
|
148
|
+
```typescript
|
|
149
149
|
import { Agent } from "@mastra/core/agent";
|
|
150
150
|
import { Memory } from "@mastra/memory";
|
|
151
151
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -169,7 +169,7 @@ const agent = new Agent({
|
|
|
169
169
|
|
|
170
170
|
If you manually add a memory processor to `inputProcessors` or `outputProcessors`, Mastra will **not** automatically add it. This gives you full control over processor ordering:
|
|
171
171
|
|
|
172
|
-
```typescript
|
|
172
|
+
```typescript
|
|
173
173
|
import { Agent } from "@mastra/core/agent";
|
|
174
174
|
import { Memory } from "@mastra/memory";
|
|
175
175
|
import { MessageHistory } from "@mastra/memory/processors";
|
|
@@ -211,7 +211,7 @@ Understanding the execution order is important when combining guardrails with me
|
|
|
211
211
|
1. **Memory processors run FIRST**: `WorkingMemory`, `MessageHistory`, `SemanticRecall`
|
|
212
212
|
2. **Your input processors run AFTER**: guardrails, filters, validators
|
|
213
213
|
|
|
214
|
-
This means memory loads
|
|
214
|
+
This means memory loads message history before your processors can validate or filter the input.
|
|
215
215
|
|
|
216
216
|
### Output Processors
|
|
217
217
|
|
|
@@ -236,7 +236,7 @@ Output guardrails run **before** memory processors save messages. If a guardrail
|
|
|
236
236
|
- Memory processors are skipped
|
|
237
237
|
- **No messages are persisted to storage**
|
|
238
238
|
|
|
239
|
-
```typescript
|
|
239
|
+
```typescript
|
|
240
240
|
import { Agent } from "@mastra/core/agent";
|
|
241
241
|
import { Memory } from "@mastra/memory";
|
|
242
242
|
import { openai } from "@ai-sdk/openai";
|
|
@@ -281,7 +281,7 @@ Input guardrails run **after** memory processors load history. If a guardrail ab
|
|
|
281
281
|
- Output processors (including memory persistence) are skipped
|
|
282
282
|
- **No messages are persisted to storage**
|
|
283
283
|
|
|
284
|
-
```typescript
|
|
284
|
+
```typescript
|
|
285
285
|
// Input guardrail that validates user input
|
|
286
286
|
const inputValidator = {
|
|
287
287
|
id: "input-validator",
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Message History | Memory"
|
|
3
|
+
description: "Learn how to configure message history in Mastra to store recent messages from the current conversation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Message History
|
|
7
|
+
|
|
8
|
+
Message history is the simplest kind of memory. It is a list of messages from the current conversation.
|
|
9
|
+
|
|
10
|
+
Once enabled, each request includes the last 10 messages from the current memory thread, giving the agent short-term conversational context. This limit can be increased using the `lastMessages` parameter:
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
export const agent = new Agent({
|
|
14
|
+
id: "test-agent",
|
|
15
|
+
memory: new Memory({
|
|
16
|
+
options: {
|
|
17
|
+
lastMessages: 20,
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Querying Messages
|
|
24
|
+
|
|
25
|
+
Messages are stored in the `MastraDBMessage` format, which provides a consistent structure across the entire Mastra system:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// Get messages for a thread with pagination
|
|
29
|
+
const result = await mastra
|
|
30
|
+
.getStorage()
|
|
31
|
+
.listMessages({
|
|
32
|
+
threadId: "your-thread-id",
|
|
33
|
+
page: 0,
|
|
34
|
+
perPage: 50
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
console.log(result.messages); // MastraDBMessage[]
|
|
38
|
+
console.log(result.total); // Total count
|
|
39
|
+
console.log(result.hasMore); // Whether more pages exist
|
|
40
|
+
|
|
41
|
+
// Get messages from multiple threads at once
|
|
42
|
+
const multiThreadResult = await mastra
|
|
43
|
+
.getStorage()
|
|
44
|
+
.listMessages({
|
|
45
|
+
threadId: ["thread-1", "thread-2", "thread-3"],
|
|
46
|
+
page: 0,
|
|
47
|
+
perPage: 100
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Get messages by their IDs
|
|
51
|
+
const messages = await mastra
|
|
52
|
+
.getStorage()
|
|
53
|
+
.listMessagesById({ messageIds: messageIdArr });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The `threadId` parameter accepts either a single thread ID string or an array of thread IDs to query messages from multiple threads in a single request.
|
|
57
|
+
|
|
58
|
+
All message queries return `MastraDBMessage[]` format. If you need to convert messages to AI SDK formats for UI rendering, use the conversion utilities from `@mastra/ai-sdk/ui`:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { toAISdkV5Messages } from '@mastra/ai-sdk/ui';
|
|
62
|
+
|
|
63
|
+
const result = await mastra
|
|
64
|
+
.getStorage()
|
|
65
|
+
.listMessages({ threadId: "your-thread-id" });
|
|
66
|
+
|
|
67
|
+
// Convert to AI SDK v5 UIMessage format for UI rendering
|
|
68
|
+
const uiMessages = toAISdkV5Messages(result.messages);
|
|
69
|
+
```
|