@mastra/mcp-docs-server 1.0.0-beta.13 → 1.0.0-beta.15
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 +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +78 -78
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +173 -173
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +248 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +338 -338
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +33 -33
- 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 +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +139 -139
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +235 -235
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +102 -102
- package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Freact.md +77 -70
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +218 -218
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +195 -195
- package/.docs/organized/changelogs/create-mastra.md +13 -13
- package/.docs/organized/changelogs/mastra.md +56 -56
- package/.docs/organized/code-examples/agent-v6.md +210 -0
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +10 -6
- package/.docs/raw/agents/agent-approval.mdx +5 -6
- package/.docs/raw/agents/agent-memory.mdx +22 -30
- package/.docs/raw/agents/guardrails.mdx +60 -50
- package/.docs/raw/agents/networks.mdx +8 -12
- package/.docs/raw/agents/overview.mdx +39 -23
- package/.docs/raw/agents/processors.mdx +20 -19
- package/.docs/raw/agents/structured-output.mdx +11 -7
- package/.docs/raw/agents/using-tools.mdx +4 -5
- package/.docs/raw/deployment/mastra-server.mdx +3 -3
- package/.docs/raw/deployment/overview.mdx +7 -1
- package/.docs/raw/deployment/web-framework.mdx +4 -6
- package/.docs/raw/deployment/workflow-runners.mdx +14 -0
- 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/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 +30 -30
- 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/guides/deployment/amazon-ec2.mdx +9 -9
- package/.docs/raw/guides/deployment/aws-lambda.mdx +11 -11
- package/.docs/raw/guides/deployment/azure-app-services.mdx +2 -2
- package/.docs/raw/guides/deployment/cloudflare-deployer.mdx +5 -6
- package/.docs/raw/guides/deployment/digital-ocean.mdx +10 -10
- package/.docs/raw/guides/deployment/index.mdx +1 -1
- package/.docs/raw/guides/deployment/inngest.mdx +444 -0
- package/.docs/raw/guides/deployment/netlify-deployer.mdx +4 -4
- package/.docs/raw/guides/deployment/vercel-deployer.mdx +5 -6
- package/.docs/raw/guides/getting-started/astro.mdx +292 -451
- package/.docs/raw/guides/getting-started/express.mdx +7 -7
- package/.docs/raw/guides/getting-started/hono.mdx +18 -18
- package/.docs/raw/guides/getting-started/next-js.mdx +19 -20
- 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 +21 -21
- 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 +13 -13
- 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/memory.mdx +11 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +41 -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/mastra-cloud/deployment.mdx +39 -0
- package/.docs/raw/mastra-cloud/observability.mdx +9 -15
- package/.docs/raw/mastra-cloud/overview.mdx +14 -44
- package/.docs/raw/mastra-cloud/setup.mdx +64 -0
- package/.docs/raw/mastra-cloud/studio.mdx +35 -0
- 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 +9 -10
- package/.docs/raw/observability/overview.mdx +0 -1
- package/.docs/raw/observability/tracing/bridges/otel.mdx +2 -2
- 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 +6 -6
- package/.docs/raw/rag/graph-rag.mdx +7 -7
- package/.docs/raw/rag/overview.mdx +1 -1
- package/.docs/raw/rag/retrieval.mdx +21 -22
- package/.docs/raw/rag/vector-databases.mdx +22 -22
- 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 +2 -2
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +2 -2
- package/.docs/raw/reference/agents/getLLM.mdx +2 -2
- package/.docs/raw/reference/agents/getMemory.mdx +2 -2
- package/.docs/raw/reference/agents/getModel.mdx +2 -2
- 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 +2 -2
- 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 +2 -2
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/network-route.mdx +2 -2
- 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 +3 -3
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +2 -2
- package/.docs/raw/reference/auth/auth0.mdx +1 -2
- package/.docs/raw/reference/auth/clerk.mdx +1 -2
- package/.docs/raw/reference/auth/firebase.mdx +2 -4
- package/.docs/raw/reference/auth/jwt.mdx +1 -2
- package/.docs/raw/reference/auth/supabase.mdx +1 -2
- package/.docs/raw/reference/auth/workos.mdx +1 -2
- package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
- package/.docs/raw/reference/cli/mastra.mdx +9 -9
- package/.docs/raw/reference/client-js/agents.mdx +1 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +1 -1
- 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 +1 -1
- 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 +40 -19
- 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/extract-params.mdx +2 -2
- package/.docs/raw/reference/rag/metadata-filters.mdx +7 -7
- package/.docs/raw/reference/server/create-route.mdx +13 -13
- package/.docs/raw/reference/server/express-adapter.mdx +6 -7
- package/.docs/raw/reference/server/hono-adapter.mdx +6 -7
- package/.docs/raw/reference/server/mastra-server.mdx +20 -20
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +7 -5
- 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 +6 -5
- package/.docs/raw/reference/storage/libsql.mdx +72 -54
- package/.docs/raw/reference/storage/mongodb.mdx +84 -9
- package/.docs/raw/reference/storage/mssql.mdx +8 -6
- package/.docs/raw/{memory → reference}/storage/overview.mdx +12 -110
- package/.docs/raw/reference/storage/postgresql.mdx +82 -9
- package/.docs/raw/reference/storage/upstash.mdx +74 -2
- package/.docs/raw/reference/streaming/agents/stream.mdx +5 -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 +2 -2
- 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 +1 -4
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -1
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- package/.docs/raw/server/auth/auth0.mdx +20 -14
- package/.docs/raw/server/auth/clerk.mdx +16 -9
- package/.docs/raw/server/auth/firebase.mdx +21 -15
- package/.docs/raw/server/auth/jwt.mdx +14 -7
- package/.docs/raw/server/auth/supabase.mdx +16 -9
- package/.docs/raw/server/auth/workos.mdx +19 -13
- package/.docs/raw/server/custom-adapters.mdx +10 -10
- package/.docs/raw/server/custom-api-routes.mdx +2 -4
- package/.docs/raw/server/mastra-client.mdx +24 -13
- package/.docs/raw/server/mastra-server.mdx +3 -3
- package/.docs/raw/server/middleware.mdx +7 -7
- package/.docs/raw/server/request-context.mdx +31 -30
- package/.docs/raw/server/server-adapters.mdx +6 -6
- 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 +9 -10
- package/.docs/raw/voice/overview.mdx +2 -2
- 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 +15 -22
- package/.docs/raw/workflows/human-in-the-loop.mdx +6 -7
- package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
- package/.docs/raw/workflows/overview.mdx +34 -23
- package/.docs/raw/workflows/snapshots.mdx +16 -45
- 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 +16 -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 +3 -3
- package/.docs/raw/mastra-cloud/dashboard.mdx +0 -96
- package/.docs/raw/mastra-cloud/setting-up.mdx +0 -102
- 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
- package/.docs/raw/workflows/inngest-workflow.mdx +0 -363
|
@@ -9,7 +9,7 @@ The `.sleepUntil()` method pauses execution until a specified date.
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
12
|
+
```typescript
|
|
13
13
|
workflow.sleepUntil(new Date(Date.now() + 5000));
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -41,7 +41,7 @@ workflow.sleepUntil(new Date(Date.now() + 5000));
|
|
|
41
41
|
|
|
42
42
|
## Extended usage example
|
|
43
43
|
|
|
44
|
-
```typescript
|
|
44
|
+
```typescript
|
|
45
45
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
46
46
|
|
|
47
47
|
const step1 = createStep({...});
|
|
@@ -9,7 +9,7 @@ The `.waitForEvent()` method pauses execution until an event is received.
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
12
|
+
```typescript
|
|
13
13
|
workflow.waitForEvent("event-name", step1);
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -46,7 +46,7 @@ workflow.waitForEvent("event-name", step1);
|
|
|
46
46
|
|
|
47
47
|
## Extended usage example
|
|
48
48
|
|
|
49
|
-
```typescript
|
|
49
|
+
```typescript
|
|
50
50
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
51
51
|
|
|
52
52
|
const step1 = createStep({...});
|
|
@@ -9,7 +9,7 @@ The `Workflow` class enables you to create state machines for complex sequences
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript title="src/mastra/workflows/test-workflow.ts"
|
|
12
|
+
```typescript title="src/mastra/workflows/test-workflow.ts"
|
|
13
13
|
import { createWorkflow } from "@mastra/core/workflows";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
|
|
@@ -106,7 +106,7 @@ export const workflow = createWorkflow({
|
|
|
106
106
|
|
|
107
107
|
When starting a workflow run, you can pass `initialState` to set the starting values for the workflow's state:
|
|
108
108
|
|
|
109
|
-
```typescript
|
|
109
|
+
```typescript
|
|
110
110
|
const run = await workflow.createRun();
|
|
111
111
|
|
|
112
112
|
const result = await run.start({
|
|
@@ -157,7 +157,7 @@ A workflow's `status` indicates its current execution state. The possible values
|
|
|
157
157
|
|
|
158
158
|
When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
|
|
159
159
|
|
|
160
|
-
```typescript
|
|
160
|
+
```typescript
|
|
161
161
|
const run = await workflow.createRun();
|
|
162
162
|
const result = await run.start({ inputData: { message: "Hello" } });
|
|
163
163
|
|
|
@@ -19,7 +19,7 @@ This example uses Auth0 authentication. Make sure to:
|
|
|
19
19
|
3. Configure an API in your Auth0 Dashboard with an identifier (audience)
|
|
20
20
|
4. Configure your application's allowed callback URLs, web origins, and logout URLs
|
|
21
21
|
|
|
22
|
-
```env title=".env"
|
|
22
|
+
```env title=".env"
|
|
23
23
|
AUTH0_DOMAIN=your-tenant.auth0.com
|
|
24
24
|
AUTH0_AUDIENCE=your-api-identifier
|
|
25
25
|
```
|
|
@@ -32,7 +32,7 @@ AUTH0_AUDIENCE=your-api-identifier
|
|
|
32
32
|
|
|
33
33
|
Before you can use the `MastraAuthAuth0` class you have to install the `@mastra/auth-auth0` package.
|
|
34
34
|
|
|
35
|
-
```bash
|
|
35
|
+
```bash
|
|
36
36
|
npm install @mastra/auth-auth0@beta
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -40,12 +40,11 @@ npm install @mastra/auth-auth0@beta
|
|
|
40
40
|
|
|
41
41
|
### Basic usage with environment variables
|
|
42
42
|
|
|
43
|
-
```typescript {2,
|
|
43
|
+
```typescript {2,6} title="src/mastra/index.ts"
|
|
44
44
|
import { Mastra } from "@mastra/core";
|
|
45
45
|
import { MastraAuthAuth0 } from "@mastra/auth-auth0";
|
|
46
46
|
|
|
47
47
|
export const mastra = new Mastra({
|
|
48
|
-
// ..
|
|
49
48
|
server: {
|
|
50
49
|
auth: new MastraAuthAuth0(),
|
|
51
50
|
},
|
|
@@ -54,12 +53,11 @@ export const mastra = new Mastra({
|
|
|
54
53
|
|
|
55
54
|
### Custom configuration
|
|
56
55
|
|
|
57
|
-
```typescript {2,
|
|
56
|
+
```typescript {2,6-9} title="src/mastra/index.ts"
|
|
58
57
|
import { Mastra } from "@mastra/core";
|
|
59
58
|
import { MastraAuthAuth0 } from "@mastra/auth-auth0";
|
|
60
59
|
|
|
61
60
|
export const mastra = new Mastra({
|
|
62
|
-
// ..
|
|
63
61
|
server: {
|
|
64
62
|
auth: new MastraAuthAuth0({
|
|
65
63
|
domain: process.env.AUTH0_DOMAIN,
|
|
@@ -82,7 +80,7 @@ By default, `MastraAuthAuth0` allows all authenticated users who have valid Auth
|
|
|
82
80
|
|
|
83
81
|
To customize user authorization, provide a custom `authorizeUser` function:
|
|
84
82
|
|
|
85
|
-
```typescript title="src/mastra/auth.ts"
|
|
83
|
+
```typescript title="src/mastra/auth.ts"
|
|
86
84
|
import { MastraAuthAuth0 } from "@mastra/auth-auth0";
|
|
87
85
|
|
|
88
86
|
const auth0Provider = new MastraAuthAuth0({
|
|
@@ -93,7 +91,11 @@ const auth0Provider = new MastraAuthAuth0({
|
|
|
93
91
|
});
|
|
94
92
|
```
|
|
95
93
|
|
|
96
|
-
|
|
94
|
+
:::info
|
|
95
|
+
|
|
96
|
+
Visit [MastraAuthAuth0](/reference/v1/auth/auth0) for all available configuration options.
|
|
97
|
+
|
|
98
|
+
:::
|
|
97
99
|
|
|
98
100
|
## Client-side setup
|
|
99
101
|
|
|
@@ -103,11 +105,11 @@ When using Auth0 auth, you'll need to set up the Auth0 React SDK, authenticate u
|
|
|
103
105
|
|
|
104
106
|
First, install and configure the Auth0 React SDK in your application:
|
|
105
107
|
|
|
106
|
-
```bash
|
|
108
|
+
```bash
|
|
107
109
|
npm install @auth0/auth0-react
|
|
108
110
|
```
|
|
109
111
|
|
|
110
|
-
```typescript title="src/auth0-provider.tsx"
|
|
112
|
+
```typescript title="src/auth0-provider.tsx"
|
|
111
113
|
import React from 'react';
|
|
112
114
|
import { Auth0Provider } from '@auth0/auth0-react';
|
|
113
115
|
|
|
@@ -134,7 +136,7 @@ export default Auth0ProviderWithHistory;
|
|
|
134
136
|
|
|
135
137
|
Use the Auth0 React SDK to authenticate users and retrieve their access tokens:
|
|
136
138
|
|
|
137
|
-
```typescript title="lib/auth.ts"
|
|
139
|
+
```typescript title="lib/auth.ts"
|
|
138
140
|
import { useAuth0 } from "@auth0/auth0-react";
|
|
139
141
|
|
|
140
142
|
export const useAuth0Token = () => {
|
|
@@ -155,7 +157,7 @@ export const useAuth0Token = () => {
|
|
|
155
157
|
|
|
156
158
|
When `auth` is enabled, all requests made with `MastraClient` must include a valid Auth0 access token in the `Authorization` header:
|
|
157
159
|
|
|
158
|
-
```typescript title="lib/mastra/mastra-client.ts"
|
|
160
|
+
```typescript title="lib/mastra/mastra-client.ts"
|
|
159
161
|
import { MastraClient } from "@mastra/client-js";
|
|
160
162
|
|
|
161
163
|
export const createMastraClient = (accessToken: string) => {
|
|
@@ -170,7 +172,11 @@ export const createMastraClient = (accessToken: string) => {
|
|
|
170
172
|
|
|
171
173
|
> **Note:** The access token must be prefixed with `Bearer` in the Authorization header.
|
|
172
174
|
|
|
173
|
-
|
|
175
|
+
:::info
|
|
176
|
+
|
|
177
|
+
Visit [Mastra Client SDK](/docs/v1/server/mastra-client) for more configuration options.
|
|
178
|
+
|
|
179
|
+
:::
|
|
174
180
|
|
|
175
181
|
### Making authenticated requests
|
|
176
182
|
|
|
@@ -178,7 +184,7 @@ Once `MastraClient` is configured with the Auth0 access token, you can send auth
|
|
|
178
184
|
|
|
179
185
|
<Tabs>
|
|
180
186
|
<TabItem value="react" label="React">
|
|
181
|
-
```tsx title="src/components/mastra-api-test.tsx"
|
|
187
|
+
```tsx title="src/components/mastra-api-test.tsx" copy
|
|
182
188
|
import React, { useState } from 'react';
|
|
183
189
|
import { useAuth0 } from '@auth0/auth0-react';
|
|
184
190
|
import { MastraClient } from '@mastra/client-js';
|
|
@@ -14,7 +14,7 @@ The `MastraAuthClerk` class provides authentication for Mastra using Clerk. It v
|
|
|
14
14
|
|
|
15
15
|
This example uses Clerk authentication. Make sure to add your Clerk credentials to your `.env` file and ensure your Clerk project is properly configured.
|
|
16
16
|
|
|
17
|
-
```env title=".env"
|
|
17
|
+
```env title=".env"
|
|
18
18
|
CLERK_PUBLISHABLE_KEY=pk_test_...
|
|
19
19
|
CLERK_SECRET_KEY=sk_test_...
|
|
20
20
|
CLERK_JWKS_URI=https://your-clerk-domain.clerk.accounts.dev/.well-known/jwks.json
|
|
@@ -26,18 +26,17 @@ CLERK_JWKS_URI=https://your-clerk-domain.clerk.accounts.dev/.well-known/jwks.jso
|
|
|
26
26
|
|
|
27
27
|
Before you can use the `MastraAuthClerk` class you have to install the `@mastra/auth-clerk` package.
|
|
28
28
|
|
|
29
|
-
```bash
|
|
29
|
+
```bash
|
|
30
30
|
npm install @mastra/auth-clerk@beta
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Usage example
|
|
34
34
|
|
|
35
|
-
```typescript {2,
|
|
35
|
+
```typescript {2,6-10} title="src/mastra/index.ts"
|
|
36
36
|
import { Mastra } from "@mastra/core";
|
|
37
37
|
import { MastraAuthClerk } from "@mastra/auth-clerk";
|
|
38
38
|
|
|
39
39
|
export const mastra = new Mastra({
|
|
40
|
-
// ..
|
|
41
40
|
server: {
|
|
42
41
|
auth: new MastraAuthClerk({
|
|
43
42
|
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
|
|
@@ -50,7 +49,11 @@ export const mastra = new Mastra({
|
|
|
50
49
|
|
|
51
50
|
> **Note:** The default `authorizeUser` method allows all authenticated users. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
:::info
|
|
53
|
+
|
|
54
|
+
Visit [MastraAuthClerk](/reference/v1/auth/clerk) for all available configuration options.
|
|
55
|
+
|
|
56
|
+
:::
|
|
54
57
|
|
|
55
58
|
## Client-side setup
|
|
56
59
|
|
|
@@ -60,7 +63,7 @@ When using Clerk auth, you'll need to retrieve the access token from Clerk on th
|
|
|
60
63
|
|
|
61
64
|
Use the Clerk React hooks to authenticate users and retrieve their access token:
|
|
62
65
|
|
|
63
|
-
```typescript title="lib/auth.ts"
|
|
66
|
+
```typescript title="lib/auth.ts"
|
|
64
67
|
import { useAuth } from "@clerk/nextjs";
|
|
65
68
|
|
|
66
69
|
export const useClerkAuth = () => {
|
|
@@ -81,7 +84,7 @@ export const useClerkAuth = () => {
|
|
|
81
84
|
|
|
82
85
|
When `auth` is enabled, all requests made with `MastraClient` must include a valid Clerk access token in the `Authorization` header:
|
|
83
86
|
|
|
84
|
-
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
87
|
+
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
85
88
|
import { MastraClient } from "@mastra/client-js";
|
|
86
89
|
|
|
87
90
|
export const mastraClient = new MastraClient({
|
|
@@ -93,7 +96,11 @@ export const mastraClient = new MastraClient({
|
|
|
93
96
|
```
|
|
94
97
|
|
|
95
98
|
> **Note:** The access token must be prefixed with `Bearer` in the Authorization header.
|
|
96
|
-
|
|
99
|
+
:::info
|
|
100
|
+
|
|
101
|
+
Visit [Mastra Client SDK](/docs/v1/server/mastra-client) for more configuration options.
|
|
102
|
+
|
|
103
|
+
:::
|
|
97
104
|
|
|
98
105
|
### Making authenticated requests
|
|
99
106
|
|
|
@@ -101,7 +108,7 @@ Once `MastraClient` is configured with the Clerk access token, you can send auth
|
|
|
101
108
|
|
|
102
109
|
<Tabs>
|
|
103
110
|
<TabItem value="react" label="React">
|
|
104
|
-
```tsx title="src/components/test-agent.tsx"
|
|
111
|
+
```tsx title="src/components/test-agent.tsx" copy
|
|
105
112
|
"use client";
|
|
106
113
|
|
|
107
114
|
import { useAuth } from "@clerk/nextjs";
|
|
@@ -19,7 +19,7 @@ This example uses Firebase Authentication. Make sure to:
|
|
|
19
19
|
3. Generate a service account key from Project Settings > Service Accounts
|
|
20
20
|
4. Download the service account JSON file
|
|
21
21
|
|
|
22
|
-
```env title=".env"
|
|
22
|
+
```env title=".env"
|
|
23
23
|
FIREBASE_SERVICE_ACCOUNT=/path/to/your/service-account-key.json
|
|
24
24
|
FIRESTORE_DATABASE_ID=(default)
|
|
25
25
|
# Alternative environment variable names:
|
|
@@ -32,7 +32,7 @@ FIRESTORE_DATABASE_ID=(default)
|
|
|
32
32
|
|
|
33
33
|
Before you can use the `MastraAuthFirebase` class you have to install the `@mastra/auth-firebase` package.
|
|
34
34
|
|
|
35
|
-
```bash
|
|
35
|
+
```bash
|
|
36
36
|
npm install @mastra/auth-firebase@beta
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -42,13 +42,12 @@ npm install @mastra/auth-firebase@beta
|
|
|
42
42
|
|
|
43
43
|
If you set the required environment variables (`FIREBASE_SERVICE_ACCOUNT` and `FIRESTORE_DATABASE_ID`), you can initialize `MastraAuthFirebase` without any constructor arguments. The class will automatically read these environment variables as configuration:
|
|
44
44
|
|
|
45
|
-
```typescript {2,7} title="src/mastra/index.ts"
|
|
45
|
+
```typescript {2,7} title="src/mastra/index.ts"
|
|
46
46
|
import { Mastra } from "@mastra/core";
|
|
47
47
|
import { MastraAuthFirebase } from "@mastra/auth-firebase";
|
|
48
48
|
|
|
49
49
|
// Automatically uses FIREBASE_SERVICE_ACCOUNT and FIRESTORE_DATABASE_ID env vars
|
|
50
50
|
export const mastra = new Mastra({
|
|
51
|
-
// ..
|
|
52
51
|
server: {
|
|
53
52
|
auth: new MastraAuthFirebase(),
|
|
54
53
|
},
|
|
@@ -57,12 +56,11 @@ export const mastra = new Mastra({
|
|
|
57
56
|
|
|
58
57
|
### Custom configuration
|
|
59
58
|
|
|
60
|
-
```typescript {2,
|
|
59
|
+
```typescript {2,6-9} title="src/mastra/index.ts"
|
|
61
60
|
import { Mastra } from "@mastra/core";
|
|
62
61
|
import { MastraAuthFirebase } from "@mastra/auth-firebase";
|
|
63
62
|
|
|
64
63
|
export const mastra = new Mastra({
|
|
65
|
-
// ..
|
|
66
64
|
server: {
|
|
67
65
|
auth: new MastraAuthFirebase({
|
|
68
66
|
serviceAccount: "/path/to/service-account.json",
|
|
@@ -87,7 +85,7 @@ The `MastraAuthFirebase` class can be configured through constructor options or
|
|
|
87
85
|
|
|
88
86
|
By default, `MastraAuthFirebase` uses Firestore to manage user access. It expects a collection named `user_access` with documents keyed by user UIDs. The presence of a document in this collection determines whether a user is authorized.
|
|
89
87
|
|
|
90
|
-
```typescript title="firestore-structure.txt"
|
|
88
|
+
```typescript title="firestore-structure.txt"
|
|
91
89
|
user_access/
|
|
92
90
|
{user_uid_1}/ // Document exists = user authorized
|
|
93
91
|
{user_uid_2}/ // Document exists = user authorized
|
|
@@ -95,7 +93,7 @@ user_access/
|
|
|
95
93
|
|
|
96
94
|
To customize user authorization, provide a custom `authorizeUser` function:
|
|
97
95
|
|
|
98
|
-
```typescript title="src/mastra/auth.ts"
|
|
96
|
+
```typescript title="src/mastra/auth.ts"
|
|
99
97
|
import { MastraAuthFirebase } from "@mastra/auth-firebase";
|
|
100
98
|
|
|
101
99
|
const firebaseAuth = new MastraAuthFirebase({
|
|
@@ -106,7 +104,11 @@ const firebaseAuth = new MastraAuthFirebase({
|
|
|
106
104
|
});
|
|
107
105
|
```
|
|
108
106
|
|
|
109
|
-
|
|
107
|
+
:::info
|
|
108
|
+
|
|
109
|
+
Visit [MastraAuthFirebase](/reference/v1/auth/firebase) for all available configuration options.
|
|
110
|
+
|
|
111
|
+
:::
|
|
110
112
|
|
|
111
113
|
## Client-side setup
|
|
112
114
|
|
|
@@ -116,7 +118,7 @@ When using Firebase auth, you'll need to initialize Firebase on the client side,
|
|
|
116
118
|
|
|
117
119
|
First, initialize Firebase in your client application:
|
|
118
120
|
|
|
119
|
-
```typescript title="lib/firebase.ts"
|
|
121
|
+
```typescript title="lib/firebase.ts"
|
|
120
122
|
import { initializeApp } from "firebase/app";
|
|
121
123
|
import { getAuth, GoogleAuthProvider } from "firebase/auth";
|
|
122
124
|
|
|
@@ -135,7 +137,7 @@ export const googleProvider = new GoogleAuthProvider();
|
|
|
135
137
|
|
|
136
138
|
Use Firebase authentication to sign in users and retrieve their ID tokens:
|
|
137
139
|
|
|
138
|
-
```typescript title="lib/auth.ts"
|
|
140
|
+
```typescript title="lib/auth.ts"
|
|
139
141
|
import { signInWithPopup, signOut, User } from "firebase/auth";
|
|
140
142
|
import { auth, googleProvider } from "./firebase";
|
|
141
143
|
|
|
@@ -175,7 +177,7 @@ export const signOutUser = async () => {
|
|
|
175
177
|
|
|
176
178
|
When `auth` is enabled, all requests made with `MastraClient` must include a valid Firebase ID token in the `Authorization` header:
|
|
177
179
|
|
|
178
|
-
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
180
|
+
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
179
181
|
import { MastraClient } from "@mastra/client-js";
|
|
180
182
|
|
|
181
183
|
export const createMastraClient = (idToken: string) => {
|
|
@@ -190,7 +192,11 @@ export const createMastraClient = (idToken: string) => {
|
|
|
190
192
|
|
|
191
193
|
> **Note:** The ID token must be prefixed with `Bearer` in the Authorization header.
|
|
192
194
|
|
|
193
|
-
|
|
195
|
+
:::info
|
|
196
|
+
|
|
197
|
+
Visit [Mastra Client SDK](/docs/v1/server/mastra-client) for more configuration options.
|
|
198
|
+
|
|
199
|
+
:::
|
|
194
200
|
|
|
195
201
|
### Making authenticated requests
|
|
196
202
|
|
|
@@ -198,7 +204,7 @@ Once `MastraClient` is configured with the Firebase ID token, you can send authe
|
|
|
198
204
|
|
|
199
205
|
<Tabs>
|
|
200
206
|
<TabItem value="react" label="React">
|
|
201
|
-
```tsx title="src/components/test-agent.tsx"
|
|
207
|
+
```tsx title="src/components/test-agent.tsx" copy
|
|
202
208
|
"use client";
|
|
203
209
|
|
|
204
210
|
import { useAuthState } from 'react-firebase-hooks/auth';
|
|
@@ -233,7 +239,7 @@ Once `MastraClient` is configured with the Firebase ID token, you can send authe
|
|
|
233
239
|
|
|
234
240
|
</TabItem>
|
|
235
241
|
<TabItem value="nodejs" label="Node.js">
|
|
236
|
-
```typescript title="server.js"
|
|
242
|
+
```typescript title="server.js" copy
|
|
237
243
|
const express = require('express');
|
|
238
244
|
const admin = require('firebase-admin');
|
|
239
245
|
const { MastraClient } = require('@mastra/client-js');
|
|
@@ -14,18 +14,17 @@ The `MastraJwtAuth` class provides a lightweight authentication mechanism for Ma
|
|
|
14
14
|
|
|
15
15
|
Before you can use the `MastraJwtAuth` class you have to install the `@mastra/auth` package.
|
|
16
16
|
|
|
17
|
-
```bash
|
|
17
|
+
```bash
|
|
18
18
|
npm install @mastra/auth@beta
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Usage example
|
|
22
22
|
|
|
23
|
-
```typescript {2,
|
|
23
|
+
```typescript {2,6-8} title="src/mastra/index.ts"
|
|
24
24
|
import { Mastra } from "@mastra/core";
|
|
25
25
|
import { MastraJwtAuth } from "@mastra/auth";
|
|
26
26
|
|
|
27
27
|
export const mastra = new Mastra({
|
|
28
|
-
// ..
|
|
29
28
|
server: {
|
|
30
29
|
auth: new MastraJwtAuth({
|
|
31
30
|
secret: process.env.MASTRA_JWT_SECRET,
|
|
@@ -34,13 +33,17 @@ export const mastra = new Mastra({
|
|
|
34
33
|
});
|
|
35
34
|
```
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
:::info
|
|
37
|
+
|
|
38
|
+
Visit [MastraJwtAuth](/reference/v1/auth/jwt) for all available configuration options.
|
|
39
|
+
|
|
40
|
+
:::
|
|
38
41
|
|
|
39
42
|
## Configuring `MastraClient`
|
|
40
43
|
|
|
41
44
|
When `auth` is enabled, all requests made with `MastraClient` must include a valid JWT in the `Authorization` header:
|
|
42
45
|
|
|
43
|
-
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
46
|
+
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
44
47
|
import { MastraClient } from "@mastra/client-js";
|
|
45
48
|
|
|
46
49
|
export const mastraClient = new MastraClient({
|
|
@@ -51,7 +54,11 @@ export const mastraClient = new MastraClient({
|
|
|
51
54
|
});
|
|
52
55
|
```
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
:::info
|
|
58
|
+
|
|
59
|
+
Visit [Mastra Client SDK](/docs/v1/server/mastra-client) for more configuration options.
|
|
60
|
+
|
|
61
|
+
:::
|
|
55
62
|
|
|
56
63
|
### Making authenticated requests
|
|
57
64
|
|
|
@@ -59,7 +66,7 @@ Once `MastraClient` is configured, you can send authenticated requests from your
|
|
|
59
66
|
|
|
60
67
|
<Tabs>
|
|
61
68
|
<TabItem value="react" label="React">
|
|
62
|
-
```tsx title="src/components/test-agent.tsx"
|
|
69
|
+
```tsx title="src/components/test-agent.tsx" copy
|
|
63
70
|
import { mastraClient } from "../../lib/mastra-client";
|
|
64
71
|
|
|
65
72
|
export const TestAgent = () => {
|
|
@@ -14,7 +14,7 @@ The `MastraAuthSupabase` class provides authentication for Mastra using Supabase
|
|
|
14
14
|
|
|
15
15
|
This example uses Supabase Auth. Make sure to add your Supabase credentials to your `.env` file and ensure your Supabase project is properly configured.
|
|
16
16
|
|
|
17
|
-
```env title=".env"
|
|
17
|
+
```env title=".env"
|
|
18
18
|
SUPABASE_URL=https://your-project.supabase.co
|
|
19
19
|
SUPABASE_ANON_KEY=your-anon-key
|
|
20
20
|
```
|
|
@@ -25,18 +25,17 @@ SUPABASE_ANON_KEY=your-anon-key
|
|
|
25
25
|
|
|
26
26
|
Before you can use the `MastraAuthSupabase` class you have to install the `@mastra/auth-supabase` package.
|
|
27
27
|
|
|
28
|
-
```bash
|
|
28
|
+
```bash
|
|
29
29
|
npm install @mastra/auth-supabase@beta
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Usage example
|
|
33
33
|
|
|
34
|
-
```typescript {2,
|
|
34
|
+
```typescript {2,6-9} title="src/mastra/index.ts"
|
|
35
35
|
import { Mastra } from "@mastra/core";
|
|
36
36
|
import { MastraAuthSupabase } from "@mastra/auth-supabase";
|
|
37
37
|
|
|
38
38
|
export const mastra = new Mastra({
|
|
39
|
-
// ..
|
|
40
39
|
server: {
|
|
41
40
|
auth: new MastraAuthSupabase({
|
|
42
41
|
url: process.env.SUPABASE_URL,
|
|
@@ -48,7 +47,11 @@ export const mastra = new Mastra({
|
|
|
48
47
|
|
|
49
48
|
> **Note:** The default `authorizeUser` method checks the `isAdmin` column in the `users` table in the `public` schema. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
:::info
|
|
51
|
+
|
|
52
|
+
Visit [MastraAuthSupabase](/reference/v1/auth/supabase) for all available configuration options.
|
|
53
|
+
|
|
54
|
+
:::
|
|
52
55
|
|
|
53
56
|
## Client-side setup
|
|
54
57
|
|
|
@@ -58,7 +61,7 @@ When using Supabase auth, you'll need to retrieve the access token from Supabase
|
|
|
58
61
|
|
|
59
62
|
Use the Supabase client to authenticate users and retrieve their access token:
|
|
60
63
|
|
|
61
|
-
```typescript title="lib/auth.ts"
|
|
64
|
+
```typescript title="lib/auth.ts"
|
|
62
65
|
import { createClient } from "@supabase/supabase-js";
|
|
63
66
|
|
|
64
67
|
const supabase = createClient("<supabase-url>", "<supabase-key>");
|
|
@@ -77,7 +80,7 @@ const accessToken = authTokenResponse.data?.session?.access_token;
|
|
|
77
80
|
|
|
78
81
|
When `auth` is enabled, all requests made with `MastraClient` must include a valid Supabase access token in the `Authorization` header:
|
|
79
82
|
|
|
80
|
-
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
83
|
+
```typescript {6} title="lib/mastra/mastra-client.ts"
|
|
81
84
|
import { MastraClient } from "@mastra/client-js";
|
|
82
85
|
|
|
83
86
|
export const mastraClient = new MastraClient({
|
|
@@ -90,7 +93,11 @@ export const mastraClient = new MastraClient({
|
|
|
90
93
|
|
|
91
94
|
> **Note:** The access token must be prefixed with `Bearer` in the Authorization header.
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
:::info
|
|
97
|
+
|
|
98
|
+
Visit [Mastra Client SDK](/docs/v1/server/mastra-client) for more configuration options.
|
|
99
|
+
|
|
100
|
+
:::
|
|
94
101
|
|
|
95
102
|
### Making authenticated requests
|
|
96
103
|
|
|
@@ -98,7 +105,7 @@ Once `MastraClient` is configured with the Supabase access token, you can send a
|
|
|
98
105
|
|
|
99
106
|
<Tabs>
|
|
100
107
|
<TabItem value="react" label="React">
|
|
101
|
-
```tsx title="src/components/test-agent.tsx"
|
|
108
|
+
```tsx title="src/components/test-agent.tsx" copy
|
|
102
109
|
import { mastraClient } from "../../lib/mastra-client";
|
|
103
110
|
|
|
104
111
|
export const TestAgent = () => {
|
|
@@ -19,7 +19,7 @@ This example uses WorkOS authentication. Make sure to:
|
|
|
19
19
|
3. Configure your redirect URIs and allowed origins
|
|
20
20
|
4. Set up Organizations and configure user roles as needed
|
|
21
21
|
|
|
22
|
-
```env title=".env"
|
|
22
|
+
```env title=".env"
|
|
23
23
|
WORKOS_API_KEY=sk_live_...
|
|
24
24
|
WORKOS_CLIENT_ID=client_...
|
|
25
25
|
```
|
|
@@ -32,7 +32,7 @@ WORKOS_CLIENT_ID=client_...
|
|
|
32
32
|
|
|
33
33
|
Before you can use the `MastraAuthWorkos` class you have to install the `@mastra/auth-workos` package.
|
|
34
34
|
|
|
35
|
-
```bash
|
|
35
|
+
```bash
|
|
36
36
|
npm install @mastra/auth-workos@beta
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -40,12 +40,11 @@ npm install @mastra/auth-workos@beta
|
|
|
40
40
|
|
|
41
41
|
### Basic usage with environment variables
|
|
42
42
|
|
|
43
|
-
```typescript {2,
|
|
43
|
+
```typescript {2,6} title="src/mastra/index.ts"
|
|
44
44
|
import { Mastra } from "@mastra/core";
|
|
45
45
|
import { MastraAuthWorkos } from "@mastra/auth-workos";
|
|
46
46
|
|
|
47
47
|
export const mastra = new Mastra({
|
|
48
|
-
// ..
|
|
49
48
|
server: {
|
|
50
49
|
auth: new MastraAuthWorkos(),
|
|
51
50
|
},
|
|
@@ -54,12 +53,11 @@ export const mastra = new Mastra({
|
|
|
54
53
|
|
|
55
54
|
### Custom configuration
|
|
56
55
|
|
|
57
|
-
```typescript {2,
|
|
56
|
+
```typescript {2,6-9} title="src/mastra/index.ts"
|
|
58
57
|
import { Mastra } from "@mastra/core";
|
|
59
58
|
import { MastraAuthWorkos } from "@mastra/auth-workos";
|
|
60
59
|
|
|
61
60
|
export const mastra = new Mastra({
|
|
62
|
-
// ..
|
|
63
61
|
server: {
|
|
64
62
|
auth: new MastraAuthWorkos({
|
|
65
63
|
apiKey: process.env.WORKOS_API_KEY,
|
|
@@ -82,7 +80,7 @@ By default, `MastraAuthWorkos` checks whether the authenticated user has an 'adm
|
|
|
82
80
|
|
|
83
81
|
To customize user authorization, provide a custom `authorizeUser` function:
|
|
84
82
|
|
|
85
|
-
```typescript title="src/mastra/auth.ts"
|
|
83
|
+
```typescript title="src/mastra/auth.ts"
|
|
86
84
|
import { MastraAuthWorkos } from "@mastra/auth-workos";
|
|
87
85
|
|
|
88
86
|
const workosAuth = new MastraAuthWorkos({
|
|
@@ -94,7 +92,11 @@ const workosAuth = new MastraAuthWorkos({
|
|
|
94
92
|
});
|
|
95
93
|
```
|
|
96
94
|
|
|
97
|
-
|
|
95
|
+
:::info
|
|
96
|
+
|
|
97
|
+
Visit [MastraAuthWorkos](/reference/v1/auth/workos) for all available configuration options.
|
|
98
|
+
|
|
99
|
+
:::
|
|
98
100
|
|
|
99
101
|
## Client-side setup
|
|
100
102
|
|
|
@@ -104,7 +106,7 @@ When using WorkOS auth, you'll need to implement the WorkOS authentication flow
|
|
|
104
106
|
|
|
105
107
|
First, install the WorkOS SDK in your application:
|
|
106
108
|
|
|
107
|
-
```bash
|
|
109
|
+
```bash
|
|
108
110
|
npm install @workos-inc/node
|
|
109
111
|
```
|
|
110
112
|
|
|
@@ -112,7 +114,7 @@ npm install @workos-inc/node
|
|
|
112
114
|
|
|
113
115
|
After users complete the WorkOS authentication flow and return with an authorization code, exchange it for an access token:
|
|
114
116
|
|
|
115
|
-
```typescript title="lib/auth.ts"
|
|
117
|
+
```typescript title="lib/auth.ts"
|
|
116
118
|
import { WorkOS } from "@workos-inc/node";
|
|
117
119
|
|
|
118
120
|
const workos = new WorkOS(process.env.WORKOS_API_KEY);
|
|
@@ -137,7 +139,7 @@ export const authenticateWithWorkos = async (
|
|
|
137
139
|
|
|
138
140
|
When `auth` is enabled, all requests made with `MastraClient` must include a valid WorkOS access token in the `Authorization` header:
|
|
139
141
|
|
|
140
|
-
```typescript title="lib/mastra/mastra-client.ts"
|
|
142
|
+
```typescript title="lib/mastra/mastra-client.ts"
|
|
141
143
|
import { MastraClient } from "@mastra/client-js";
|
|
142
144
|
|
|
143
145
|
export const createMastraClient = (accessToken: string) => {
|
|
@@ -152,7 +154,11 @@ export const createMastraClient = (accessToken: string) => {
|
|
|
152
154
|
|
|
153
155
|
> **Note:** The access token must be prefixed with `Bearer` in the Authorization header.
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
:::info
|
|
158
|
+
|
|
159
|
+
Visit [Mastra Client SDK](/docs/v1/server/mastra-client) for more configuration options.
|
|
160
|
+
|
|
161
|
+
:::
|
|
156
162
|
|
|
157
163
|
### Making authenticated requests
|
|
158
164
|
|
|
@@ -160,7 +166,7 @@ Once `MastraClient` is configured with the WorkOS access token, you can send aut
|
|
|
160
166
|
|
|
161
167
|
<Tabs>
|
|
162
168
|
<TabItem value="react" label="React">
|
|
163
|
-
```typescript title="src/api/agents.ts"
|
|
169
|
+
```typescript title="src/api/agents.ts" copy
|
|
164
170
|
import { WorkOS } from '@workos-inc/node';
|
|
165
171
|
import { MastraClient } from '@mastra/client-js';
|
|
166
172
|
|