@mastra/mcp-docs-server 1.1.8 → 1.1.9-alpha.1
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/docs/agents/adding-voice.md +4 -4
- package/.docs/docs/agents/agent-approval.md +3 -3
- package/.docs/docs/agents/agent-memory.md +3 -3
- package/.docs/docs/agents/guardrails.md +3 -3
- package/.docs/docs/agents/network-approval.md +5 -2
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +42 -24
- package/.docs/docs/agents/structured-output.md +2 -2
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +3 -3
- package/.docs/docs/build-with-ai/mcp-docs-server.md +5 -5
- package/.docs/docs/build-with-ai/skills.md +2 -2
- package/.docs/docs/community/contributing-templates.md +1 -1
- package/.docs/docs/community/discord.md +3 -3
- package/.docs/docs/community/licensing.md +2 -2
- package/.docs/docs/deployment/cloud-providers.md +2 -2
- package/.docs/docs/deployment/mastra-server.md +2 -2
- package/.docs/docs/deployment/monorepo.md +1 -1
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/studio.md +3 -3
- package/.docs/docs/deployment/web-framework.md +2 -2
- package/.docs/docs/deployment/workflow-runners.md +1 -1
- package/.docs/docs/evals/built-in-scorers.md +1 -1
- package/.docs/docs/evals/custom-scorers.md +6 -6
- package/.docs/docs/evals/overview.md +2 -2
- package/.docs/docs/evals/running-in-ci.md +6 -6
- package/.docs/docs/getting-started/build-with-ai.md +3 -3
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/getting-started/project-structure.md +2 -2
- package/.docs/docs/index.md +63 -17
- package/.docs/docs/mastra-cloud/deployment.md +1 -1
- package/.docs/docs/mastra-cloud/studio.md +1 -1
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/mcp/publishing-mcp-server.md +4 -4
- package/.docs/docs/memory/memory-processors.md +9 -9
- package/.docs/docs/memory/message-history.md +4 -4
- package/.docs/docs/memory/observational-memory.md +11 -7
- package/.docs/docs/memory/semantic-recall.md +9 -9
- package/.docs/docs/memory/storage.md +1 -1
- package/.docs/docs/memory/working-memory.md +20 -20
- package/.docs/docs/observability/datasets/overview.md +1 -1
- package/.docs/docs/observability/datasets/running-experiments.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/overview.md +5 -5
- package/.docs/docs/observability/tracing/bridges/otel.md +9 -9
- package/.docs/docs/observability/tracing/exporters/arize.md +3 -3
- package/.docs/docs/observability/tracing/exporters/braintrust.md +1 -1
- package/.docs/docs/observability/tracing/exporters/cloud.md +2 -2
- package/.docs/docs/observability/tracing/exporters/datadog.md +3 -3
- package/.docs/docs/observability/tracing/exporters/default.md +8 -8
- package/.docs/docs/observability/tracing/exporters/laminar.md +1 -1
- package/.docs/docs/observability/tracing/exporters/langfuse.md +3 -3
- package/.docs/docs/observability/tracing/exporters/langsmith.md +4 -4
- package/.docs/docs/observability/tracing/exporters/otel.md +8 -8
- package/.docs/docs/observability/tracing/exporters/posthog.md +2 -2
- package/.docs/docs/observability/tracing/exporters/sentry.md +4 -4
- package/.docs/docs/observability/tracing/overview.md +24 -24
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +13 -13
- package/.docs/docs/rag/chunking-and-embedding.md +5 -5
- package/.docs/docs/rag/overview.md +2 -2
- package/.docs/docs/rag/retrieval.md +4 -4
- package/.docs/docs/rag/vector-databases.md +13 -13
- package/.docs/docs/server/auth/auth0.md +2 -2
- package/.docs/docs/server/auth/clerk.md +1 -1
- package/.docs/docs/server/auth/composite-auth.md +9 -9
- package/.docs/docs/server/auth/custom-auth-provider.md +12 -12
- package/.docs/docs/server/auth/firebase.md +3 -3
- package/.docs/docs/server/auth/jwt.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +9 -9
- package/.docs/docs/server/auth/supabase.md +1 -1
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/auth.md +2 -2
- package/.docs/docs/server/custom-adapters.md +7 -7
- package/.docs/docs/server/custom-api-routes.md +2 -2
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/mastra-server.md +2 -2
- package/.docs/docs/server/request-context.md +2 -2
- package/.docs/docs/server/server-adapters.md +3 -3
- package/.docs/docs/streaming/events.md +2 -2
- package/.docs/docs/streaming/overview.md +2 -2
- package/.docs/docs/streaming/tool-streaming.md +46 -32
- package/.docs/docs/streaming/workflow-streaming.md +1 -1
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +1 -1
- package/.docs/docs/voice/speech-to-text.md +2 -2
- package/.docs/docs/voice/text-to-speech.md +2 -2
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/control-flow.md +45 -3
- package/.docs/docs/workflows/error-handling.md +4 -4
- package/.docs/docs/workflows/overview.md +3 -3
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +3 -3
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/docs/workspace/filesystem.md +3 -3
- package/.docs/docs/workspace/overview.md +53 -8
- package/.docs/docs/workspace/sandbox.md +72 -13
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +4 -4
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +2 -2
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit.md +2 -2
- package/.docs/guides/deployment/digital-ocean.md +1 -1
- package/.docs/guides/deployment/inngest.md +4 -4
- package/.docs/guides/getting-started/astro.md +1 -1
- package/.docs/guides/getting-started/electron.md +1 -1
- package/.docs/guides/getting-started/next-js.md +1 -1
- package/.docs/guides/getting-started/vite-react.md +1 -1
- package/.docs/guides/guide/ai-recruiter.md +4 -4
- package/.docs/guides/guide/chef-michel.md +4 -4
- package/.docs/guides/guide/code-review-bot.md +3 -3
- package/.docs/guides/guide/dev-assistant.md +5 -5
- package/.docs/guides/guide/docs-manager.md +3 -3
- package/.docs/guides/guide/github-actions-pr-description.md +4 -4
- package/.docs/guides/guide/notes-mcp-server.md +4 -4
- package/.docs/guides/guide/research-assistant.md +4 -4
- package/.docs/guides/guide/research-coordinator.md +1 -1
- package/.docs/guides/guide/stock-agent.md +6 -6
- package/.docs/guides/guide/web-search.md +2 -2
- package/.docs/guides/guide/whatsapp-chat-bot.md +1 -1
- package/.docs/guides/migrations/agentnetwork.md +1 -1
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +3 -3
- package/.docs/guides/migrations/network-to-supervisor.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/client.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +4 -4
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +6 -6
- package/.docs/guides/migrations/vnext-to-standard-apis.md +3 -3
- package/.docs/models/embeddings.md +4 -4
- package/.docs/models/gateways/custom-gateways.md +4 -4
- package/.docs/models/gateways/netlify.md +2 -3
- package/.docs/models/gateways/openrouter.md +9 -2
- package/.docs/models/gateways/vercel.md +11 -2
- package/.docs/models/gateways.md +2 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/302ai.md +3 -3
- package/.docs/models/providers/abacus.md +24 -14
- package/.docs/models/providers/aihubmix.md +10 -5
- package/.docs/models/providers/alibaba-cn.md +83 -74
- package/.docs/models/providers/alibaba-coding-plan-cn.md +78 -0
- package/.docs/models/providers/alibaba-coding-plan.md +78 -0
- package/.docs/models/providers/alibaba.md +3 -3
- package/.docs/models/providers/anthropic.md +4 -4
- package/.docs/models/providers/bailing.md +3 -3
- package/.docs/models/providers/baseten.md +3 -3
- package/.docs/models/providers/berget.md +3 -3
- package/.docs/models/providers/cerebras.md +4 -4
- package/.docs/models/providers/chutes.md +7 -6
- package/.docs/models/providers/clarifai.md +81 -0
- package/.docs/models/providers/cloudferro-sherlock.md +8 -7
- package/.docs/models/providers/cloudflare-workers-ai.md +6 -5
- package/.docs/models/providers/cortecs.md +10 -8
- package/.docs/models/providers/deepinfra.md +11 -6
- package/.docs/models/providers/deepseek.md +4 -4
- package/.docs/models/providers/drun.md +73 -0
- package/.docs/models/providers/evroc.md +3 -3
- package/.docs/models/providers/fastrouter.md +3 -3
- package/.docs/models/providers/fireworks-ai.md +3 -3
- package/.docs/models/providers/firmware.md +31 -23
- package/.docs/models/providers/friendli.md +3 -3
- package/.docs/models/providers/github-models.md +3 -3
- package/.docs/models/providers/google.md +7 -5
- package/.docs/models/providers/groq.md +4 -4
- package/.docs/models/providers/helicone.md +3 -3
- package/.docs/models/providers/huggingface.md +3 -3
- package/.docs/models/providers/iflowcn.md +3 -3
- package/.docs/models/providers/inception.md +7 -5
- package/.docs/models/providers/inference.md +3 -3
- package/.docs/models/providers/io-net.md +3 -3
- package/.docs/models/providers/jiekou.md +3 -3
- package/.docs/models/providers/kilo.md +6 -4
- package/.docs/models/providers/kimi-for-coding.md +4 -4
- package/.docs/models/providers/kuae-cloud-coding-plan.md +3 -3
- package/.docs/models/providers/llama.md +3 -3
- package/.docs/models/providers/lmstudio.md +3 -3
- package/.docs/models/providers/lucidquery.md +3 -3
- package/.docs/models/providers/meganova.md +3 -3
- package/.docs/models/providers/minimax-cn-coding-plan.md +4 -4
- package/.docs/models/providers/minimax-cn.md +4 -4
- package/.docs/models/providers/minimax-coding-plan.md +4 -4
- package/.docs/models/providers/minimax.md +4 -4
- package/.docs/models/providers/mistral.md +4 -4
- package/.docs/models/providers/moark.md +3 -3
- package/.docs/models/providers/modelscope.md +3 -3
- package/.docs/models/providers/moonshotai-cn.md +3 -3
- package/.docs/models/providers/moonshotai.md +3 -3
- package/.docs/models/providers/morph.md +3 -3
- package/.docs/models/providers/nano-gpt.md +523 -42
- package/.docs/models/providers/nebius.md +37 -37
- package/.docs/models/providers/nova.md +3 -3
- package/.docs/models/providers/novita-ai.md +3 -3
- package/.docs/models/providers/nvidia.md +7 -5
- package/.docs/models/providers/ollama-cloud.md +4 -5
- package/.docs/models/providers/openai.md +7 -5
- package/.docs/models/providers/opencode-go.md +3 -3
- package/.docs/models/providers/opencode.md +39 -36
- package/.docs/models/providers/ovhcloud.md +3 -3
- package/.docs/models/providers/perplexity-agent.md +4 -4
- package/.docs/models/providers/perplexity.md +4 -4
- package/.docs/models/providers/poe.md +11 -5
- package/.docs/models/providers/privatemode-ai.md +3 -3
- package/.docs/models/providers/qihang-ai.md +3 -3
- package/.docs/models/providers/qiniu-ai.md +23 -8
- package/.docs/models/providers/requesty.md +20 -4
- package/.docs/models/providers/scaleway.md +3 -3
- package/.docs/models/providers/siliconflow-cn.md +10 -4
- package/.docs/models/providers/siliconflow.md +3 -3
- package/.docs/models/providers/stackit.md +3 -3
- package/.docs/models/providers/stepfun.md +3 -3
- package/.docs/models/providers/submodel.md +3 -3
- package/.docs/models/providers/synthetic.md +3 -3
- package/.docs/models/providers/togetherai.md +5 -7
- package/.docs/models/providers/upstage.md +3 -3
- package/.docs/models/providers/vivgrid.md +4 -4
- package/.docs/models/providers/vultr.md +3 -3
- package/.docs/models/providers/wandb.md +3 -3
- package/.docs/models/providers/xai.md +34 -31
- package/.docs/models/providers/xiaomi.md +4 -4
- package/.docs/models/providers/zai-coding-plan.md +3 -3
- package/.docs/models/providers/zai.md +3 -3
- package/.docs/models/providers/zenmux.md +7 -5
- package/.docs/models/providers/zhipuai-coding-plan.md +3 -3
- package/.docs/models/providers/zhipuai.md +3 -3
- package/.docs/models/providers.md +4 -0
- package/.docs/reference/agents/agent.md +3 -3
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/getDescription.md +1 -1
- package/.docs/reference/agents/network.md +5 -3
- package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
- package/.docs/reference/ai-sdk/network-route.md +2 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
- package/.docs/reference/auth/auth0.md +7 -7
- package/.docs/reference/auth/better-auth.md +2 -2
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +5 -5
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +6 -6
- package/.docs/reference/cli/mastra.md +5 -5
- package/.docs/reference/client-js/agents.md +22 -22
- package/.docs/reference/client-js/error-handling.md +2 -2
- package/.docs/reference/client-js/logs.md +2 -2
- package/.docs/reference/client-js/mastra-client.md +2 -2
- package/.docs/reference/client-js/memory.md +6 -6
- package/.docs/reference/client-js/observability.md +4 -4
- package/.docs/reference/client-js/telemetry.md +1 -1
- package/.docs/reference/client-js/tools.md +3 -3
- package/.docs/reference/client-js/vectors.md +2 -2
- package/.docs/reference/client-js/workflows.md +12 -12
- package/.docs/reference/configuration.md +62 -6
- package/.docs/reference/core/getDeployer.md +1 -1
- package/.docs/reference/core/getGatewayById.md +1 -1
- package/.docs/reference/core/getLogger.md +1 -1
- package/.docs/reference/core/getMCPServer.md +2 -2
- package/.docs/reference/core/getMCPServerById.md +2 -2
- package/.docs/reference/core/getMemory.md +1 -1
- package/.docs/reference/core/getScorer.md +4 -4
- package/.docs/reference/core/getScorerById.md +2 -2
- package/.docs/reference/core/getServer.md +1 -1
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getStoredAgentById.md +3 -3
- package/.docs/reference/core/getTelemetry.md +1 -1
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listAgents.md +1 -1
- package/.docs/reference/core/listMCPServers.md +3 -3
- package/.docs/reference/core/listMemory.md +1 -1
- package/.docs/reference/core/listScorers.md +1 -1
- package/.docs/reference/core/listStoredAgents.md +3 -3
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/core/mastra-model-gateway.md +11 -11
- package/.docs/reference/core/setLogger.md +1 -1
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/dataset.md +2 -2
- package/.docs/reference/datasets/datasets-manager.md +1 -1
- package/.docs/reference/datasets/get.md +2 -2
- package/.docs/reference/datasets/getDetails.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/vercel.md +1 -1
- package/.docs/reference/deployer.md +4 -4
- package/.docs/reference/evals/answer-relevancy.md +4 -4
- package/.docs/reference/evals/answer-similarity.md +3 -3
- package/.docs/reference/evals/bias.md +4 -4
- package/.docs/reference/evals/completeness.md +6 -6
- package/.docs/reference/evals/content-similarity.md +3 -3
- package/.docs/reference/evals/context-precision.md +9 -9
- package/.docs/reference/evals/context-relevance.md +7 -7
- package/.docs/reference/evals/create-scorer.md +7 -7
- package/.docs/reference/evals/faithfulness.md +3 -3
- package/.docs/reference/evals/hallucination.md +8 -14
- package/.docs/reference/evals/keyword-coverage.md +4 -4
- package/.docs/reference/evals/mastra-scorer.md +7 -7
- package/.docs/reference/evals/noise-sensitivity.md +11 -11
- package/.docs/reference/evals/prompt-alignment.md +5 -5
- package/.docs/reference/evals/run-evals.md +5 -5
- package/.docs/reference/evals/scorer-utils.md +17 -17
- package/.docs/reference/evals/textual-difference.md +4 -4
- package/.docs/reference/evals/tone-consistency.md +5 -5
- package/.docs/reference/evals/tool-call-accuracy.md +10 -10
- package/.docs/reference/evals/toxicity.md +3 -3
- package/.docs/reference/harness/harness-class.md +5 -3
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/memory/clone-utilities.md +7 -7
- package/.docs/reference/memory/cloneThread.md +5 -5
- package/.docs/reference/memory/createThread.md +1 -1
- package/.docs/reference/memory/deleteMessages.md +1 -1
- package/.docs/reference/memory/getThreadById.md +1 -1
- package/.docs/reference/memory/listThreads.md +3 -3
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +8 -6
- package/.docs/reference/memory/recall.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +6 -6
- package/.docs/reference/observability/tracing/configuration.md +17 -17
- package/.docs/reference/observability/tracing/exporters/arize.md +4 -4
- package/.docs/reference/observability/tracing/exporters/braintrust.md +3 -3
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +4 -4
- package/.docs/reference/observability/tracing/exporters/datadog.md +4 -4
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/laminar.md +2 -2
- package/.docs/reference/observability/tracing/exporters/langfuse.md +4 -4
- package/.docs/reference/observability/tracing/exporters/langsmith.md +6 -6
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -12
- package/.docs/reference/observability/tracing/exporters/posthog.md +3 -3
- package/.docs/reference/observability/tracing/exporters/sentry.md +5 -5
- package/.docs/reference/observability/tracing/instances.md +9 -9
- package/.docs/reference/observability/tracing/interfaces.md +39 -39
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +6 -6
- package/.docs/reference/observability/tracing/spans.md +15 -13
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +21 -17
- package/.docs/reference/processors/token-limiter-processor.md +2 -2
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/rag/database-config.md +8 -8
- package/.docs/reference/rag/document.md +11 -11
- package/.docs/reference/rag/embeddings.md +5 -5
- package/.docs/reference/rag/extract-params.md +8 -8
- package/.docs/reference/rag/graph-rag.md +4 -4
- package/.docs/reference/rag/metadata-filters.md +15 -15
- package/.docs/reference/rag/rerank.md +2 -2
- package/.docs/reference/rag/rerankWithScorer.md +2 -2
- package/.docs/reference/server/create-route.md +2 -0
- package/.docs/reference/server/express-adapter.md +1 -1
- package/.docs/reference/server/fastify-adapter.md +1 -1
- package/.docs/reference/server/hono-adapter.md +1 -1
- package/.docs/reference/server/koa-adapter.md +2 -2
- package/.docs/reference/server/mastra-server.md +16 -16
- package/.docs/reference/server/register-api-route.md +7 -7
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/storage/cloudflare-d1.md +5 -5
- package/.docs/reference/storage/cloudflare.md +3 -3
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +6 -6
- package/.docs/reference/storage/dynamodb.md +7 -7
- package/.docs/reference/storage/lance.md +5 -5
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/mongodb.md +6 -6
- package/.docs/reference/storage/mssql.md +4 -4
- package/.docs/reference/storage/overview.md +2 -2
- package/.docs/reference/storage/postgresql.md +7 -7
- package/.docs/reference/storage/upstash.md +4 -4
- package/.docs/reference/streaming/ChunkType.md +13 -13
- package/.docs/reference/streaming/agents/MastraModelOutput.md +6 -6
- package/.docs/reference/streaming/agents/stream.md +2 -2
- package/.docs/reference/streaming/agents/streamLegacy.md +1 -1
- package/.docs/reference/streaming/workflows/observeStream.md +2 -2
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/templates/overview.md +4 -4
- package/.docs/reference/tools/create-tool.md +10 -10
- package/.docs/reference/tools/document-chunker-tool.md +4 -4
- package/.docs/reference/tools/graph-rag-tool.md +7 -7
- package/.docs/reference/tools/mcp-client.md +13 -13
- package/.docs/reference/tools/mcp-server.md +27 -27
- package/.docs/reference/tools/vector-query-tool.md +12 -12
- package/.docs/reference/vectors/astra.md +13 -13
- package/.docs/reference/vectors/chroma.md +18 -18
- package/.docs/reference/vectors/convex.md +15 -15
- package/.docs/reference/vectors/couchbase.md +21 -21
- package/.docs/reference/vectors/duckdb.md +17 -17
- package/.docs/reference/vectors/elasticsearch.md +14 -14
- package/.docs/reference/vectors/lance.md +22 -22
- package/.docs/reference/vectors/libsql.md +15 -15
- package/.docs/reference/vectors/mongodb.md +18 -18
- package/.docs/reference/vectors/opensearch.md +11 -11
- package/.docs/reference/vectors/pg.md +23 -21
- package/.docs/reference/vectors/pinecone.md +15 -15
- package/.docs/reference/vectors/qdrant.md +15 -15
- package/.docs/reference/vectors/s3vectors.md +22 -22
- package/.docs/reference/vectors/turbopuffer.md +14 -14
- package/.docs/reference/vectors/upstash.md +15 -15
- package/.docs/reference/vectors/vectorize.md +16 -16
- package/.docs/reference/voice/azure.md +12 -10
- package/.docs/reference/voice/cloudflare.md +9 -7
- package/.docs/reference/voice/composite-voice.md +5 -5
- package/.docs/reference/voice/deepgram.md +5 -5
- package/.docs/reference/voice/elevenlabs.md +7 -7
- package/.docs/reference/voice/google-gemini-live.md +22 -22
- package/.docs/reference/voice/google.md +12 -12
- package/.docs/reference/voice/mastra-voice.md +18 -18
- package/.docs/reference/voice/murf.md +8 -8
- package/.docs/reference/voice/openai-realtime.md +19 -17
- package/.docs/reference/voice/openai.md +12 -8
- package/.docs/reference/voice/playai.md +9 -7
- package/.docs/reference/voice/sarvam.md +8 -6
- package/.docs/reference/voice/speechify.md +11 -9
- package/.docs/reference/voice/voice.addInstructions.md +4 -4
- package/.docs/reference/voice/voice.addTools.md +3 -3
- package/.docs/reference/voice/voice.answer.md +2 -2
- package/.docs/reference/voice/voice.close.md +4 -4
- package/.docs/reference/voice/voice.connect.md +9 -7
- package/.docs/reference/voice/voice.events.md +4 -4
- package/.docs/reference/voice/voice.getSpeakers.md +4 -4
- package/.docs/reference/voice/voice.listen.md +17 -11
- package/.docs/reference/voice/voice.off.md +4 -4
- package/.docs/reference/voice/voice.on.md +5 -5
- package/.docs/reference/voice/voice.send.md +2 -2
- package/.docs/reference/voice/voice.speak.md +19 -9
- package/.docs/reference/voice/voice.updateConfig.md +4 -4
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/run.md +3 -3
- package/.docs/reference/workflows/step.md +2 -2
- package/.docs/reference/workflows/workflow-methods/create-run.md +1 -1
- package/.docs/reference/workflows/workflow.md +1 -1
- package/.docs/reference/workspace/blaxel-sandbox.md +164 -0
- package/.docs/reference/workspace/daytona-sandbox.md +50 -141
- package/.docs/reference/workspace/e2b-sandbox.md +41 -77
- package/.docs/reference/workspace/filesystem.md +25 -11
- package/.docs/reference/workspace/gcs-filesystem.md +21 -1
- package/.docs/reference/workspace/local-filesystem.md +24 -10
- package/.docs/reference/workspace/local-sandbox.md +27 -102
- package/.docs/reference/workspace/process-manager.md +296 -0
- package/.docs/reference/workspace/s3-filesystem.md +21 -1
- package/.docs/reference/workspace/sandbox.md +9 -1
- package/.docs/reference/workspace/workspace-class.md +95 -27
- package/CHANGELOG.md +15 -0
- package/dist/tools/course.d.ts +7 -27
- package/dist/tools/course.d.ts.map +1 -1
- package/dist/tools/docs.d.ts +6 -18
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/embedded-docs.d.ts +12 -112
- package/dist/tools/embedded-docs.d.ts.map +1 -1
- package/dist/tools/migration.d.ts +6 -26
- package/dist/tools/migration.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -22,7 +22,7 @@ constructor({
|
|
|
22
22
|
|
|
23
23
|
**timeout** (`number`): Global timeout value in milliseconds for all servers unless overridden in individual server configs. (Default: `60000`)
|
|
24
24
|
|
|
25
|
-
### MastraMCPServerDefinition
|
|
25
|
+
### `MastraMCPServerDefinition`
|
|
26
26
|
|
|
27
27
|
Each server in the `servers` map is configured using the `MastraMCPServerDefinition` type. The transport type is detected based on the provided parameters:
|
|
28
28
|
|
|
@@ -55,7 +55,7 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
|
|
|
55
55
|
|
|
56
56
|
## Methods
|
|
57
57
|
|
|
58
|
-
### listTools()
|
|
58
|
+
### `listTools()`
|
|
59
59
|
|
|
60
60
|
Retrieves all tools from all configured servers, with tool names namespaced by their server name (in the format `serverName_toolName`) to prevent conflicts. Intended to be passed onto an Agent definition.
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ Retrieves all tools from all configured servers, with tool names namespaced by t
|
|
|
63
63
|
new Agent({ id: 'agent', tools: await mcp.listTools() })
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
### listToolsets()
|
|
66
|
+
### `listToolsets()`
|
|
67
67
|
|
|
68
68
|
Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations. Intended to be passed dynamically into the generate or stream method.
|
|
69
69
|
|
|
@@ -73,7 +73,7 @@ const res = await agent.stream(prompt, {
|
|
|
73
73
|
})
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
### disconnect()
|
|
76
|
+
### `disconnect()`
|
|
77
77
|
|
|
78
78
|
Disconnects from all MCP servers and cleans up resources.
|
|
79
79
|
|
|
@@ -239,7 +239,7 @@ mcpClient.elicitation.onRequest('serverName', async request => {
|
|
|
239
239
|
|
|
240
240
|
Sets up a handler function that will be called when any connected MCP server sends an elicitation request. The handler receives the request and must return a response.
|
|
241
241
|
|
|
242
|
-
##### ElicitationHandler Function
|
|
242
|
+
##### `ElicitationHandler` Function
|
|
243
243
|
|
|
244
244
|
The handler function receives a request object with:
|
|
245
245
|
|
|
@@ -534,7 +534,7 @@ mcpClient.elicitation.onRequest('interactiveServer', async request => {
|
|
|
534
534
|
})
|
|
535
535
|
```
|
|
536
536
|
|
|
537
|
-
### Response
|
|
537
|
+
### Response types
|
|
538
538
|
|
|
539
539
|
Your elicitation handler must return one of three response types:
|
|
540
540
|
|
|
@@ -592,7 +592,7 @@ await mcpClient.elicitation.onRequest('interactiveServer', async request => {
|
|
|
592
592
|
})
|
|
593
593
|
```
|
|
594
594
|
|
|
595
|
-
### Best
|
|
595
|
+
### Best practices
|
|
596
596
|
|
|
597
597
|
- **Always handle elicitation**: Set up your handler before calling tools that might use elicitation
|
|
598
598
|
- **Validate input**: Check that required fields are provided
|
|
@@ -600,7 +600,7 @@ await mcpClient.elicitation.onRequest('interactiveServer', async request => {
|
|
|
600
600
|
- **Clear UI**: Make it obvious what information is being requested and why
|
|
601
601
|
- **Security**: Never auto-accept requests for sensitive information
|
|
602
602
|
|
|
603
|
-
## OAuth
|
|
603
|
+
## OAuth authentication
|
|
604
604
|
|
|
605
605
|
For connecting to MCP servers that require OAuth authentication per the [MCP Auth Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization), use the `MCPOAuthClientProvider`:
|
|
606
606
|
|
|
@@ -819,7 +819,7 @@ const response = await agent.stream('How is AAPL doing and what is the weather?'
|
|
|
819
819
|
})
|
|
820
820
|
```
|
|
821
821
|
|
|
822
|
-
## Instance
|
|
822
|
+
## Instance management
|
|
823
823
|
|
|
824
824
|
The `MCPClient` class includes built-in memory leak prevention for managing multiple instances:
|
|
825
825
|
|
|
@@ -863,7 +863,7 @@ const mcp4 = new MCPClient({
|
|
|
863
863
|
})
|
|
864
864
|
```
|
|
865
865
|
|
|
866
|
-
## Server
|
|
866
|
+
## Server lifecycle
|
|
867
867
|
|
|
868
868
|
MCPClient handles server connections gracefully:
|
|
869
869
|
|
|
@@ -871,7 +871,7 @@ MCPClient handles server connections gracefully:
|
|
|
871
871
|
2. Graceful server shutdown to prevent error messages during development
|
|
872
872
|
3. Proper cleanup of resources when disconnecting
|
|
873
873
|
|
|
874
|
-
## Using
|
|
874
|
+
## Using custom fetch for dynamic authentication
|
|
875
875
|
|
|
876
876
|
For HTTP servers, you can provide a custom `fetch` function to handle dynamic authentication, request interception, or other custom behavior. This is particularly useful when you need to refresh tokens on each request or forward user credentials from the incoming request to the MCP server.
|
|
877
877
|
|
|
@@ -910,7 +910,7 @@ await agent.generate('Hello!', {
|
|
|
910
910
|
})
|
|
911
911
|
```
|
|
912
912
|
|
|
913
|
-
## Using SSE
|
|
913
|
+
## Using SSE request headers
|
|
914
914
|
|
|
915
915
|
When using the legacy SSE MCP transport, you must configure both `requestInit` and `eventSourceInit` due to a bug in the MCP SDK. Alternatively, you can use a custom `fetch` function which will be automatically used for both POST requests and SSE connections:
|
|
916
916
|
|
|
@@ -959,7 +959,7 @@ const sseClientWithFetch = new MCPClient({
|
|
|
959
959
|
})
|
|
960
960
|
```
|
|
961
961
|
|
|
962
|
-
## Related
|
|
962
|
+
## Related information
|
|
963
963
|
|
|
964
964
|
- For creating MCP servers, see the [MCPServer documentation](https://mastra.ai/reference/tools/mcp-server).
|
|
965
965
|
- For more about the Model Context Protocol, see the [@modelcontextprotocol/sdk documentation](https://github.com/modelcontextprotocol/typescript-sdk).
|
|
@@ -83,7 +83,7 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
|
|
|
83
83
|
|
|
84
84
|
**prompts** (`MCPServerPrompts`): An object defining how the server should handle MCP prompts. See Prompt Handling section for details.
|
|
85
85
|
|
|
86
|
-
## Exposing
|
|
86
|
+
## Exposing agents as tools
|
|
87
87
|
|
|
88
88
|
A powerful feature of `MCPServer` is its ability to automatically expose your Mastra Agents as callable tools. When you provide agents in the `agents` property of the configuration:
|
|
89
89
|
|
|
@@ -96,9 +96,9 @@ A powerful feature of `MCPServer` is its ability to automatically expose your Ma
|
|
|
96
96
|
- **Execution**: When this tool is called, it invokes the `generate()` method of the corresponding agent, passing the provided `query`.
|
|
97
97
|
- **Output**: The direct result from the agent's `generate()` method is returned as the output of the tool.
|
|
98
98
|
|
|
99
|
-
- **Name Collisions**: If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., you have a tool named `ask_myAgentKey` and also an agent with the key `myAgentKey`), the _explicitly defined tool will take precedence_. The agent
|
|
99
|
+
- **Name Collisions**: If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., you have a tool named `ask_myAgentKey` and also an agent with the key `myAgentKey`), the _explicitly defined tool will take precedence_. The agent won't be converted into a tool in this conflicting case, and a warning will be logged.
|
|
100
100
|
|
|
101
|
-
This makes it straightforward to allow MCP clients to interact with your agents using natural language queries,
|
|
101
|
+
This makes it straightforward to allow MCP clients to interact with your agents using natural language queries, like any other tool.
|
|
102
102
|
|
|
103
103
|
### Agent-to-Tool Conversion
|
|
104
104
|
|
|
@@ -164,7 +164,7 @@ const fetchUserData = createTool({
|
|
|
164
164
|
|
|
165
165
|
These are the functions you can call on an `MCPServer` instance to control its behavior and get information.
|
|
166
166
|
|
|
167
|
-
### startStdio()
|
|
167
|
+
### `startStdio()`
|
|
168
168
|
|
|
169
169
|
Use this method to start the server so it communicates using standard input and output (stdio). This is typical when running the server as a command-line program.
|
|
170
170
|
|
|
@@ -186,7 +186,7 @@ const server = new MCPServer({
|
|
|
186
186
|
await server.startStdio()
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
### startSSE()
|
|
189
|
+
### `startSSE()`
|
|
190
190
|
|
|
191
191
|
This method helps you integrate the MCP server with an existing web server to use Server-Sent Events (SSE) for communication. You'll call this from your web server's code when it receives a request for the SSE or message paths.
|
|
192
192
|
|
|
@@ -238,7 +238,7 @@ Here are the details for the values needed by the `startSSE` method:
|
|
|
238
238
|
|
|
239
239
|
**res** (`any`): The response object from your web server, used to send data back.
|
|
240
240
|
|
|
241
|
-
### startHonoSSE()
|
|
241
|
+
### `startHonoSSE()`
|
|
242
242
|
|
|
243
243
|
This method helps you integrate the MCP server with an existing web server to use Server-Sent Events (SSE) for communication. You'll call this from your web server's code when it receives a request for the SSE or message paths.
|
|
244
244
|
|
|
@@ -290,7 +290,7 @@ Here are the details for the values needed by the `startHonoSSE` method:
|
|
|
290
290
|
|
|
291
291
|
**res** (`any`): The response object from your web server, used to send data back.
|
|
292
292
|
|
|
293
|
-
### startHTTP()
|
|
293
|
+
### `startHTTP()`
|
|
294
294
|
|
|
295
295
|
This method helps you integrate the MCP server with an existing web server to use streamable HTTP for communication. You'll call this from your web server's code when it receives HTTP requests.
|
|
296
296
|
|
|
@@ -391,7 +391,7 @@ serve(async req => {
|
|
|
391
391
|
>
|
|
392
392
|
> The serverless mode disables session management and creates fresh server instances per request, which is necessary for stateless environments where memory doesn't persist between invocations.
|
|
393
393
|
>
|
|
394
|
-
> **Note:** The following MCP features require session state or persistent connections and
|
|
394
|
+
> **Note:** The following MCP features require session state or persistent connections and **won't work** in serverless mode:
|
|
395
395
|
>
|
|
396
396
|
> - **Elicitation** - Interactive user input requests during tool execution require session management to route responses back to the correct client
|
|
397
397
|
> - **Resource subscriptions** - `resources/subscribe` and `resources/unsubscribe` need persistent connections to maintain subscription state
|
|
@@ -424,7 +424,7 @@ The `StreamableHTTPServerTransportOptions` object allows you to customize the be
|
|
|
424
424
|
|
|
425
425
|
**eventStore** (`EventStore`): An event store for message resumability. Providing this enables clients to reconnect and resume message streams.
|
|
426
426
|
|
|
427
|
-
### close()
|
|
427
|
+
### `close()`
|
|
428
428
|
|
|
429
429
|
This method closes the server and releases all resources.
|
|
430
430
|
|
|
@@ -432,7 +432,7 @@ This method closes the server and releases all resources.
|
|
|
432
432
|
async close(): Promise<void>
|
|
433
433
|
```
|
|
434
434
|
|
|
435
|
-
### getServerInfo()
|
|
435
|
+
### `getServerInfo()`
|
|
436
436
|
|
|
437
437
|
This method gives you a look at the server's basic information.
|
|
438
438
|
|
|
@@ -440,7 +440,7 @@ This method gives you a look at the server's basic information.
|
|
|
440
440
|
getServerInfo(): ServerInfo
|
|
441
441
|
```
|
|
442
442
|
|
|
443
|
-
### getServerDetail()
|
|
443
|
+
### `getServerDetail()`
|
|
444
444
|
|
|
445
445
|
This method gives you a detailed look at the server's information.
|
|
446
446
|
|
|
@@ -448,7 +448,7 @@ This method gives you a detailed look at the server's information.
|
|
|
448
448
|
getServerDetail(): ServerDetail
|
|
449
449
|
```
|
|
450
450
|
|
|
451
|
-
### getToolListInfo()
|
|
451
|
+
### `getToolListInfo()`
|
|
452
452
|
|
|
453
453
|
This method gives you a look at the tools that were set up when you created the server. It's a read-only list, useful for debugging purposes.
|
|
454
454
|
|
|
@@ -456,7 +456,7 @@ This method gives you a look at the tools that were set up when you created the
|
|
|
456
456
|
getToolListInfo(): ToolListInfo
|
|
457
457
|
```
|
|
458
458
|
|
|
459
|
-
### getToolInfo()
|
|
459
|
+
### `getToolInfo()`
|
|
460
460
|
|
|
461
461
|
This method gives you detailed information about a specific tool.
|
|
462
462
|
|
|
@@ -464,7 +464,7 @@ This method gives you detailed information about a specific tool.
|
|
|
464
464
|
getToolInfo(toolName: string): ToolInfo
|
|
465
465
|
```
|
|
466
466
|
|
|
467
|
-
### executeTool()
|
|
467
|
+
### `executeTool()`
|
|
468
468
|
|
|
469
469
|
This method executes a specific tool and returns the result.
|
|
470
470
|
|
|
@@ -472,7 +472,7 @@ This method executes a specific tool and returns the result.
|
|
|
472
472
|
executeTool(toolName: string, input: any): Promise<any>
|
|
473
473
|
```
|
|
474
474
|
|
|
475
|
-
### getStdioTransport()
|
|
475
|
+
### `getStdioTransport()`
|
|
476
476
|
|
|
477
477
|
If you started the server with `startStdio()`, you can use this to get the object that manages the stdio communication. This is mostly for checking things internally or for testing.
|
|
478
478
|
|
|
@@ -480,7 +480,7 @@ If you started the server with `startStdio()`, you can use this to get the objec
|
|
|
480
480
|
getStdioTransport(): StdioServerTransport | undefined
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
### getSseTransport()
|
|
483
|
+
### `getSseTransport()`
|
|
484
484
|
|
|
485
485
|
If you started the server with `startSSE()`, you can use this to get the object that manages the SSE communication. Like `getStdioTransport`, this is mainly for internal checks or testing.
|
|
486
486
|
|
|
@@ -488,7 +488,7 @@ If you started the server with `startSSE()`, you can use this to get the object
|
|
|
488
488
|
getSseTransport(): SSEServerTransport | undefined
|
|
489
489
|
```
|
|
490
490
|
|
|
491
|
-
### getSseHonoTransport()
|
|
491
|
+
### `getSseHonoTransport()`
|
|
492
492
|
|
|
493
493
|
If you started the server with `startHonoSSE()`, you can use this to get the object that manages the SSE communication. Like `getSseTransport`, this is mainly for internal checks or testing.
|
|
494
494
|
|
|
@@ -496,7 +496,7 @@ If you started the server with `startHonoSSE()`, you can use this to get the obj
|
|
|
496
496
|
getSseHonoTransport(): SSETransport | undefined
|
|
497
497
|
```
|
|
498
498
|
|
|
499
|
-
### getStreamableHTTPTransport()
|
|
499
|
+
### `getStreamableHTTPTransport()`
|
|
500
500
|
|
|
501
501
|
If you started the server with `startHTTP()`, you can use this to get the object that manages the HTTP communication. Like `getSseTransport`, this is mainly for internal checks or testing.
|
|
502
502
|
|
|
@@ -504,7 +504,7 @@ If you started the server with `startHTTP()`, you can use this to get the object
|
|
|
504
504
|
getStreamableHTTPTransport(): StreamableHTTPServerTransport | undefined
|
|
505
505
|
```
|
|
506
506
|
|
|
507
|
-
### tools()
|
|
507
|
+
### `tools()`
|
|
508
508
|
|
|
509
509
|
Executes a specific tool provided by this MCP server.
|
|
510
510
|
|
|
@@ -522,7 +522,7 @@ async executeTool(
|
|
|
522
522
|
|
|
523
523
|
**executionContext** (`object`): Optional context for the tool execution, like messages or a toolCallId.
|
|
524
524
|
|
|
525
|
-
## Resource
|
|
525
|
+
## Resource handling
|
|
526
526
|
|
|
527
527
|
### What are MCP Resources?
|
|
528
528
|
|
|
@@ -649,7 +649,7 @@ Example:
|
|
|
649
649
|
await serverWithResources.resources.notifyListChanged()
|
|
650
650
|
```
|
|
651
651
|
|
|
652
|
-
## Prompt
|
|
652
|
+
## Prompt handling
|
|
653
653
|
|
|
654
654
|
### What are MCP Prompts?
|
|
655
655
|
|
|
@@ -758,7 +758,7 @@ Call this method when the overall list of available prompts has changed (e.g., a
|
|
|
758
758
|
await serverWithPrompts.prompts.notifyListChanged()
|
|
759
759
|
```
|
|
760
760
|
|
|
761
|
-
### Best
|
|
761
|
+
### Best practices for Prompt Handling
|
|
762
762
|
|
|
763
763
|
- Use clear, descriptive prompt names and descriptions.
|
|
764
764
|
- Validate all required arguments in `getPromptMessages`.
|
|
@@ -778,7 +778,7 @@ The example at the beginning of this page also demonstrates how to instantiate `
|
|
|
778
778
|
|
|
779
779
|
## Elicitation
|
|
780
780
|
|
|
781
|
-
### What
|
|
781
|
+
### What's Elicitation?
|
|
782
782
|
|
|
783
783
|
Elicitation is a feature in the Model Context Protocol (MCP) that allows servers to request structured information from users. This enables interactive workflows where servers can collect additional data dynamically.
|
|
784
784
|
|
|
@@ -982,7 +982,7 @@ type ElicitResult = {
|
|
|
982
982
|
}
|
|
983
983
|
```
|
|
984
984
|
|
|
985
|
-
## OAuth
|
|
985
|
+
## OAuth protection
|
|
986
986
|
|
|
987
987
|
To protect your MCP server with OAuth authentication per the [MCP Auth Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization), use the `createOAuthMiddleware` function:
|
|
988
988
|
|
|
@@ -1085,11 +1085,11 @@ const customMiddleware = createOAuthMiddleware({
|
|
|
1085
1085
|
|
|
1086
1086
|
**mcpPath** (`string`): Path where the MCP endpoint is served. Only requests to this path require authentication. (Default: `'/mcp'`)
|
|
1087
1087
|
|
|
1088
|
-
## Authentication
|
|
1088
|
+
## Authentication context
|
|
1089
1089
|
|
|
1090
1090
|
Tools can access request metadata via `context.mcp.extra` when using HTTP-based transports. This allows you to pass authentication info, user context, or any custom data from your HTTP middleware to your MCP tools.
|
|
1091
1091
|
|
|
1092
|
-
### How
|
|
1092
|
+
### How it works
|
|
1093
1093
|
|
|
1094
1094
|
Whatever you set on `req.auth` in your HTTP middleware becomes available as `context.mcp.extra.authInfo` in your tools:
|
|
1095
1095
|
|
|
@@ -1265,7 +1265,7 @@ app.all('/mcp', async (req, res) => {
|
|
|
1265
1265
|
app.listen(3000)
|
|
1266
1266
|
```
|
|
1267
1267
|
|
|
1268
|
-
## Related
|
|
1268
|
+
## Related information
|
|
1269
1269
|
|
|
1270
1270
|
- For connecting to MCP servers in Mastra, see the [MCPClient documentation](https://mastra.ai/reference/tools/mcp-client).
|
|
1271
1271
|
- For more about the Model Context Protocol, see the [@modelcontextprotocol/sdk documentation](https://github.com/modelcontextprotocol/typescript-sdk).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `createVectorQueryTool()` function creates a tool for semantic search over vector stores. It supports filtering, reranking, database-specific configurations, and integrates with various vector store backends.
|
|
4
4
|
|
|
5
|
-
## Basic
|
|
5
|
+
## Basic usage
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
import { createVectorQueryTool } from '@mastra/rag'
|
|
@@ -79,7 +79,7 @@ The tool returns an object with:
|
|
|
79
79
|
|
|
80
80
|
**sources** (`QueryResult[]`): Array of full retrieval result objects. Each object contains all information needed to reference the original document, chunk, and similarity score.
|
|
81
81
|
|
|
82
|
-
### QueryResult object structure
|
|
82
|
+
### `QueryResult` object structure
|
|
83
83
|
|
|
84
84
|
```typescript
|
|
85
85
|
{
|
|
@@ -91,7 +91,7 @@ The tool returns an object with:
|
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
## Default
|
|
94
|
+
## Default tool description
|
|
95
95
|
|
|
96
96
|
The default description focuses on:
|
|
97
97
|
|
|
@@ -99,11 +99,11 @@ The default description focuses on:
|
|
|
99
99
|
- Answering user questions
|
|
100
100
|
- Retrieving factual content
|
|
101
101
|
|
|
102
|
-
## Result
|
|
102
|
+
## Result handling
|
|
103
103
|
|
|
104
104
|
The tool determines the number of results to return based on the user's query, with a default of 10 results. This can be adjusted based on the query requirements.
|
|
105
105
|
|
|
106
|
-
## Example with
|
|
106
|
+
## Example with filters
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
109
|
const queryTool = createVectorQueryTool({
|
|
@@ -134,7 +134,7 @@ For detailed filter syntax and store-specific capabilities, see the [Metadata Fi
|
|
|
134
134
|
|
|
135
135
|
For an example of how agent-driven filtering works, see the [Agent-Driven Metadata Filtering](https://github.com/mastra-ai/mastra/tree/main/examples/basics/rag/filter-rag) example.
|
|
136
136
|
|
|
137
|
-
## Example with
|
|
137
|
+
## Example with reranking
|
|
138
138
|
|
|
139
139
|
```typescript
|
|
140
140
|
const queryTool = createVectorQueryTool({
|
|
@@ -164,7 +164,7 @@ Reranking improves result quality by combining:
|
|
|
164
164
|
|
|
165
165
|
The reranker processes the initial vector search results and returns a reordered list optimized for relevance.
|
|
166
166
|
|
|
167
|
-
## Example with
|
|
167
|
+
## Example with custom description
|
|
168
168
|
|
|
169
169
|
```typescript
|
|
170
170
|
const queryTool = createVectorQueryTool({
|
|
@@ -178,7 +178,7 @@ const queryTool = createVectorQueryTool({
|
|
|
178
178
|
|
|
179
179
|
This example shows how to customize the tool description for a specific use case while maintaining its core purpose of information retrieval.
|
|
180
180
|
|
|
181
|
-
## Database-
|
|
181
|
+
## Database-specific configuration examples
|
|
182
182
|
|
|
183
183
|
The `databaseConfig` parameter allows you to leverage unique features and optimizations specific to each vector database. These configurations are automatically applied during query execution.
|
|
184
184
|
|
|
@@ -335,7 +335,7 @@ This approach allows you to:
|
|
|
335
335
|
- Adjust performance parameters based on load
|
|
336
336
|
- Apply different filtering strategies per request
|
|
337
337
|
|
|
338
|
-
## Example: Using
|
|
338
|
+
## Example: Using request context
|
|
339
339
|
|
|
340
340
|
```typescript
|
|
341
341
|
const queryTool = createVectorQueryTool({
|
|
@@ -374,7 +374,7 @@ For more information on request context, please see:
|
|
|
374
374
|
- [Agent Request Context](https://mastra.ai/docs/server/request-context)
|
|
375
375
|
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
376
376
|
|
|
377
|
-
## Usage
|
|
377
|
+
## Usage without a Mastra server
|
|
378
378
|
|
|
379
379
|
The tool can be used by itself to retrieve documents matching a query:
|
|
380
380
|
|
|
@@ -401,7 +401,7 @@ const queryResult = await vectorQueryTool.execute({ queryText: 'foo', topK: 1 },
|
|
|
401
401
|
console.log(queryResult.sources)
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
## Dynamic
|
|
404
|
+
## Dynamic vector store for multi-tenant applications
|
|
405
405
|
|
|
406
406
|
For multi-tenant applications where each tenant has isolated data (e.g., separate PostgreSQL schemas), you can pass a resolver function instead of a static vector store instance. The function receives the request context and can return the appropriate vector store for the current tenant:
|
|
407
407
|
|
|
@@ -457,7 +457,7 @@ This pattern is similar to how `Agent.memory` supports dynamic configuration and
|
|
|
457
457
|
- **Database isolation**: Route to different database instances per tenant
|
|
458
458
|
- **Dynamic configuration**: Adjust vector store settings based on request context
|
|
459
459
|
|
|
460
|
-
## Tool
|
|
460
|
+
## Tool details
|
|
461
461
|
|
|
462
462
|
The tool is created with:
|
|
463
463
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Astra
|
|
1
|
+
# Astra vector store
|
|
2
2
|
|
|
3
3
|
The AstraVector class provides vector search using [DataStax Astra DB](https://www.datastax.com/products/datastax-astra), a cloud-native, serverless database built on Apache Cassandra. It provides vector search capabilities with enterprise-grade scalability and high availability.
|
|
4
4
|
|
|
5
|
-
## Constructor
|
|
5
|
+
## Constructor options
|
|
6
6
|
|
|
7
7
|
**token** (`string`): Astra DB API token
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ The AstraVector class provides vector search using [DataStax Astra DB](https://w
|
|
|
12
12
|
|
|
13
13
|
## Methods
|
|
14
14
|
|
|
15
|
-
### createIndex()
|
|
15
|
+
### `createIndex()`
|
|
16
16
|
|
|
17
17
|
**indexName** (`string`): Name of the index to create
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ The AstraVector class provides vector search using [DataStax Astra DB](https://w
|
|
|
20
20
|
|
|
21
21
|
**metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (maps to dot\_product for dotproduct) (Default: `cosine`)
|
|
22
22
|
|
|
23
|
-
### upsert()
|
|
23
|
+
### `upsert()`
|
|
24
24
|
|
|
25
25
|
**indexName** (`string`): Name of the index to upsert into
|
|
26
26
|
|
|
@@ -30,7 +30,7 @@ The AstraVector class provides vector search using [DataStax Astra DB](https://w
|
|
|
30
30
|
|
|
31
31
|
**ids** (`string[]`): Optional vector IDs (auto-generated if not provided)
|
|
32
32
|
|
|
33
|
-
### query()
|
|
33
|
+
### `query()`
|
|
34
34
|
|
|
35
35
|
**indexName** (`string`): Name of the index to query
|
|
36
36
|
|
|
@@ -42,11 +42,11 @@ The AstraVector class provides vector search using [DataStax Astra DB](https://w
|
|
|
42
42
|
|
|
43
43
|
**includeVector** (`boolean`): Whether to include vectors in the results (Default: `false`)
|
|
44
44
|
|
|
45
|
-
### listIndexes()
|
|
45
|
+
### `listIndexes()`
|
|
46
46
|
|
|
47
47
|
Returns an array of index names as strings.
|
|
48
48
|
|
|
49
|
-
### describeIndex()
|
|
49
|
+
### `describeIndex()`
|
|
50
50
|
|
|
51
51
|
**indexName** (`string`): Name of the index to describe
|
|
52
52
|
|
|
@@ -60,11 +60,11 @@ interface IndexStats {
|
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
### deleteIndex()
|
|
63
|
+
### `deleteIndex()`
|
|
64
64
|
|
|
65
65
|
**indexName** (`string`): Name of the index to delete
|
|
66
66
|
|
|
67
|
-
### updateVector()
|
|
67
|
+
### `updateVector()`
|
|
68
68
|
|
|
69
69
|
**indexName** (`string`): Name of the index containing the vector
|
|
70
70
|
|
|
@@ -72,13 +72,13 @@ interface IndexStats {
|
|
|
72
72
|
|
|
73
73
|
**update** (`object`): Update object containing vector and/or metadata changes
|
|
74
74
|
|
|
75
|
-
### deleteVector()
|
|
75
|
+
### `deleteVector()`
|
|
76
76
|
|
|
77
77
|
**indexName** (`string`): Name of the index containing the vector
|
|
78
78
|
|
|
79
79
|
**id** (`string`): ID of the vector to delete
|
|
80
80
|
|
|
81
|
-
## Response
|
|
81
|
+
## Response types
|
|
82
82
|
|
|
83
83
|
Query results are returned in this format:
|
|
84
84
|
|
|
@@ -91,7 +91,7 @@ interface QueryResult {
|
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
## Error
|
|
94
|
+
## Error handling
|
|
95
95
|
|
|
96
96
|
The store throws typed errors that can be caught:
|
|
97
97
|
|
|
@@ -109,7 +109,7 @@ try {
|
|
|
109
109
|
}
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
## Environment
|
|
112
|
+
## Environment variables
|
|
113
113
|
|
|
114
114
|
Required environment variables:
|
|
115
115
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Chroma
|
|
1
|
+
# Chroma vector store
|
|
2
2
|
|
|
3
3
|
The ChromaVector class provides vector search using [Chroma](https://docs.trychroma.com/docs/overview/getting-started), an open-source embedding database. It offers efficient vector search with metadata filtering and hybrid search capabilities.
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ The ChromaVector class provides vector search using [Chroma](https://docs.trychr
|
|
|
10
10
|
>
|
|
11
11
|
> [Get started with Chroma Cloud](https://trychroma.com/signup)
|
|
12
12
|
|
|
13
|
-
## Constructor
|
|
13
|
+
## Constructor options
|
|
14
14
|
|
|
15
15
|
**host** (`string`): The host address of the Chroma server. Defaults to 'localhost'
|
|
16
16
|
|
|
@@ -28,9 +28,9 @@ The ChromaVector class provides vector search using [Chroma](https://docs.trychr
|
|
|
28
28
|
|
|
29
29
|
**fetchOptions** (`RequestInit`): Additional fetch options for HTTP requests
|
|
30
30
|
|
|
31
|
-
## Running a Chroma
|
|
31
|
+
## Running a Chroma server
|
|
32
32
|
|
|
33
|
-
If you are a Chroma Cloud user,
|
|
33
|
+
If you are a Chroma Cloud user, provide the `ChromaVector` constructor your API key, tenant, and database name.
|
|
34
34
|
|
|
35
35
|
When you install the `@mastra/chroma` package, you get access to the [Chroma CLI](https://docs.trychroma.com/docs/cli/db), which can set these as environment variables for you: `chroma db connect [DB-NAME] --env-file`.
|
|
36
36
|
|
|
@@ -42,7 +42,7 @@ Otherwise, you have several options for setting up your single-node Chroma serve
|
|
|
42
42
|
|
|
43
43
|
## Methods
|
|
44
44
|
|
|
45
|
-
### createIndex()
|
|
45
|
+
### `createIndex()`
|
|
46
46
|
|
|
47
47
|
**indexName** (`string`): Name of the index to create
|
|
48
48
|
|
|
@@ -50,17 +50,17 @@ Otherwise, you have several options for setting up your single-node Chroma serve
|
|
|
50
50
|
|
|
51
51
|
**metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
|
|
52
52
|
|
|
53
|
-
### forkIndex()
|
|
53
|
+
### `forkIndex()`
|
|
54
54
|
|
|
55
55
|
Note: Forking is only supported on Chroma Cloud, or if you deploy your own OSS **distributed** Chroma.
|
|
56
56
|
|
|
57
|
-
`forkIndex` lets you fork an existing Chroma index instantly. Operations on the forked index
|
|
57
|
+
`forkIndex` lets you fork an existing Chroma index instantly. Operations on the forked index don't affect the original one. Learn more on the [Chroma docs](https://docs.trychroma.com/cloud/collection-forking).
|
|
58
58
|
|
|
59
59
|
**indexName** (`string`): Name of the index to fork
|
|
60
60
|
|
|
61
61
|
**newIndexName** (`string`): The name of the forked index
|
|
62
62
|
|
|
63
|
-
### upsert()
|
|
63
|
+
### `upsert()`
|
|
64
64
|
|
|
65
65
|
**indexName** (`string`): Name of the index to upsert into
|
|
66
66
|
|
|
@@ -72,7 +72,7 @@ Note: Forking is only supported on Chroma Cloud, or if you deploy your own OSS *
|
|
|
72
72
|
|
|
73
73
|
**documents** (`string[]`): Chroma-specific: Original text documents associated with the vectors
|
|
74
74
|
|
|
75
|
-
### query()
|
|
75
|
+
### `query()`
|
|
76
76
|
|
|
77
77
|
Query an index using a `queryVector`. Returns an array of semantically similar records in order of distance from the `queryVector`. Each record has the shape:
|
|
78
78
|
|
|
@@ -100,7 +100,7 @@ You can also provide the shape of your metadata to a `query` call for type infer
|
|
|
100
100
|
|
|
101
101
|
**documentFilter** (`Record<string, any>`): Chroma-specific: Filter to apply on the document content
|
|
102
102
|
|
|
103
|
-
### get()
|
|
103
|
+
### `get()`
|
|
104
104
|
|
|
105
105
|
Get records from your Chroma index by IDs, metadata, and document filters. It returns an array of records of the shape:
|
|
106
106
|
|
|
@@ -129,11 +129,11 @@ You can also provide the shape of your metadata to a `get` call for type inferen
|
|
|
129
129
|
|
|
130
130
|
**offset** (`number`): Offset for returning records. Use with \`limit\` to paginate results.
|
|
131
131
|
|
|
132
|
-
### listIndexes()
|
|
132
|
+
### `listIndexes()`
|
|
133
133
|
|
|
134
134
|
Returns an array of index names as strings.
|
|
135
135
|
|
|
136
|
-
### describeIndex()
|
|
136
|
+
### `describeIndex()`
|
|
137
137
|
|
|
138
138
|
**indexName** (`string`): Name of the index to describe
|
|
139
139
|
|
|
@@ -147,11 +147,11 @@ interface IndexStats {
|
|
|
147
147
|
}
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
### deleteIndex()
|
|
150
|
+
### `deleteIndex()`
|
|
151
151
|
|
|
152
152
|
**indexName** (`string`): Name of the index to delete
|
|
153
153
|
|
|
154
|
-
### updateVector()
|
|
154
|
+
### `updateVector()`
|
|
155
155
|
|
|
156
156
|
Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
|
|
157
157
|
|
|
@@ -187,13 +187,13 @@ await vectorStore.updateVector({
|
|
|
187
187
|
})
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
### deleteVector()
|
|
190
|
+
### `deleteVector()`
|
|
191
191
|
|
|
192
192
|
**indexName** (`string`): Name of the index containing the vector to delete
|
|
193
193
|
|
|
194
194
|
**id** (`string`): ID of the vector to delete
|
|
195
195
|
|
|
196
|
-
### deleteVectors()
|
|
196
|
+
### `deleteVectors()`
|
|
197
197
|
|
|
198
198
|
Delete multiple vectors by IDs or by metadata filter. This method enables bulk deletion and source-based vector management. Either `ids` or `filter` must be provided, but not both.
|
|
199
199
|
|
|
@@ -227,7 +227,7 @@ await vectorStore.deleteVectors({
|
|
|
227
227
|
})
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
## Response
|
|
230
|
+
## Response types
|
|
231
231
|
|
|
232
232
|
Query results are returned in this format:
|
|
233
233
|
|
|
@@ -241,7 +241,7 @@ interface QueryResult {
|
|
|
241
241
|
}
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
-
## Error
|
|
244
|
+
## Error handling
|
|
245
245
|
|
|
246
246
|
The store throws typed errors that can be caught:
|
|
247
247
|
|