@mastra/mcp-docs-server 1.3.13-alpha.0 → 1.3.13-alpha.2
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/resumable-streams.md +140 -0
- package/.docs/docs/agents/tools.md +2 -2
- package/.docs/docs/auth/overview.md +1 -0
- package/.docs/docs/channels.md +34 -1
- package/.docs/docs/connections/mcp.md +27 -61
- package/.docs/docs/harness/background-tasks.md +2 -1
- package/.docs/docs/harness/durable-agents.md +6 -6
- package/.docs/docs/harness/schedules.md +2 -0
- package/.docs/docs/mastra-platform/connect.md +231 -0
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +0 -2
- package/.docs/docs/signals/sending-signals.md +3 -1
- package/.docs/integrations/auth/clerk.md +46 -7
- package/.docs/integrations/auth/neon.md +217 -0
- package/.docs/integrations/auth/supabase.md +46 -7
- package/.docs/integrations/auth/workos.md +54 -15
- package/.docs/integrations/channels/discord.md +84 -6
- package/.docs/integrations/channels/github.md +63 -24
- package/.docs/integrations/channels/slack.md +89 -8
- package/.docs/integrations/channels/teams.md +79 -5
- package/.docs/integrations/channels/telegram.md +47 -6
- package/.docs/integrations/crm/attio.md +42 -0
- package/.docs/integrations/crm/clay.md +42 -0
- package/.docs/integrations/crm/hubspot.md +41 -0
- package/.docs/integrations/databases/neon.md +37 -1
- package/.docs/integrations/databases/postgresql.md +46 -0
- package/.docs/integrations/deploy/render.md +59 -18
- package/.docs/integrations/documents/google-docs.md +41 -0
- package/.docs/integrations/documents/google-sheet.md +41 -0
- package/.docs/integrations/documents/microsoft-excel.md +43 -0
- package/.docs/integrations/documents/microsoft-powerpoint.md +41 -0
- package/.docs/integrations/documents/microsoft-word.md +41 -0
- package/.docs/integrations/documents/notion.md +41 -0
- package/.docs/integrations/documents/one-drive.md +41 -0
- package/.docs/integrations/documents/sharepoint-online.md +41 -0
- package/.docs/integrations/email-calendar/google-calendar.md +41 -0
- package/.docs/integrations/email-calendar/google-mail.md +41 -0
- package/.docs/integrations/email-calendar/outlook.md +41 -0
- package/.docs/integrations/file-storage/amazon-s3.md +1 -1
- package/.docs/integrations/file-storage/google-drive.md +54 -15
- package/.docs/integrations/observability/posthog.md +50 -11
- package/.docs/integrations/other/canva.md +42 -0
- package/.docs/integrations/other/fireflies.md +41 -0
- package/.docs/integrations/other/incident-io.md +41 -0
- package/.docs/integrations/other/resend.md +43 -0
- package/.docs/integrations/other/robinhood.md +44 -0
- package/.docs/integrations/other/sanity.md +42 -0
- package/.docs/integrations/other/snowflake.md +41 -0
- package/.docs/integrations/project-management/jira.md +41 -0
- package/.docs/integrations/project-management/linear.md +41 -0
- package/.docs/integrations/voice/openai.md +40 -0
- package/.docs/integrations.md +40 -1
- package/.docs/models/gateways/custom-gateways.md +2 -0
- package/.docs/models/gateways/netlify.md +6 -3
- package/.docs/models/gateways/openrouter.md +7 -8
- package/.docs/models/gateways/vercel.md +419 -420
- package/.docs/models/index.md +46 -2
- package/.docs/models/providers/aiand.md +1 -1
- package/.docs/models/providers/chutes.md +2 -1
- package/.docs/models/providers/edenai.md +9 -13
- package/.docs/models/providers/empiriolabs.md +3 -3
- package/.docs/models/providers/hyper.md +7 -13
- package/.docs/models/providers/inceptron.md +1 -1
- package/.docs/models/providers/kilo.md +16 -16
- package/.docs/models/providers/llmgateway-providers.md +16 -8
- package/.docs/models/providers/llmgateway.md +4 -4
- package/.docs/models/providers/nano-gpt.md +12 -14
- package/.docs/models/providers/opencode-go.md +3 -1
- package/.docs/models/providers/opencode.md +2 -2
- package/.docs/models/providers/prime.md +1 -1
- package/.docs/models/providers/tencent-token-plan.md +2 -1
- package/.docs/models/providers/tencent-tokenhub.md +2 -1
- package/.docs/models/providers/wandb.md +3 -3
- package/.docs/reference/agents/agent.md +2 -0
- package/.docs/reference/agents/channels.md +38 -1
- package/.docs/reference/agents/durable-agent.md +37 -26
- package/.docs/reference/auth/neon.md +24 -15
- package/.docs/reference/cli/mastra.md +10 -1
- package/.docs/reference/client-js/agents.md +4 -4
- package/.docs/reference/client-js/observability.md +23 -1
- package/.docs/reference/connect/channels.md +55 -1
- package/.docs/reference/connect/providers.md +5 -3
- package/.docs/reference/connect/tools.md +29 -2
- package/.docs/reference/core/getGatewayById.md +14 -1
- package/.docs/reference/observability/tracing/advanced-queries.md +47 -58
- package/.docs/reference/pubsub/redis-streams.md +2 -0
- package/.docs/reference/streaming/agents/MastraModelOutput.md +6 -4
- package/.docs/reference/tools/mcp-server.md +6 -2
- package/.docs/reference/workflows/workflow.md +1 -1
- package/package.json +4 -4
- package/.docs/docs/mastra-platform/connect/channels.md +0 -165
- package/.docs/docs/mastra-platform/connect/overview.md +0 -102
- package/.docs/docs/mastra-platform/connect/providers.md +0 -66
- package/.docs/docs/mastra-platform/connect/tools.md +0 -151
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# NanoGPT
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 636 NanoGPT models through Mastra's model router. Authentication is handled automatically using the `NANO_GPT_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [NanoGPT documentation](https://docs.nano-gpt.com).
|
|
10
10
|
|
|
@@ -128,8 +128,8 @@ for await (const chunk of stream) {
|
|
|
128
128
|
| `nano-gpt/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
129
129
|
| `nano-gpt/deepseek/deepseek-v4-flash-0423` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
130
130
|
| `nano-gpt/deepseek/deepseek-v4-flash-0423:thinking` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
131
|
-
| `nano-gpt/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.
|
|
132
|
-
| `nano-gpt/deepseek/deepseek-v4-flash-0731:thinking` | 1.0M | | | | | | $0.
|
|
131
|
+
| `nano-gpt/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.04 | $0.13 |
|
|
132
|
+
| `nano-gpt/deepseek/deepseek-v4-flash-0731:thinking` | 1.0M | | | | | | $0.04 | $0.13 |
|
|
133
133
|
| `nano-gpt/deepseek/deepseek-v4-flash-latest` | 1.0M | | | | | | $0.10 | $0.60 |
|
|
134
134
|
| `nano-gpt/deepseek/deepseek-v4-flash-vision-exp` | 1.0M | | | | | | $0.22 | $0.65 |
|
|
135
135
|
| `nano-gpt/deepseek/deepseek-v4-flash:thinking` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
@@ -137,7 +137,7 @@ for await (const chunk of stream) {
|
|
|
137
137
|
| `nano-gpt/deepseek/deepseek-v4-pro-0813` | 1.0M | | | | | | $0.66 | $2 |
|
|
138
138
|
| `nano-gpt/deepseek/deepseek-v4-pro-0813:thinking` | 1.0M | | | | | | $0.66 | $2 |
|
|
139
139
|
| `nano-gpt/deepseek/deepseek-v4-pro:thinking` | 1.0M | | | | | | $0.70 | $1 |
|
|
140
|
-
| `nano-gpt/deepseek/deepseek-v4.1-flash` | 1.0M | | | | | | $0.
|
|
140
|
+
| `nano-gpt/deepseek/deepseek-v4.1-flash` | 1.0M | | | | | | $0.02 | $0.40 |
|
|
141
141
|
| `nano-gpt/deepseek/deepseek-v4.1-flash-0910-uncensored` | 524K | | | | | | $0.33 | $1 |
|
|
142
142
|
| `nano-gpt/deepseek/deepseek-v4.1-flash-0910-uncensored:thinking` | 524K | | | | | | $0.33 | $1 |
|
|
143
143
|
| `nano-gpt/deepseek/deepseek-v4.1-flash-1017` | 1.0M | | | | | | $0.10 | $0.60 |
|
|
@@ -146,7 +146,7 @@ for await (const chunk of stream) {
|
|
|
146
146
|
| `nano-gpt/deepseek/deepseek-v4.1-flash-1017:thinking` | 1.0M | | | | | | $0.10 | $0.60 |
|
|
147
147
|
| `nano-gpt/deepseek/deepseek-v4.1-flash-uncensored` | 1.0M | | | | | | $0.33 | $1 |
|
|
148
148
|
| `nano-gpt/deepseek/deepseek-v4.1-flash-uncensored:thinking` | 1.0M | | | | | | $0.33 | $1 |
|
|
149
|
-
| `nano-gpt/deepseek/deepseek-v4.1-flash:thinking` | 1.0M | | | | | | $0.
|
|
149
|
+
| `nano-gpt/deepseek/deepseek-v4.1-flash:thinking` | 1.0M | | | | | | $0.02 | $0.40 |
|
|
150
150
|
| `nano-gpt/Doctor-Shotgun/MS3.2-24B-Magnum-Diamond` | 33K | | | | | | $0.49 | $0.49 |
|
|
151
151
|
| `nano-gpt/doubao-seed-2-0-code-preview-260215` | 256K | | | | | | $0.78 | $4 |
|
|
152
152
|
| `nano-gpt/doubao-seed-2-0-lite-260215` | 256K | | | | | | $0.25 | $2 |
|
|
@@ -244,9 +244,9 @@ for await (const chunk of stream) {
|
|
|
244
244
|
| `nano-gpt/google/gemini-flash-latest` | 1.0M | | | | | | $0.75 | $4 |
|
|
245
245
|
| `nano-gpt/google/gemini-flash-lite-latest` | 1.0M | | | | | | $0.30 | $3 |
|
|
246
246
|
| `nano-gpt/google/gemini-pro-latest` | 1.0M | | | | | | $2 | $12 |
|
|
247
|
-
| `nano-gpt/google/gemma-4-26b-a4b-it` | 262K | | | | | | $0.
|
|
247
|
+
| `nano-gpt/google/gemma-4-26b-a4b-it` | 262K | | | | | | $0.06 | $0.17 |
|
|
248
248
|
| `nano-gpt/google/gemma-4-26b-a4b-it-cybersecurity` | 262K | | | | | | $0.11 | $0.33 |
|
|
249
|
-
| `nano-gpt/google/gemma-4-26b-a4b-it:thinking` | 262K | | | | | | $0.
|
|
249
|
+
| `nano-gpt/google/gemma-4-26b-a4b-it:thinking` | 262K | | | | | | $0.06 | $0.17 |
|
|
250
250
|
| `nano-gpt/google/gemma-4-31b-it` | 262K | | | | | | $0.14 | $0.40 |
|
|
251
251
|
| `nano-gpt/google/gemma-4-31b-it:thinking` | 262K | | | | | | $0.10 | $0.34 |
|
|
252
252
|
| `nano-gpt/google/gemma4-31b-splituntied` | 262K | | | | | | $0.10 | $0.30 |
|
|
@@ -363,9 +363,6 @@ for await (const chunk of stream) {
|
|
|
363
363
|
| `nano-gpt/nex-agi/nex-n2.5-mini` | 262K | | | | | | $0.03 | $0.10 |
|
|
364
364
|
| `nano-gpt/nex-agi/nex-n2.5-pro` | 262K | | | | | | $0.07 | $0.25 |
|
|
365
365
|
| `nano-gpt/nothingiisreal/L3.1-70B-Celeste-V0.1-BF16` | 33K | | | | | | $0.49 | $0.49 |
|
|
366
|
-
| `nano-gpt/NousResearch/hermes-3-llama-3.1-70b` | 66K | | | | | | $0.41 | $0.41 |
|
|
367
|
-
| `nano-gpt/NousResearch/hermes-4-405b` | 128K | | | | | | $0.30 | $1 |
|
|
368
|
-
| `nano-gpt/NousResearch/hermes-4-405b:thinking` | 128K | | | | | | $0.30 | $1 |
|
|
369
366
|
| `nano-gpt/nvidia/Llama-3.1-Nemotron-70B-Instruct-HF` | 16K | | | | | | $0.36 | $0.41 |
|
|
370
367
|
| `nano-gpt/nvidia/Llama-3.3-Nemotron-Super-49B-v1` | 128K | | | | | | $0.15 | $0.15 |
|
|
371
368
|
| `nano-gpt/nvidia/nemotron-3-nano-30b-a3b` | 262K | | | | | | $0.17 | $0.68 |
|
|
@@ -421,7 +418,7 @@ for await (const chunk of stream) {
|
|
|
421
418
|
| `nano-gpt/openai/gpt-latest` | 1.1M | | | | | | $10 | $50 |
|
|
422
419
|
| `nano-gpt/openai/gpt-luna-latest` | 1.1M | | | | | | $0.10 | $0.50 |
|
|
423
420
|
| `nano-gpt/openai/gpt-oss-120b` | 128K | | | | | | $0.03 | $0.15 |
|
|
424
|
-
| `nano-gpt/openai/gpt-oss-20b` | 131K | | | | | | $0.
|
|
421
|
+
| `nano-gpt/openai/gpt-oss-20b` | 131K | | | | | | $0.00 | $0.02 |
|
|
425
422
|
| `nano-gpt/openai/gpt-oss-safeguard-20b` | 131K | | | | | | $0.07 | $0.30 |
|
|
426
423
|
| `nano-gpt/openai/gpt-sol-latest` | 1.1M | | | | | | $2 | $10 |
|
|
427
424
|
| `nano-gpt/openai/gpt-terra-latest` | 1.1M | | | | | | $1 | $5 |
|
|
@@ -430,6 +427,7 @@ for await (const chunk of stream) {
|
|
|
430
427
|
| `nano-gpt/openai/o3` | 200K | | | | | | $2 | $8 |
|
|
431
428
|
| `nano-gpt/openai/o3-mini-low` | 200K | | | | | | $1 | $4 |
|
|
432
429
|
| `nano-gpt/openai/o3-pro-2025-06-10` | 200K | | | | | | $22 | $88 |
|
|
430
|
+
| `nano-gpt/orca/orcacyber-k3.1-pro` | 1.0M | | | | | | $4 | $20 |
|
|
433
431
|
| `nano-gpt/orca/orcacyber-minimax-m3.1-flash` | 262K | | | | | | $0.80 | $2 |
|
|
434
432
|
| `nano-gpt/orca/orcacyber-qwen3.8-flash-next` | 262K | | | | | | $0.80 | $2 |
|
|
435
433
|
| `nano-gpt/orca/orcacyber-zero-1.5` | 999K | | | | | | $3 | $8 |
|
|
@@ -529,6 +527,7 @@ for await (const chunk of stream) {
|
|
|
529
527
|
| `nano-gpt/reflection/beam-1.0` | 1.0M | | | | | | $0.50 | $2 |
|
|
530
528
|
| `nano-gpt/reka/reka-edge-2603` | 16K | | | | | | $0.10 | $0.10 |
|
|
531
529
|
| `nano-gpt/reka/reka-flash-3` | 66K | | | | | | $0.10 | $0.21 |
|
|
530
|
+
| `nano-gpt/ricursiveai/ripple-65b-preview` | 16K | | | | | | $0.20 | $0.60 |
|
|
532
531
|
| `nano-gpt/sakana/fugu-max` | 1.0M | | | | | | $2 | $6 |
|
|
533
532
|
| `nano-gpt/sakana/fugu-ultra` | 1.0M | | | | | | $5 | $30 |
|
|
534
533
|
| `nano-gpt/sakana/fugu-ultra-v1.1` | 1.0M | | | | | | $5 | $30 |
|
|
@@ -572,7 +571,6 @@ for await (const chunk of stream) {
|
|
|
572
571
|
| `nano-gpt/TEE/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
573
572
|
| `nano-gpt/TEE/llama3-3-70b` | 128K | | | | | | $2 | $3 |
|
|
574
573
|
| `nano-gpt/TEE/qwen2.5-vl-72b-instruct` | 66K | | | | | | $0.70 | $0.70 |
|
|
575
|
-
| `nano-gpt/TEE/qwen3.5-27b` | 262K | | | | | | $0.30 | $2 |
|
|
576
574
|
| `nano-gpt/TEE/qwen3.5-397b-a17b` | 262K | | | | | | $0.55 | $4 |
|
|
577
575
|
| `nano-gpt/TEE/qwen3.6-27b` | 262K | | | | | | $0.32 | $3 |
|
|
578
576
|
| `nano-gpt/TEE/qwen3.6-35b-a3b` | 262K | | | | | | $0.20 | $1 |
|
|
@@ -654,8 +652,8 @@ for await (const chunk of stream) {
|
|
|
654
652
|
| `nano-gpt/z-ai/glm-5:thinking` | 200K | | | | | | $0.60 | $2 |
|
|
655
653
|
| `nano-gpt/z-ai/glm-5.1` | 200K | | | | | | $0.70 | $3 |
|
|
656
654
|
| `nano-gpt/z-ai/glm-5.1:thinking` | 200K | | | | | | $0.70 | $3 |
|
|
657
|
-
| `nano-gpt/z-ai/glm-5.2` | 1.0M | | | | | | $0.
|
|
658
|
-
| `nano-gpt/z-ai/glm-5.2:thinking` | 1.0M | | | | | | $0.
|
|
655
|
+
| `nano-gpt/z-ai/glm-5.2` | 1.0M | | | | | | $0.19 | $0.59 |
|
|
656
|
+
| `nano-gpt/z-ai/glm-5.2:thinking` | 1.0M | | | | | | $0.19 | $0.59 |
|
|
659
657
|
| `nano-gpt/z-ai/glm-5.3` | 1.0M | | | | | | $0.60 | $1 |
|
|
660
658
|
| `nano-gpt/z-ai/glm-5.3-flash` | 1.0M | | | | | | $0.10 | $0.30 |
|
|
661
659
|
| `nano-gpt/z-ai/glm-5.3-flash-apex` | 1.0M | | | | | | $0.15 | $0.50 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenCode Go
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 39 OpenCode Go models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [OpenCode Go documentation](https://opencode.ai/v2/docs/console/go/).
|
|
10
10
|
|
|
@@ -40,6 +40,7 @@ for await (const chunk of stream) {
|
|
|
40
40
|
| ---------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
41
|
| `opencode-go/beam-free` | 1.0M | | | | | | — | — |
|
|
42
42
|
| `opencode-go/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
43
|
+
| `opencode-go/crouton-alpha-free` | 1.0M | | | | | | — | — |
|
|
43
44
|
| `opencode-go/deepseek-v4-pro` | 1.0M | | | | | | $0.66 | $2 |
|
|
44
45
|
| `opencode-go/deepseek-v4.1-flash` | 1.0M | | | | | | $0.15 | $0.60 |
|
|
45
46
|
| `opencode-go/gemini-4-argon` | 1.0M | | | | | | $2 | $10 |
|
|
@@ -50,6 +51,7 @@ for await (const chunk of stream) {
|
|
|
50
51
|
| `opencode-go/gpt-6-luna` | 1.1M | | | | | | $0.10 | $0.50 |
|
|
51
52
|
| `opencode-go/grok-4.7` | 500K | | | | | | $2 | $6 |
|
|
52
53
|
| `opencode-go/hy3` | 256K | | | | | | $0.14 | $0.58 |
|
|
54
|
+
| `opencode-go/hy4` | 1.0M | | | | | | $0.83 | $3 |
|
|
53
55
|
| `opencode-go/hy4-preview` | 1.0M | | | | | | $0.83 | $3 |
|
|
54
56
|
| `opencode-go/iceman-contributor-free` | 262K | | | | | | — | — |
|
|
55
57
|
| `opencode-go/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenCode
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 133 OpenCode models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [OpenCode documentation](https://opencode.ai/v2/docs/console/models/).
|
|
10
10
|
|
|
@@ -101,6 +101,7 @@ for await (const chunk of stream) {
|
|
|
101
101
|
| `opencode/grok-4.6` | 500K | | | | | | $2 | $6 |
|
|
102
102
|
| `opencode/grok-4.7` | 500K | | | | | | $2 | $6 |
|
|
103
103
|
| `opencode/grok-build-0.1` | 256K | | | | | | $1 | $2 |
|
|
104
|
+
| `opencode/iceman-free` | 262K | | | | | | — | — |
|
|
104
105
|
| `opencode/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
|
|
105
106
|
| `opencode/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
106
107
|
| `opencode/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
|
|
@@ -115,7 +116,6 @@ for await (const chunk of stream) {
|
|
|
115
116
|
| `opencode/muse-wonder-1.0` | 1.0M | | | | | | $4 | $20 |
|
|
116
117
|
| `opencode/nemotron-3.5-lightning-free` | 262K | | | | | | — | — |
|
|
117
118
|
| `opencode/nemotron-3.5-super-vl-free` | 1.0M | | | | | | — | — |
|
|
118
|
-
| `opencode/pulse-alpha-free` | 1.0M | | | | | | — | — |
|
|
119
119
|
| `opencode/qwen3.5-plus` | 262K | | | | | | $0.20 | $1 |
|
|
120
120
|
| `opencode/qwen3.6-plus` | 262K | | | | | | $0.50 | $3 |
|
|
121
121
|
| `opencode/qwen3.8-flash` | 1.0M | | | | | | $0.15 | $0.47 |
|
|
@@ -52,7 +52,7 @@ for await (const chunk of stream) {
|
|
|
52
52
|
| `prime/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.44 | $1 |
|
|
53
53
|
| `prime/deepseek/deepseek-v4-pro` | 1.0M | | | | | | $2 | $4 |
|
|
54
54
|
| `prime/deepseek/deepseek-v4.1-flash` | 1.0M | | | | | | $0.16 | $1 |
|
|
55
|
-
| `prime/deepseek/deepseek-v4.1-flash-1017` | 1.0M | | | | | | $0.
|
|
55
|
+
| `prime/deepseek/deepseek-v4.1-flash-1017` | 1.0M | | | | | | $0.11 | $1 |
|
|
56
56
|
| `prime/google/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
|
|
57
57
|
| `prime/google/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
|
|
58
58
|
| `prime/google/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Tencent Token Plan
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 3 Tencent Token Plan models through Mastra's model router. Authentication is handled automatically using the `TENCENT_TOKEN_PLAN_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Tencent Token Plan documentation](https://cloud.tencent.com/document/product/1823/130060).
|
|
10
10
|
|
|
@@ -39,6 +39,7 @@ for await (const chunk of stream) {
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| -------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
41
|
| `tencent-token-plan/hy3` | 256K | | | | | | — | — |
|
|
42
|
+
| `tencent-token-plan/hy4` | 1.0M | | | | | | $0.83 | $3 |
|
|
42
43
|
| `tencent-token-plan/hy4-preview` | 1.0M | | | | | | $0.83 | $3 |
|
|
43
44
|
|
|
44
45
|
Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Tencent TokenHub
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 4 Tencent TokenHub models through Mastra's model router. Authentication is handled automatically using the `TENCENT_TOKENHUB_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Tencent TokenHub documentation](https://cloud.tencent.com/document/product/1823/130050).
|
|
10
10
|
|
|
@@ -40,6 +40,7 @@ for await (const chunk of stream) {
|
|
|
40
40
|
| ------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
41
|
| `tencent-tokenhub/hy3` | 256K | | | | | | — | — |
|
|
42
42
|
| `tencent-tokenhub/hy3-preview` | 256K | | | | | | — | — |
|
|
43
|
+
| `tencent-tokenhub/hy4` | 1.0M | | | | | | $0.83 | $3 |
|
|
43
44
|
| `tencent-tokenhub/hy4-preview` | 1.0M | | | | | | $0.83 | $3 |
|
|
44
45
|
|
|
45
46
|
Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
|
|
@@ -38,8 +38,8 @@ for await (const chunk of stream) {
|
|
|
38
38
|
|
|
39
39
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
40
|
| ----------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
-
| `wandb/deepseek-ai/DeepSeek-V3.1` | 161K | | | | | | $0.
|
|
42
|
-
| `wandb/deepseek-ai/DeepSeek-V4-Flash-0731` | 262K | | | | | | $0.13 | $0.
|
|
41
|
+
| `wandb/deepseek-ai/DeepSeek-V3.1` | 161K | | | | | | $0.50 | $2 |
|
|
42
|
+
| `wandb/deepseek-ai/DeepSeek-V4-Flash-0731` | 262K | | | | | | $0.13 | $0.27 |
|
|
43
43
|
| `wandb/deepseek-ai/DeepSeek-V4-Pro-0813` | 1.0M | | | | | | $1 | $4 |
|
|
44
44
|
| `wandb/deepseek-ai/DeepSeek-V4.1-Flash` | 1.0M | | | | | | $0.13 | $0.65 |
|
|
45
45
|
| `wandb/deepseek-ai/DeepSeek-V4.1-Flash-1017` | 1.0M | | | | | | $0.30 | $1 |
|
|
@@ -56,7 +56,7 @@ for await (const chunk of stream) {
|
|
|
56
56
|
| `wandb/nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B` | 1.0M | | | | | | $0.15 | $0.50 |
|
|
57
57
|
| `wandb/openai/gpt-oss-120b` | 131K | | | | | | $0.03 | $0.17 |
|
|
58
58
|
| `wandb/openai/gpt-oss-20b` | 131K | | | | | | $0.03 | $0.13 |
|
|
59
|
-
| `wandb/Qwen/Qwen3.6-35B-A3B` | 262K | | | | | | $0.10 | $0.
|
|
59
|
+
| `wandb/Qwen/Qwen3.6-35B-A3B` | 262K | | | | | | $0.10 | $0.89 |
|
|
60
60
|
| `wandb/Qwen/Qwen3.8-27B` | 262K | | | | | | $0.40 | $3 |
|
|
61
61
|
| `wandb/reflection/Beam-1.0-501B-A23B` | 1.0M | | | | | | $0.30 | $1 |
|
|
62
62
|
| `wandb/zai-org/GLM-5.2` | 1.0M | | | | | | $0.62 | $2 |
|
|
@@ -601,6 +601,8 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
601
601
|
|
|
602
602
|
**requestContextSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for validating request context values. When provided, the context is validated at the start of generate() or stream(), throwing a MastraError if validation fails.
|
|
603
603
|
|
|
604
|
+
**durable** (`boolean | { pubsub?: PubSub; cache?: MastraServerCache | false; shouldCache?: (topic: string) => boolean; cleanupTimeoutMs?: number }`): Publishes each run on its stream topic so another reader can follow it with observe() or reconnect after a disconnect. Omit to turn streams on when the agent is registered on Mastra and off for standalone agents. On a plain agent, pass false to stop publishing. This controls resumable streams only, not checkpoint execution. For durable execution, wrap the agent explicitly with createDurableAgent(). See Resumable streams.
|
|
605
|
+
|
|
604
606
|
**editor** (`false | { instructions?: boolean; tools?: boolean | { description?: boolean }; model?: boolean }`): Controls which fields the editor can override for this code-defined agent. Omit to allow editing instructions and tools. See Editor overrides below.
|
|
605
607
|
|
|
606
608
|
## `generate()` memory options
|
|
@@ -51,7 +51,7 @@ The `channels` property accepts a `ChannelConfig` object with the following fiel
|
|
|
51
51
|
|
|
52
52
|
**threadContext** (`{ maxMessages?: number; addSystemMessage?: boolean }`): How the agent picks up context about the current thread. maxMessages sets how many platform messages are saved to memory on first mention: the thread's first message plus up to maxMessages - 1 recent messages, with an omitted-count marker between them when needed (set to 0 to disable; only applies to non-DM threads). addSystemMessage: false skips the built-in system message that tells the agent which channel/platform a request came from. (Default: `{ maxMessages: 10, addSystemMessage: true }`)
|
|
53
53
|
|
|
54
|
-
**chatOptions** (`Omit<ChatConfig, 'adapters' | 'state' | 'userName'>`): Additional options passed directly to the Chat SDK. Use for advanced configuration such as dedupeTtlMs, fallbackStreamingPlaceholderText, lockScope, and messageHistory.
|
|
54
|
+
**chatOptions** (`Omit<ChatConfig, 'adapters' | 'state' | 'userName'>`): Additional options passed directly to the Chat SDK. Use for advanced configuration such as dedupeTtlMs, fallbackStreamingPlaceholderText, lockScope, and messageHistory. logger defaults to the Mastra logger. Set it to use a different logger or a Chat SDK log level.
|
|
55
55
|
|
|
56
56
|
**resolveResourceId** (`(ctx: ResolveResourceIdContext) => string | Promise<string>`): Decide which resourceId owns resource-level memory for a channel thread, separately from who sent the message. Runs only when a new thread is created; reused threads keep their stored owner and never call the hook. Return ctx.defaultResourceId (${platform}:${message.author.userId}) to keep the built-in behavior.
|
|
57
57
|
|
|
@@ -480,6 +480,43 @@ type InlineLinkEntry =
|
|
|
480
480
|
| { match: string; mimeType: string } // Domain + forced mime type (skips HEAD)
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
+
## `toChatLogger()`
|
|
484
|
+
|
|
485
|
+
Adapts a Mastra logger to the Chat SDK `Logger` interface. Pass the result to an adapter's `logger` option so its logs go to the same logger as the rest of your app. See [Logging](https://mastra.ai/docs/channels) for when to use it.
|
|
486
|
+
|
|
487
|
+
```typescript
|
|
488
|
+
import { toChatLogger } from '@mastra/core/channels'
|
|
489
|
+
import { createDiscordAdapter } from '@chat-adapter/discord'
|
|
490
|
+
import { PinoLogger } from '@mastra/loggers'
|
|
491
|
+
|
|
492
|
+
const logger = new PinoLogger({ name: 'app', level: 'info' })
|
|
493
|
+
|
|
494
|
+
const discord = createDiscordAdapter({
|
|
495
|
+
logger: toChatLogger(logger, { component: 'discord', minLevel: 'warn' }),
|
|
496
|
+
})
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
**logger** (`IMastraLogger`): The Mastra logger that receives the records.
|
|
500
|
+
|
|
501
|
+
**options** (`ToChatLoggerOptions`): Options for the bridge.
|
|
502
|
+
|
|
503
|
+
**options.minLevel** (`'debug' | 'info' | 'warn' | 'error' | 'silent'`): Lowest level to forward. 'silent' forwards nothing. With the default, the Mastra logger's own level decides what gets written.
|
|
504
|
+
|
|
505
|
+
**options.component** (`string`): Written as the component field on each record. child(prefix) extends it, so chat-sdk becomes chat-sdk:discord.
|
|
506
|
+
|
|
507
|
+
Returns: a Chat SDK `Logger`.
|
|
508
|
+
|
|
509
|
+
Extra log arguments become fields on the record:
|
|
510
|
+
|
|
511
|
+
| Arguments | Fields |
|
|
512
|
+
| -------------------- | -------------------------------- |
|
|
513
|
+
| None | `component` |
|
|
514
|
+
| One `Error` | `error`, `component` |
|
|
515
|
+
| One non-array object | The object's fields, `component` |
|
|
516
|
+
| Anything else | `args`, `component` |
|
|
517
|
+
|
|
518
|
+
An `Error` passed directly or under an object's `error` key is normalized so it keeps its message and stack when serialized.
|
|
519
|
+
|
|
483
520
|
## Related
|
|
484
521
|
|
|
485
522
|
- [Channels overview](https://mastra.ai/docs/channels): Concepts, quickstart, and platform setup
|
|
@@ -41,28 +41,9 @@ const text = await output.text
|
|
|
41
41
|
cleanup()
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### Plain Agent stream configuration
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
import { Mastra } from '@mastra/core'
|
|
50
|
-
import { Agent } from '@mastra/core/agent'
|
|
51
|
-
|
|
52
|
-
const myAgent = new Agent({
|
|
53
|
-
id: 'my-agent',
|
|
54
|
-
name: 'My Agent',
|
|
55
|
-
instructions: 'You are a helpful assistant',
|
|
56
|
-
model: 'openai/gpt-6.1-sol',
|
|
57
|
-
durable: true, // or: { maxSteps: 10, cleanupTimeoutMs: 60_000 }
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
export const mastra = new Mastra({
|
|
61
|
-
agents: { myAgent },
|
|
62
|
-
})
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
`mastra.getAgent('myAgent')` returns the wrapped `DurableAgent`. Standalone agents (constructed but never registered on a `Mastra` instance) don't become durable. The wrapping is applied at registration.
|
|
46
|
+
The `durable` option on a plain `Agent` controls resumable streams only. It never wraps the agent or enables checkpoints. Use `createDurableAgent({ agent })` explicitly for durable execution, and pass execution options such as `maxSteps` and `shouldPersistSnapshot` to that factory.
|
|
66
47
|
|
|
67
48
|
## `createDurableAgent(options)`
|
|
68
49
|
|
|
@@ -86,7 +67,7 @@ Returns: `DurableAgent`
|
|
|
86
67
|
|
|
87
68
|
**cache** (`MastraServerCache | false`): Cache for stored stream events, which enables resumable streams. If omitted, the agent inherits the cache from the Mastra instance, or uses an InMemoryServerCache. Set to false to disable caching, which makes streams non-resumable.
|
|
88
69
|
|
|
89
|
-
**pubsub** (`PubSub`): PubSub instance for streaming events. (Default: `EventEmitterPubSub`)
|
|
70
|
+
**pubsub** (`PubSub`): PubSub instance for streaming events. Takes precedence over mastra.pubsub. When omitted, a registered agent publishes on mastra.pubsub and an unregistered agent uses an in-process EventEmitterPubSub. (Default: `mastra.pubsub, or EventEmitterPubSub when unregistered`)
|
|
90
71
|
|
|
91
72
|
**maxSteps** (`number`): Maximum number of steps for the agentic loop.
|
|
92
73
|
|
|
@@ -112,7 +93,7 @@ Returns: `EventedAgent` (a subclass of `DurableAgent`)
|
|
|
112
93
|
|
|
113
94
|
**cache** (`MastraServerCache | false`): Cache for stored stream events, which enables resumable streams. If omitted, the agent inherits the cache from the Mastra instance, or uses an InMemoryServerCache. Set to false to disable caching.
|
|
114
95
|
|
|
115
|
-
**pubsub** (`PubSub`): PubSub instance for streaming events. (Default: `EventEmitterPubSub`)
|
|
96
|
+
**pubsub** (`PubSub`): PubSub instance for streaming events. Once the agent is registered, evented run frames use mastra.pubsub instead, because evented steps publish there. (Default: `mastra.pubsub, or EventEmitterPubSub when unregistered`)
|
|
116
97
|
|
|
117
98
|
**maxSteps** (`number`): Maximum number of steps for the agentic loop.
|
|
118
99
|
|
|
@@ -132,7 +113,7 @@ The `DurableAgent` class accepts the same options as `createDurableAgent`, plus
|
|
|
132
113
|
|
|
133
114
|
**cache** (`MastraServerCache | false`): Cache for stored stream events. If omitted, inherits from the Mastra instance or uses an InMemoryServerCache. Set to false to disable caching.
|
|
134
115
|
|
|
135
|
-
**pubsub** (`PubSub`): PubSub instance for streaming events. (Default: `EventEmitterPubSub`)
|
|
116
|
+
**pubsub** (`PubSub`): PubSub instance for streaming events. Takes precedence over mastra.pubsub. When omitted, a registered agent publishes on mastra.pubsub and an unregistered agent uses an in-process EventEmitterPubSub. (Default: `mastra.pubsub, or EventEmitterPubSub when unregistered`)
|
|
136
117
|
|
|
137
118
|
**maxSteps** (`number`): Maximum number of steps for the agentic loop.
|
|
138
119
|
|
|
@@ -195,11 +176,41 @@ const { output } = await durableAgent.observe(runId, {
|
|
|
195
176
|
await output.text
|
|
196
177
|
```
|
|
197
178
|
|
|
198
|
-
The `offset` option is an inclusive, zero-based PubSub event index. It counts every cached event published to the run topic, including lifecycle events, rather than counting chunks.
|
|
179
|
+
The `offset` option is an inclusive, zero-based PubSub event index. It counts every cached event published to the run topic, including lifecycle events, rather than counting chunks. A chunk read from the run log carries the index of its event as `chunk.index`, on `stream()`, `observe()`, and the HTTP `/stream` and `/observe` endpoints. To resume after a dropped connection, pass `index + 1` of the last chunk that has an index, or omit `offset` if nothing arrived. Lifecycle events take an index but produce no chunk, so indexes have gaps and a chunk count isn't a valid offset.
|
|
180
|
+
|
|
181
|
+
Some chunks carry no `index`. The client builds `object` chunks itself rather than reading them from the log. An `abort` chunk is sent beside the `finish` of the same run-log entry, and only the `finish` carries the index, so a client that reconnects between the two gets the `abort` again.
|
|
182
|
+
|
|
183
|
+
A run that used a structuring model publishes its `object-result` to the run log, so that chunk carries an `index` and replays like any other. A core `observe()` caller holding the schema can also rebuild structured output from replayed text, but gets `object-result` only when it replays the text that produced it. HTTP `/observe` replays the log and doesn't rebuild it. To rebuild it after a reconnect, observe without an `offset` and skip chunks whose `index` you already processed. That replay also rebuilds `object` chunks you already received, and they have no `index` to skip by. Each `object` chunk is a snapshot of the object so far, so keep the latest one. Indexes come from the replay cache, so a chunk whose cache write failed, or any chunk when caching is off, has no `index`, so no offset can resume at it. Omitting `offset` replays whatever the transport itself retains, such as a Redis stream, and can repeat chunks you already received. The paragraphs below cover offsets past the end and transports without numeric offsets.
|
|
184
|
+
|
|
185
|
+
`index` is additive and `offset` keeps its meaning, so code that already passes a log position, or replays from `0`, needs no change. Code that passed a count of chunks received should switch to the last `index + 1`.
|
|
186
|
+
|
|
187
|
+
The following example records the resume offset while streaming and passes it to `observe()` after a reconnect:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
let offset: number | undefined
|
|
191
|
+
const { output } = await durableAgent.stream(messages, { runId })
|
|
192
|
+
for await (const chunk of output.fullStream) {
|
|
193
|
+
if (chunk.index === undefined) continue
|
|
194
|
+
offset = chunk.index + 1
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// After a dropped connection:
|
|
198
|
+
const { output: resumed } = await durableAgent.observe(runId, { offset })
|
|
199
|
+
```
|
|
199
200
|
|
|
200
201
|
A non-zero offset can skip earlier events. Aggregated values are built only from chunks delivered to that observer. If the offset skips earlier text deltas, `output.text` is partial and structured output may be incomplete or fail validation or parsing.
|
|
201
202
|
|
|
202
|
-
When the PubSub transport supports numeric offsets,
|
|
203
|
+
When the PubSub transport supports numeric offsets, the observer receives numbered events only when the published index reaches the requested offset. An offset beyond the highest retained index replays nothing and also skips live events with lower indexes.
|
|
204
|
+
|
|
205
|
+
An event without an `index`, such as one whose cache write failed, is delivered as it arrives whatever the offset.
|
|
206
|
+
|
|
207
|
+
If the retained log expires or is cleared and numbering restarts at `0` while an observer is attached, that observer resyncs to the new log and receives its events, including ones below the requested offset. Detection is best effort. If the cache can't be read at that moment, or the new log has numbered past the observer's position before its first event arrives, the observer can miss the restart and skip those events instead. An observer that reconnects after the restart with an offset from the old log can't tell the logs apart and skips the new log's events below that offset, so omit `offset` to replay the new log.
|
|
208
|
+
|
|
209
|
+
On a transport without numeric offset support, such as `RedisStreamsPubSub` with caching off, `observe()` with any offset, including `0`, starts with new live events and doesn't replay retained events. This is the same in core and over HTTP `/observe`. Omit `offset` to replay them. (HTTP `/observe` on a plain `Agent` replays the retained events instead, which can repeat events already received.)
|
|
210
|
+
|
|
211
|
+
Indexed replay is limited to events still available in the configured cache. The cache has nothing to replay when caching is disabled, `shouldCache` excludes the run topic, or retained events have been cleared. Omitting `offset` then replays only what the transport itself retains, if anything.
|
|
212
|
+
|
|
213
|
+
A failed cache write loses only that event from the cache. It has no `index`, and the events written before and after it still replay when the cache numbers and appends an event in one step. The in-memory and Valkey caches always do. `RedisServerCache` does while Redis scripting works, and switches to two steps when the client has no `eval` or Redis Cluster rejects the script with `CROSSSLOT`. A custom cache that keeps the default `listPushIndexed()` also takes two steps. A two-step cache can leave a gap that makes offset replay skip later events, so replay such a log without an `offset` and skip indexes already processed. Cache replay can't recover an event the cache never stored. A transport that retains it, such as `RedisStreamsPubSub`, can still deliver it without an `index`.
|
|
203
214
|
|
|
204
215
|
An evented agent (`createEventedAgent()`) on a cross-process PubSub, such as Redis Streams, numbers its events only when every process shares the server cache. Configure a shared cache such as `RedisServerCache` on the `Mastra` instance. With the default in-memory server cache, events aren't numbered, so an offset can't skip them: the observer can receive events from before the offset again, and Mastra logs a warning.
|
|
205
216
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# `MastraAuthNeon` and `MastraRBACNeon`
|
|
6
6
|
|
|
7
|
-
[`MastraAuthNeon`](https://github.com/mastra-ai/mastra/tree/main/auth/neon) connects Mastra authentication to [Neon Auth](https://neon.com/docs/guides/neon-auth). It
|
|
7
|
+
[`MastraAuthNeon`](https://github.com/mastra-ai/mastra/tree/main/auth/neon) connects Mastra authentication to [Neon Auth](https://neon.com/docs/guides/neon-auth). It verifies Neon Auth JWTs sent as bearer tokens with Neon Auth's JWKS endpoint and validates Neon Auth session cookies through its session API. The provider also supports email-and-password sign-in, sign-up, and session management.
|
|
8
8
|
|
|
9
9
|
`MastraRBACNeon` maps Neon Auth organization roles to Mastra permissions. Register it separately when your application uses Neon Auth organization memberships for role-based access control.
|
|
10
10
|
|
|
@@ -34,7 +34,9 @@ export const mastra = new Mastra({
|
|
|
34
34
|
})
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Set `NEON_AUTH_BASE_URL` to
|
|
37
|
+
Set `NEON_AUTH_BASE_URL` to the Neon Auth URL shown in the Neon Console, for example `https://ep-example-123456.neonauth.us-east-2.aws.neon.tech/neondb/auth`. You can also pass `baseUrl` directly to both constructors.
|
|
38
|
+
|
|
39
|
+
Visit the [Neon integration guide](https://mastra.ai/integrations/auth/neon) for setup steps.
|
|
38
40
|
|
|
39
41
|
## `MastraAuthNeon`
|
|
40
42
|
|
|
@@ -42,13 +44,13 @@ Set `NEON_AUTH_BASE_URL` to your Neon Auth service URL. You can also pass `baseU
|
|
|
42
44
|
|
|
43
45
|
The `MastraAuthNeon` constructor accepts an optional `MastraAuthNeonOptions` object.
|
|
44
46
|
|
|
45
|
-
**baseUrl** (`string`): Neon Auth
|
|
47
|
+
**baseUrl** (`string`): Neon Auth URL, including the database path (for example /neondb/auth). Falls back to the NEON_AUTH_BASE_URL environment variable. Trailing slashes are removed. The JWT issuer and audience must equal the origin of this URL.
|
|
46
48
|
|
|
47
|
-
**jwksUrl** (`string`): JWKS endpoint used to verify bearer tokens. Falls back to NEON_AUTH_JWKS_URL, then \<baseUrl
|
|
49
|
+
**jwksUrl** (`string`): JWKS endpoint used to verify bearer tokens. Falls back to NEON_AUTH_JWKS_URL, then \<baseUrl>/.well-known/jwks.json.
|
|
48
50
|
|
|
49
|
-
**sessionCookieName** (`string`): Name of the Neon Auth session cookie. Defaults to
|
|
51
|
+
**sessionCookieName** (`string`): Name of the Neon Auth session cookie. Defaults to \_\_Secure-neon-auth.session_token.
|
|
50
52
|
|
|
51
|
-
**signUpEnabled** (`boolean`): Whether credentials-based sign-up is enabled. Defaults to true.
|
|
53
|
+
**signUpEnabled** (`boolean`): Whether credentials-based sign-up is enabled. When false, signUp() throws and no Neon Auth account is created. Defaults to true.
|
|
52
54
|
|
|
53
55
|
**name** (`string`): Provider name. Defaults to neon.
|
|
54
56
|
|
|
@@ -74,7 +76,9 @@ The `MastraAuthNeon` constructor accepts an optional `MastraAuthNeonOptions` obj
|
|
|
74
76
|
await auth.authenticateToken(token, request)
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
Verifies
|
|
79
|
+
Verifies a JWT-shaped token against the configured JWKS endpoint, checking its signature, issuer, audience, and expiry. Otherwise, validates the Neon Auth session cookie from the request through the session API. If JWT verification fails, the session cookie is still accepted, so an expired bearer token doesn't sign out a client that also sends cookies. When the request has no session cookie, a non-JWT token is treated as the session cookie value. Returns the authenticated `NeonAuthUser`, or `null` when validation fails.
|
|
80
|
+
|
|
81
|
+
`NeonAuthUser` contains the top-level `id`, `email`, and `name`, the Neon Auth `user` object, and either the `session` (cookie authentication) or the verified `jwt` claims (bearer authentication).
|
|
78
82
|
|
|
79
83
|
#### `authorizeUser()`
|
|
80
84
|
|
|
@@ -92,7 +96,7 @@ Runs the configured custom authorization function when one is provided. Otherwis
|
|
|
92
96
|
const result = await auth.signIn(email, password, request)
|
|
93
97
|
```
|
|
94
98
|
|
|
95
|
-
Authenticates email-and-password credentials through Neon Auth. Returns the authenticated user,
|
|
99
|
+
Authenticates email-and-password credentials through Neon Auth. Returns the authenticated user, a Neon Auth JWT as `token`, and the Neon Auth session cookies. Neon Auth must trust the origin of the incoming request.
|
|
96
100
|
|
|
97
101
|
#### `signUp()`
|
|
98
102
|
|
|
@@ -100,7 +104,7 @@ Authenticates email-and-password credentials through Neon Auth. Returns the auth
|
|
|
100
104
|
const result = await auth.signUp(email, password, name, request)
|
|
101
105
|
```
|
|
102
106
|
|
|
103
|
-
Creates a Neon Auth account using email-and-password credentials. `name` is optional
|
|
107
|
+
Creates a Neon Auth account using email-and-password credentials. `name` is optional. When omitted, the provider derives a display name from the email address. Returns the same result as `signIn()`.
|
|
104
108
|
|
|
105
109
|
#### `isSignUpEnabled()`
|
|
106
110
|
|
|
@@ -139,10 +143,13 @@ Validates the session through Neon Auth. Neon Auth refreshes sessions automatica
|
|
|
139
143
|
#### `destroySession()`
|
|
140
144
|
|
|
141
145
|
```typescript
|
|
142
|
-
|
|
146
|
+
const sessionId = auth.getSessionIdFromRequest(request)
|
|
147
|
+
if (sessionId) await auth.destroySession(sessionId)
|
|
143
148
|
```
|
|
144
149
|
|
|
145
|
-
|
|
150
|
+
Pass the signed session cookie value from `getSessionIdFromRequest()`, not the `id` returned by `validateSession()`. `destroySession()` attempts to revoke that session through the Neon Auth sign-out endpoint. A network error or non-2xx response can leave the session active, and the method doesn't throw for these failures. When Mastra sends the header from `getClearSessionHeaders()`, it clears the matching cookie on the Mastra host, not a cookie on a separate Neon Auth host. A separate Neon Auth session can remain active after Studio sign-out.
|
|
151
|
+
|
|
152
|
+
Revoking a session doesn't invalidate an already-issued JWT. Bearer tokens that pass JWT verification can still authenticate because verification doesn't check the Neon Auth session. JWT verification doesn't require an expiration claim, so a token without one may remain usable after sign-out.
|
|
146
153
|
|
|
147
154
|
## `MastraRBACNeon`
|
|
148
155
|
|
|
@@ -152,11 +159,11 @@ The `MastraRBACNeon` constructor accepts a `MastraRBACNeonOptions` object.
|
|
|
152
159
|
|
|
153
160
|
**roleMapping** (`RoleMapping`): Maps Neon Auth role names to Mastra permission patterns. Use \_default to define permissions for unmapped roles.
|
|
154
161
|
|
|
155
|
-
**baseUrl** (`string`): Neon Auth
|
|
162
|
+
**baseUrl** (`string`): Neon Auth URL. Falls back to the NEON_AUTH_BASE_URL environment variable. Trailing slashes are removed.
|
|
156
163
|
|
|
157
|
-
**organizationId** (`string`):
|
|
164
|
+
**organizationId** (`string`): Organization whose membership role is used. Defaults to the active organization of the session.
|
|
158
165
|
|
|
159
|
-
**getUserRoles** (`(user: NeonAuthUser) => Promise<string[]> | string[]`): Custom function
|
|
166
|
+
**getUserRoles** (`(user: NeonAuthUser) => Promise<string[]> | string[]`): Custom function that returns role names for a user. Use it to assign roles to bearer JWT requests, which carry no organization roles.
|
|
160
167
|
|
|
161
168
|
**cache** (`{ ttlMs?: number; maxSize?: number }`): Role lookup cache configuration. The defaults are 60,000 ms and 1,000 entries.
|
|
162
169
|
|
|
@@ -168,7 +175,9 @@ The `MastraRBACNeon` constructor accepts a `MastraRBACNeonOptions` object.
|
|
|
168
175
|
const roles = await rbac.getRoles(user)
|
|
169
176
|
```
|
|
170
177
|
|
|
171
|
-
Returns roles from the configured `getUserRoles` function, the user's
|
|
178
|
+
Returns roles from the configured `getUserRoles` function when provided. Otherwise, when `organizationId` is set or the session has an active organization, returns the user's role in that organization, read from Neon Auth with the user's session cookie. Non-members get no roles. Without an organization, returns the user's Neon Auth role, such as `user` or `admin`.
|
|
179
|
+
|
|
180
|
+
Bearer JWT requests have no session, so they get no roles unless `getUserRoles` is provided. The JWT `role` claim (`authenticated`) is never used as a Mastra role.
|
|
172
181
|
|
|
173
182
|
#### `hasRole()`
|
|
174
183
|
|
|
@@ -877,6 +877,8 @@ Manages authentication for Mastra platform. Credentials are stored in `~/.mastra
|
|
|
877
877
|
|
|
878
878
|
Opens a browser for login and stores the credentials locally.
|
|
879
879
|
|
|
880
|
+
When browser sign-in is needed and there's no interactive terminal (in CI, when input or output is piped, or in an agent's shell), the command first prints how to authenticate headless shells, then still waits for browser sign-in. On the same machine, you can run `mastra auth login` once in your own terminal so later commands reuse the saved session. In CI or on another machine, set `MASTRA_API_TOKEN` and `MASTRA_ORG_ID` instead. Create the token from a signed-in terminal with [`mastra auth tokens create`](#mastra-auth-tokens-create) or in the dashboard. If the browser sign-in wait times out, the command exits with status 1. If `MASTRA_API_TOKEN` is already set in a non-interactive shell, the command skips browser sign-in: it verifies the token and checks that an organization is selected (from `MASTRA_ORG_ID` or saved credentials), then exits with status 0. If either check fails, it exits with status 1 and names what's missing.
|
|
881
|
+
|
|
880
882
|
### `mastra auth logout`
|
|
881
883
|
|
|
882
884
|
Removes stored credentials. If `MASTRA_API_TOKEN` is still set in the environment, the CLI warns that it will continue to be used.
|
|
@@ -943,7 +945,7 @@ Connects a provider to the project. When the organization already has connection
|
|
|
943
945
|
|
|
944
946
|
OAuth providers open the provider's consent screen in your browser and print its URL if you need to open it manually. API key and Basic auth providers prompt for credentials in the terminal and verify them before completing the connection. Providers with other auth types open a hosted connect page. The command waits until the connection becomes active before exiting.
|
|
945
947
|
|
|
946
|
-
Credential prompts require an interactive terminal, even with `--yes`. Run the command outside CI or connect through the platform UI.
|
|
948
|
+
Credential prompts require an interactive terminal, even with `--yes`. Run the command outside CI or connect through the platform UI. Each provider's [integration page](https://mastra.ai/docs/mastra-platform/connect) lists its API key and permission requirements.
|
|
947
949
|
|
|
948
950
|
Once a new connection is active, the command offers to set a display name so you can tell connections to the same provider apart. It lists the provider's existing connections, suggests a name that doesn't collide with them, and asks for confirmation if the chosen name duplicates another connection's name. Leave the field blank to skip naming. Setting a display name requires the organization admin role; if naming fails, the connection remains active.
|
|
949
951
|
|
|
@@ -1266,6 +1268,13 @@ Errors are written to `stderr` as JSON and return a non-zero exit code:
|
|
|
1266
1268
|
}
|
|
1267
1269
|
```
|
|
1268
1270
|
|
|
1271
|
+
The exit code reflects whether the request succeeded, not the contents of the response:
|
|
1272
|
+
|
|
1273
|
+
- `0`: The server returned a successful response. This includes empty results and payloads that report existing state, such as a tool result saying a record already exists. A tool that returns an object with an `error` field still exits `0`, so check the `data` payload when the tool reports its own failures.
|
|
1274
|
+
- `1`: The request failed. This includes an unreachable server, invalid JSON input, a missing resource, or a tool that throws an error.
|
|
1275
|
+
|
|
1276
|
+
If the command reading the output exits early, as with `| head`, the exit code still reflects whether the request succeeded.
|
|
1277
|
+
|
|
1269
1278
|
### Target resolution
|
|
1270
1279
|
|
|
1271
1280
|
For runtime commands, the command resolves the target server in this order:
|
|
@@ -914,9 +914,9 @@ const agent = await mastraClient.createStoredAgent({
|
|
|
914
914
|
})
|
|
915
915
|
```
|
|
916
916
|
|
|
917
|
-
####
|
|
917
|
+
#### Resumable streams for stored agents
|
|
918
918
|
|
|
919
|
-
Set `durable` to
|
|
919
|
+
Set `durable` to configure [resumable streams](https://mastra.ai/docs/agents/resumable-streams) on the hydrated plain agent. Pass `true` to enable streams, `false` to disable them, or an object to tune stream cleanup:
|
|
920
920
|
|
|
921
921
|
```typescript
|
|
922
922
|
const agent = await mastraClient.createStoredAgent({
|
|
@@ -927,11 +927,11 @@ const agent = await mastraClient.createStoredAgent({
|
|
|
927
927
|
provider: 'openai',
|
|
928
928
|
name: 'gpt-5.4',
|
|
929
929
|
},
|
|
930
|
-
durable: {
|
|
930
|
+
durable: { cleanupTimeoutMs: 0 },
|
|
931
931
|
})
|
|
932
932
|
```
|
|
933
933
|
|
|
934
|
-
Only serializable options are accepted
|
|
934
|
+
Only serializable options are accepted, with cache and pubsub inherited from the server's `Mastra` instance. Existing stored agents with `durable: true` also use this field for resumable streams only. To retain durable execution and checkpoint recovery, register a code agent wrapped with `createDurableAgent({ agent })`.
|
|
935
935
|
|
|
936
936
|
### `getStoredAgent()`
|
|
937
937
|
|