@mastra/mcp-docs-server 0.0.0-commonjs-20250414101718
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%2Fastra.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +161 -0
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +110 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +26 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +196 -0
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Frag.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +250 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +250 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +302 -0
- package/.docs/organized/changelogs/create-mastra.md +302 -0
- package/.docs/organized/changelogs/mastra.md +302 -0
- package/.docs/organized/code-examples/agent-network.md +282 -0
- package/.docs/organized/code-examples/agent.md +388 -0
- package/.docs/organized/code-examples/ai-sdk-useChat.md +378 -0
- package/.docs/organized/code-examples/assistant-ui.md +37 -0
- package/.docs/organized/code-examples/bird-checker-with-express.md +235 -0
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +360 -0
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +250 -0
- package/.docs/organized/code-examples/client-side-tools.md +69 -0
- package/.docs/organized/code-examples/crypto-chatbot.md +96 -0
- package/.docs/organized/code-examples/fireworks-r1.md +159 -0
- package/.docs/organized/code-examples/mcp-registry-registry.md +63 -0
- package/.docs/organized/code-examples/memory-todo-agent.md +164 -0
- package/.docs/organized/code-examples/memory-with-context.md +167 -0
- package/.docs/organized/code-examples/memory-with-libsql.md +204 -0
- package/.docs/organized/code-examples/memory-with-mem0.md +121 -0
- package/.docs/organized/code-examples/memory-with-pg.md +224 -0
- package/.docs/organized/code-examples/memory-with-upstash.md +268 -0
- package/.docs/organized/code-examples/quick-start.md +129 -0
- package/.docs/organized/code-examples/stock-price-tool.md +124 -0
- package/.docs/organized/code-examples/weather-agent.md +353 -0
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +159 -0
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +111 -0
- package/.docs/organized/code-examples/workflow-with-memory.md +393 -0
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +131 -0
- package/.docs/raw/agents/adding-tools.mdx +317 -0
- package/.docs/raw/agents/adding-voice.mdx +175 -0
- package/.docs/raw/agents/agent-memory.mdx +62 -0
- package/.docs/raw/agents/mcp-guide.mdx +215 -0
- package/.docs/raw/agents/overview.mdx +303 -0
- package/.docs/raw/community/discord.mdx +12 -0
- package/.docs/raw/community/licensing.mdx +63 -0
- package/.docs/raw/deployment/client.mdx +120 -0
- package/.docs/raw/deployment/deployment.mdx +127 -0
- package/.docs/raw/deployment/server.mdx +282 -0
- package/.docs/raw/evals/custom-eval.mdx +22 -0
- package/.docs/raw/evals/overview.mdx +95 -0
- package/.docs/raw/evals/running-in-ci.mdx +81 -0
- package/.docs/raw/evals/textual-evals.mdx +54 -0
- package/.docs/raw/faq/index.mdx +63 -0
- package/.docs/raw/frameworks/ai-sdk.mdx +296 -0
- package/.docs/raw/frameworks/next-js.mdx +238 -0
- package/.docs/raw/getting-started/installation.mdx +442 -0
- package/.docs/raw/getting-started/mcp-docs-server.mdx +141 -0
- package/.docs/raw/getting-started/project-structure.mdx +80 -0
- package/.docs/raw/index.mdx +22 -0
- package/.docs/raw/integrations/index.mdx +213 -0
- package/.docs/raw/local-dev/add-to-existing-project.mdx +48 -0
- package/.docs/raw/local-dev/creating-a-new-project.mdx +54 -0
- package/.docs/raw/local-dev/mastra-dev.mdx +108 -0
- package/.docs/raw/memory/memory-processors.mdx +131 -0
- package/.docs/raw/memory/overview.mdx +119 -0
- package/.docs/raw/memory/semantic-recall.mdx +122 -0
- package/.docs/raw/memory/working-memory.mdx +87 -0
- package/.docs/raw/observability/logging.mdx +38 -0
- package/.docs/raw/observability/nextjs-tracing.mdx +108 -0
- package/.docs/raw/observability/tracing.mdx +115 -0
- package/.docs/raw/rag/chunking-and-embedding.mdx +156 -0
- package/.docs/raw/rag/overview.mdx +85 -0
- package/.docs/raw/rag/retrieval.mdx +365 -0
- package/.docs/raw/rag/vector-databases.mdx +340 -0
- package/.docs/raw/reference/agents/createTool.mdx +229 -0
- package/.docs/raw/reference/agents/generate.mdx +334 -0
- package/.docs/raw/reference/agents/getAgent.mdx +54 -0
- package/.docs/raw/reference/agents/stream.mdx +369 -0
- package/.docs/raw/reference/cli/build.mdx +55 -0
- package/.docs/raw/reference/cli/dev.mdx +134 -0
- package/.docs/raw/reference/cli/init.mdx +43 -0
- package/.docs/raw/reference/client-js/agents.mdx +107 -0
- package/.docs/raw/reference/client-js/error-handling.mdx +38 -0
- package/.docs/raw/reference/client-js/logs.mdx +24 -0
- package/.docs/raw/reference/client-js/memory.mdx +97 -0
- package/.docs/raw/reference/client-js/telemetry.mdx +20 -0
- package/.docs/raw/reference/client-js/tools.mdx +44 -0
- package/.docs/raw/reference/client-js/vectors.mdx +79 -0
- package/.docs/raw/reference/client-js/workflows.mdx +136 -0
- package/.docs/raw/reference/core/mastra-class.mdx +232 -0
- package/.docs/raw/reference/deployer/cloudflare.mdx +207 -0
- package/.docs/raw/reference/deployer/deployer.mdx +159 -0
- package/.docs/raw/reference/deployer/netlify.mdx +109 -0
- package/.docs/raw/reference/deployer/vercel.mdx +117 -0
- package/.docs/raw/reference/evals/answer-relevancy.mdx +186 -0
- package/.docs/raw/reference/evals/bias.mdx +186 -0
- package/.docs/raw/reference/evals/completeness.mdx +174 -0
- package/.docs/raw/reference/evals/content-similarity.mdx +183 -0
- package/.docs/raw/reference/evals/context-position.mdx +190 -0
- package/.docs/raw/reference/evals/context-precision.mdx +189 -0
- package/.docs/raw/reference/evals/context-relevancy.mdx +188 -0
- package/.docs/raw/reference/evals/contextual-recall.mdx +191 -0
- package/.docs/raw/reference/evals/faithfulness.mdx +193 -0
- package/.docs/raw/reference/evals/hallucination.mdx +219 -0
- package/.docs/raw/reference/evals/keyword-coverage.mdx +176 -0
- package/.docs/raw/reference/evals/prompt-alignment.mdx +238 -0
- package/.docs/raw/reference/evals/summarization.mdx +205 -0
- package/.docs/raw/reference/evals/textual-difference.mdx +161 -0
- package/.docs/raw/reference/evals/tone-consistency.mdx +181 -0
- package/.docs/raw/reference/evals/toxicity.mdx +165 -0
- package/.docs/raw/reference/index.mdx +12 -0
- package/.docs/raw/reference/memory/Memory.mdx +212 -0
- package/.docs/raw/reference/memory/createThread.mdx +95 -0
- package/.docs/raw/reference/memory/getThreadById.mdx +46 -0
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +48 -0
- package/.docs/raw/reference/memory/query.mdx +167 -0
- package/.docs/raw/reference/networks/agent-network.mdx +159 -0
- package/.docs/raw/reference/observability/create-logger.mdx +106 -0
- package/.docs/raw/reference/observability/logger.mdx +55 -0
- package/.docs/raw/reference/observability/otel-config.mdx +120 -0
- package/.docs/raw/reference/observability/providers/braintrust.mdx +40 -0
- package/.docs/raw/reference/observability/providers/dash0.mdx +40 -0
- package/.docs/raw/reference/observability/providers/index.mdx +16 -0
- package/.docs/raw/reference/observability/providers/laminar.mdx +41 -0
- package/.docs/raw/reference/observability/providers/langfuse.mdx +51 -0
- package/.docs/raw/reference/observability/providers/langsmith.mdx +48 -0
- package/.docs/raw/reference/observability/providers/langwatch.mdx +45 -0
- package/.docs/raw/reference/observability/providers/new-relic.mdx +40 -0
- package/.docs/raw/reference/observability/providers/signoz.mdx +40 -0
- package/.docs/raw/reference/observability/providers/traceloop.mdx +40 -0
- package/.docs/raw/reference/rag/astra.mdx +258 -0
- package/.docs/raw/reference/rag/chroma.mdx +281 -0
- package/.docs/raw/reference/rag/chunk.mdx +235 -0
- package/.docs/raw/reference/rag/document.mdx +127 -0
- package/.docs/raw/reference/rag/embeddings.mdx +160 -0
- package/.docs/raw/reference/rag/extract-params.mdx +226 -0
- package/.docs/raw/reference/rag/graph-rag.mdx +182 -0
- package/.docs/raw/reference/rag/libsql.mdx +357 -0
- package/.docs/raw/reference/rag/metadata-filters.mdx +298 -0
- package/.docs/raw/reference/rag/pg.mdx +477 -0
- package/.docs/raw/reference/rag/pinecone.mdx +281 -0
- package/.docs/raw/reference/rag/qdrant.mdx +236 -0
- package/.docs/raw/reference/rag/rerank.mdx +212 -0
- package/.docs/raw/reference/rag/turbopuffer.mdx +249 -0
- package/.docs/raw/reference/rag/upstash.mdx +247 -0
- package/.docs/raw/reference/rag/vectorize.mdx +298 -0
- package/.docs/raw/reference/storage/libsql.mdx +74 -0
- package/.docs/raw/reference/storage/postgresql.mdx +48 -0
- package/.docs/raw/reference/storage/upstash.mdx +86 -0
- package/.docs/raw/reference/tools/client.mdx +207 -0
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +141 -0
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +154 -0
- package/.docs/raw/reference/tools/mcp-configuration.mdx +206 -0
- package/.docs/raw/reference/tools/vector-query-tool.mdx +212 -0
- package/.docs/raw/reference/voice/composite-voice.mdx +140 -0
- package/.docs/raw/reference/voice/deepgram.mdx +164 -0
- package/.docs/raw/reference/voice/elevenlabs.mdx +216 -0
- package/.docs/raw/reference/voice/google.mdx +198 -0
- package/.docs/raw/reference/voice/mastra-voice.mdx +394 -0
- package/.docs/raw/reference/voice/murf.mdx +251 -0
- package/.docs/raw/reference/voice/openai-realtime.mdx +431 -0
- package/.docs/raw/reference/voice/openai.mdx +168 -0
- package/.docs/raw/reference/voice/playai.mdx +159 -0
- package/.docs/raw/reference/voice/sarvam.mdx +260 -0
- package/.docs/raw/reference/voice/speechify.mdx +145 -0
- package/.docs/raw/reference/voice/voice.answer.mdx +122 -0
- package/.docs/raw/reference/voice/voice.connect.mdx +124 -0
- package/.docs/raw/reference/voice/voice.listen.mdx +195 -0
- package/.docs/raw/reference/voice/voice.on.mdx +189 -0
- package/.docs/raw/reference/voice/voice.send.mdx +118 -0
- package/.docs/raw/reference/voice/voice.speak.mdx +203 -0
- package/.docs/raw/reference/workflows/after.mdx +88 -0
- package/.docs/raw/reference/workflows/afterEvent.mdx +76 -0
- package/.docs/raw/reference/workflows/commit.mdx +37 -0
- package/.docs/raw/reference/workflows/createRun.mdx +77 -0
- package/.docs/raw/reference/workflows/else.mdx +72 -0
- package/.docs/raw/reference/workflows/events.mdx +305 -0
- package/.docs/raw/reference/workflows/execute.mdx +110 -0
- package/.docs/raw/reference/workflows/if.mdx +107 -0
- package/.docs/raw/reference/workflows/resume.mdx +155 -0
- package/.docs/raw/reference/workflows/resumeWithEvent.mdx +133 -0
- package/.docs/raw/reference/workflows/snapshots.mdx +207 -0
- package/.docs/raw/reference/workflows/start.mdx +84 -0
- package/.docs/raw/reference/workflows/step-class.mdx +100 -0
- package/.docs/raw/reference/workflows/step-condition.mdx +134 -0
- package/.docs/raw/reference/workflows/step-function.mdx +92 -0
- package/.docs/raw/reference/workflows/step-options.mdx +69 -0
- package/.docs/raw/reference/workflows/step-retries.mdx +203 -0
- package/.docs/raw/reference/workflows/suspend.mdx +70 -0
- package/.docs/raw/reference/workflows/then.mdx +74 -0
- package/.docs/raw/reference/workflows/until.mdx +165 -0
- package/.docs/raw/reference/workflows/watch.mdx +118 -0
- package/.docs/raw/reference/workflows/while.mdx +168 -0
- package/.docs/raw/reference/workflows/workflow.mdx +233 -0
- package/.docs/raw/storage/overview.mdx +378 -0
- package/.docs/raw/voice/overview.mdx +135 -0
- package/.docs/raw/voice/speech-to-text.mdx +45 -0
- package/.docs/raw/voice/text-to-speech.mdx +52 -0
- package/.docs/raw/voice/voice-to-voice.mdx +310 -0
- package/.docs/raw/workflows/control-flow.mdx +778 -0
- package/.docs/raw/workflows/dynamic-workflows.mdx +236 -0
- package/.docs/raw/workflows/error-handling.mdx +183 -0
- package/.docs/raw/workflows/nested-workflows.mdx +352 -0
- package/.docs/raw/workflows/overview.mdx +203 -0
- package/.docs/raw/workflows/steps.mdx +108 -0
- package/.docs/raw/workflows/suspend-and-resume.mdx +404 -0
- package/.docs/raw/workflows/variables.mdx +313 -0
- package/LICENSE.md +46 -0
- package/README.md +129 -0
- package/dist/_tsup-dts-rollup.d.ts +149 -0
- package/dist/chunk-QWYMT5LP.js +194 -0
- package/dist/prepare-docs/prepare.d.ts +1 -0
- package/dist/prepare-docs/prepare.js +1 -0
- package/dist/stdio.d.ts +1 -0
- package/dist/stdio.js +518 -0
- package/package.json +60 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Cloudflare Deployer"
|
|
3
|
+
description: "Documentation for the CloudflareDeployer class, which deploys Mastra applications to Cloudflare Workers."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CloudflareDeployer
|
|
7
|
+
|
|
8
|
+
The CloudflareDeployer deploys Mastra applications to Cloudflare Workers, handling configuration, environment variables, and route management. It extends the abstract Deployer class to provide Cloudflare-specific deployment functionality.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { Mastra } from '@mastra/core';
|
|
14
|
+
import { CloudflareDeployer } from '@mastra/deployer-cloudflare';
|
|
15
|
+
|
|
16
|
+
const mastra = new Mastra({
|
|
17
|
+
deployer: new CloudflareDeployer({
|
|
18
|
+
scope: 'your-account-id',
|
|
19
|
+
projectName: 'your-project-name',
|
|
20
|
+
routes: [
|
|
21
|
+
{
|
|
22
|
+
pattern: 'example.com/*',
|
|
23
|
+
zone_name: 'example.com',
|
|
24
|
+
custom_domain: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
workerNamespace: 'your-namespace',
|
|
28
|
+
auth: {
|
|
29
|
+
apiToken: 'your-api-token',
|
|
30
|
+
apiEmail: 'your-email',
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
// ... other Mastra configuration options
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Parameters
|
|
38
|
+
|
|
39
|
+
### Constructor Parameters
|
|
40
|
+
|
|
41
|
+
<PropertiesTable
|
|
42
|
+
content={[
|
|
43
|
+
{
|
|
44
|
+
name: "scope",
|
|
45
|
+
type: "string",
|
|
46
|
+
description: "Your Cloudflare account ID.",
|
|
47
|
+
isOptional: false,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "projectName",
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "Name of your worker project.",
|
|
53
|
+
isOptional: true,
|
|
54
|
+
defaultValue: "'mastra'",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "routes",
|
|
58
|
+
type: "CFRoute[]",
|
|
59
|
+
description: "Array of route configurations for your worker.",
|
|
60
|
+
isOptional: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "workerNamespace",
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Namespace for your worker.",
|
|
66
|
+
isOptional: true,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "env",
|
|
70
|
+
type: "Record<string, any>",
|
|
71
|
+
description: "Environment variables to be included in the worker configuration.",
|
|
72
|
+
isOptional: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "auth",
|
|
76
|
+
type: "object",
|
|
77
|
+
description: "Cloudflare authentication details.",
|
|
78
|
+
isOptional: false,
|
|
79
|
+
},
|
|
80
|
+
]}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
### auth Object
|
|
84
|
+
|
|
85
|
+
<PropertiesTable
|
|
86
|
+
content={[
|
|
87
|
+
{
|
|
88
|
+
name: "apiToken",
|
|
89
|
+
type: "string",
|
|
90
|
+
description: "Your Cloudflare API token.",
|
|
91
|
+
isOptional: false,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "apiEmail",
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Your Cloudflare account email.",
|
|
97
|
+
isOptional: true,
|
|
98
|
+
},
|
|
99
|
+
]}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
### CFRoute Object
|
|
103
|
+
|
|
104
|
+
<PropertiesTable
|
|
105
|
+
content={[
|
|
106
|
+
{
|
|
107
|
+
name: "pattern",
|
|
108
|
+
type: "string",
|
|
109
|
+
description: "URL pattern to match (e.g., 'example.com/*').",
|
|
110
|
+
isOptional: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "zone_name",
|
|
114
|
+
type: "string",
|
|
115
|
+
description: "Domain zone name.",
|
|
116
|
+
isOptional: false,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "custom_domain",
|
|
120
|
+
type: "boolean",
|
|
121
|
+
description: "Whether to use a custom domain.",
|
|
122
|
+
isOptional: true,
|
|
123
|
+
defaultValue: "false",
|
|
124
|
+
},
|
|
125
|
+
]}
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
### Environment Variables
|
|
129
|
+
|
|
130
|
+
The CloudflareDeployer handles environment variables from multiple sources:
|
|
131
|
+
|
|
132
|
+
1. **Environment Files**: Variables from `.env.production` and `.env` files.
|
|
133
|
+
2. **Configuration**: Variables passed through the `env` parameter.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## Build Mastra Project
|
|
137
|
+
|
|
138
|
+
To build your Mastra project for cloudflare deployment:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npx mastra build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The build process generates the following output structure in the `.mastra/output` directory:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
.mastra/output/
|
|
148
|
+
├── index.mjs # Main worker entry point
|
|
149
|
+
├── wrangler.json # Cloudflare Worker configuration
|
|
150
|
+
└── assets/ # Static assets and dependencies
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Wrangler Configuration
|
|
154
|
+
|
|
155
|
+
The CloudflareDeployer automatically generates a `wrangler.json` configuration file with the following settings:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"name": "your-project-name",
|
|
160
|
+
"main": "./output/index.mjs",
|
|
161
|
+
"compatibility_date": "2024-12-02",
|
|
162
|
+
"compatibility_flags": ["nodejs_compat"],
|
|
163
|
+
"observability": {
|
|
164
|
+
"logs": {
|
|
165
|
+
"enabled": true
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"vars": {
|
|
169
|
+
// Environment variables from .env files and configuration
|
|
170
|
+
},
|
|
171
|
+
"routes": [
|
|
172
|
+
// Route configurations if specified
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Route Configuration
|
|
178
|
+
|
|
179
|
+
Routes can be configured to direct traffic to your worker based on URL patterns and domains:
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
const routes = [
|
|
183
|
+
{
|
|
184
|
+
pattern: 'api.example.com/*',
|
|
185
|
+
zone_name: 'example.com',
|
|
186
|
+
custom_domain: true,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
pattern: 'example.com/api/*',
|
|
190
|
+
zone_name: 'example.com',
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
## Deployment Options
|
|
197
|
+
|
|
198
|
+
After building, you can deploy your Mastra application `.mastra/output` to Cloudflare Workers using any of these methods:
|
|
199
|
+
|
|
200
|
+
1. **Wrangler CLI**: Deploy directly using Cloudflare's official CLI tool
|
|
201
|
+
|
|
202
|
+
2. **Cloudflare Dashboard**: Upload the build output manually through the Cloudflare dashboard
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
## Platform Documentation
|
|
206
|
+
|
|
207
|
+
- [Cloudflare Workers](https://developers.cloudflare.com/workers/)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Mastra Deployer"
|
|
3
|
+
description: Documentation for the Deployer abstract class, which handles packaging and deployment of Mastra applications.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deployer
|
|
7
|
+
|
|
8
|
+
The Deployer handles the deployment of Mastra applications by packaging code, managing environment files, and serving applications using the Hono framework. Concrete implementations must define the deploy method for specific deployment targets.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { Deployer } from "@mastra/deployer";
|
|
14
|
+
|
|
15
|
+
// Create a custom deployer by extending the abstract Deployer class
|
|
16
|
+
class CustomDeployer extends Deployer {
|
|
17
|
+
constructor() {
|
|
18
|
+
super({ name: 'custom-deployer' });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Implement the abstract deploy method
|
|
22
|
+
async deploy(outputDirectory: string): Promise<void> {
|
|
23
|
+
// Prepare the output directory
|
|
24
|
+
await this.prepare(outputDirectory);
|
|
25
|
+
|
|
26
|
+
// Bundle the application
|
|
27
|
+
await this._bundle('server.ts', 'mastra.ts', outputDirectory);
|
|
28
|
+
|
|
29
|
+
// Custom deployment logic
|
|
30
|
+
// ...
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Parameters
|
|
36
|
+
|
|
37
|
+
### Constructor Parameters
|
|
38
|
+
|
|
39
|
+
<PropertiesTable
|
|
40
|
+
content={[
|
|
41
|
+
{
|
|
42
|
+
name: "args",
|
|
43
|
+
type: "object",
|
|
44
|
+
description: "Configuration options for the Deployer.",
|
|
45
|
+
isOptional: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "args.name",
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "A unique name for the deployer instance.",
|
|
51
|
+
isOptional: false,
|
|
52
|
+
},
|
|
53
|
+
]}
|
|
54
|
+
/>
|
|
55
|
+
|
|
56
|
+
### deploy Parameters
|
|
57
|
+
|
|
58
|
+
<PropertiesTable
|
|
59
|
+
content={[
|
|
60
|
+
{
|
|
61
|
+
name: "outputDirectory",
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "The directory where the bundled and deployment-ready application will be output.",
|
|
64
|
+
isOptional: false,
|
|
65
|
+
},
|
|
66
|
+
]}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
## Methods
|
|
70
|
+
|
|
71
|
+
<PropertiesTable
|
|
72
|
+
content={[
|
|
73
|
+
{
|
|
74
|
+
name: "getEnvFiles",
|
|
75
|
+
type: "() => Promise<string[]>",
|
|
76
|
+
description: "Returns a list of environment files to be used during deployment. By default, it looks for '.env.production' and '.env' files.",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "deploy",
|
|
80
|
+
type: "(outputDirectory: string) => Promise<void>",
|
|
81
|
+
description: "Abstract method that must be implemented by subclasses. Handles the deployment process to the specified output directory.",
|
|
82
|
+
},
|
|
83
|
+
]}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
## Inherited Methods from Bundler
|
|
87
|
+
|
|
88
|
+
The Deployer class inherits the following key methods from the Bundler class:
|
|
89
|
+
|
|
90
|
+
<PropertiesTable
|
|
91
|
+
content={[
|
|
92
|
+
{
|
|
93
|
+
name: "prepare",
|
|
94
|
+
type: "(outputDirectory: string) => Promise<void>",
|
|
95
|
+
description: "Prepares the output directory by cleaning it and creating necessary subdirectories.",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "writeInstrumentationFile",
|
|
99
|
+
type: "(outputDirectory: string) => Promise<void>",
|
|
100
|
+
description: "Writes an instrumentation file to the output directory for telemetry purposes.",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "writePackageJson",
|
|
104
|
+
type: "(outputDirectory: string, dependencies: Map<string, string>) => Promise<void>",
|
|
105
|
+
description: "Generates a package.json file in the output directory with the specified dependencies.",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "_bundle",
|
|
109
|
+
type: "(serverFile: string, mastraEntryFile: string, outputDirectory: string, bundleLocation?: string) => Promise<void>",
|
|
110
|
+
description: "Bundles the application using the specified server and Mastra entry files.",
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
## Core Concepts
|
|
116
|
+
|
|
117
|
+
### Deployment Lifecycle
|
|
118
|
+
|
|
119
|
+
The Deployer abstract class implements a structured deployment lifecycle:
|
|
120
|
+
|
|
121
|
+
1. **Initialization**: The deployer is initialized with a name and creates a Deps instance for dependency management.
|
|
122
|
+
2. **Environment Setup**: The `getEnvFiles` method identifies environment files (.env.production, .env) to be used during deployment.
|
|
123
|
+
3. **Preparation**: The `prepare` method (inherited from Bundler) cleans the output directory and creates necessary subdirectories.
|
|
124
|
+
4. **Bundling**: The `_bundle` method (inherited from Bundler) packages the application code and its dependencies.
|
|
125
|
+
5. **Deployment**: The abstract `deploy` method is implemented by subclasses to handle the actual deployment process.
|
|
126
|
+
|
|
127
|
+
### Environment File Management
|
|
128
|
+
|
|
129
|
+
The Deployer class includes built-in support for environment file management through the `getEnvFiles` method. This method:
|
|
130
|
+
|
|
131
|
+
- Looks for environment files in a predefined order (.env.production, .env)
|
|
132
|
+
- Uses the FileService to find the first existing file
|
|
133
|
+
- Returns an array of found environment files
|
|
134
|
+
- Returns an empty array if no environment files are found
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
getEnvFiles(): Promise<string[]> {
|
|
138
|
+
const possibleFiles = ['.env.production', '.env.local', '.env'];
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const fileService = new FileService();
|
|
142
|
+
const envFile = fileService.getFirstExistingFile(possibleFiles);
|
|
143
|
+
|
|
144
|
+
return Promise.resolve([envFile]);
|
|
145
|
+
} catch {}
|
|
146
|
+
|
|
147
|
+
return Promise.resolve([]);
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Bundling and Deployment Relationship
|
|
152
|
+
|
|
153
|
+
The Deployer class extends the Bundler class, establishing a clear relationship between bundling and deployment:
|
|
154
|
+
|
|
155
|
+
1. **Bundling as a Prerequisite**: Bundling is a prerequisite step for deployment, where the application code is packaged into a deployable format.
|
|
156
|
+
2. **Shared Infrastructure**: Both bundling and deployment share common infrastructure like dependency management and file system operations.
|
|
157
|
+
3. **Specialized Deployment Logic**: While bundling focuses on code packaging, deployment adds environment-specific logic for deploying the bundled code.
|
|
158
|
+
4. **Extensibility**: The abstract `deploy` method allows for creating specialized deployers for different target environments.
|
|
159
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Netlify Deployer"
|
|
3
|
+
description: "Documentation for the NetlifyDeployer class, which deploys Mastra applications to Netlify Functions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# NetlifyDeployer
|
|
7
|
+
|
|
8
|
+
The NetlifyDeployer deploys Mastra applications to Netlify Functions, handling site creation, configuration, and deployment processes. It extends the abstract Deployer class to provide Netlify-specific deployment functionality.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { Mastra } from '@mastra/core';
|
|
14
|
+
import { NetlifyDeployer } from '@mastra/deployer-netlify';
|
|
15
|
+
|
|
16
|
+
const mastra = new Mastra({
|
|
17
|
+
deployer: new NetlifyDeployer({
|
|
18
|
+
scope: 'your-team-slug',
|
|
19
|
+
projectName: 'your-project-name',
|
|
20
|
+
token: 'your-netlify-token'
|
|
21
|
+
}),
|
|
22
|
+
// ... other Mastra configuration options
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Parameters
|
|
27
|
+
|
|
28
|
+
### Constructor Parameters
|
|
29
|
+
|
|
30
|
+
<PropertiesTable
|
|
31
|
+
content={[
|
|
32
|
+
{
|
|
33
|
+
name: "scope",
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Your Netlify team slug or ID.",
|
|
36
|
+
isOptional: false,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "projectName",
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Name of your Netlify site (will be created if it doesn't exist).",
|
|
42
|
+
isOptional: false,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "token",
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "Your Netlify authentication token.",
|
|
48
|
+
isOptional: false,
|
|
49
|
+
},
|
|
50
|
+
]}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Environment Variables
|
|
55
|
+
|
|
56
|
+
The NetlifyDeployer handles environment variables from multiple sources:
|
|
57
|
+
|
|
58
|
+
1. **Environment Files**: Variables from `.env.production` and `.env` files.
|
|
59
|
+
2. **Configuration**: Variables passed through the Mastra configuration.
|
|
60
|
+
3. **Netlify Dashboard**: Variables can also be managed through Netlify's web interface.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Build Mastra Project
|
|
64
|
+
|
|
65
|
+
To build your Mastra project for Netlify deployment:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx mastra build
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The build process generates the following output structure in the `.mastra/output` directory:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
.mastra/output/
|
|
75
|
+
├── netlify/
|
|
76
|
+
│ └── functions/
|
|
77
|
+
│ └── api/
|
|
78
|
+
│ └── index.mjs # Application entry point
|
|
79
|
+
└── netlify.toml # Netlify configuration
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Netlify Configuration
|
|
83
|
+
|
|
84
|
+
The NetlifyDeployer automatically generates a `netlify.toml` configuration file in `.mastra/output` with the following settings:
|
|
85
|
+
|
|
86
|
+
```toml
|
|
87
|
+
[functions]
|
|
88
|
+
node_bundler = "esbuild"
|
|
89
|
+
directory = "netlify/functions"
|
|
90
|
+
|
|
91
|
+
[[redirects]]
|
|
92
|
+
force = true
|
|
93
|
+
from = "/*"
|
|
94
|
+
status = 200
|
|
95
|
+
to = "/.netlify/functions/api/:splat"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Deployment Options
|
|
99
|
+
|
|
100
|
+
After building, you can deploy your Mastra application `.mastra/output` to Netlify using any of these methods:
|
|
101
|
+
|
|
102
|
+
1. **Netlify CLI**: Deploy directly using Netlify's official CLI tool
|
|
103
|
+
|
|
104
|
+
2. **Netlify Dashboard**: Connect your Git repository or drag-and-drop the build output through the Netlify dashboard
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Platform Documentation
|
|
108
|
+
|
|
109
|
+
- [Netlify](https://docs.netlify.com/)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Vercel Deployer"
|
|
3
|
+
description: "Documentation for the VercelDeployer class, which deploys Mastra applications to Vercel."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# VercelDeployer
|
|
7
|
+
|
|
8
|
+
The VercelDeployer deploys Mastra applications to Vercel, handling configuration, environment variable synchronization, and deployment processes. It extends the abstract Deployer class to provide Vercel-specific deployment functionality.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { Mastra } from '@mastra/core';
|
|
14
|
+
import { VercelDeployer } from '@mastra/deployer-vercel';
|
|
15
|
+
|
|
16
|
+
const mastra = new Mastra({
|
|
17
|
+
deployer: new VercelDeployer({
|
|
18
|
+
teamSlug: 'your-team-slug',
|
|
19
|
+
projectName: 'your-project-name',
|
|
20
|
+
token: 'your-vercel-token'
|
|
21
|
+
}),
|
|
22
|
+
// ... other Mastra configuration options
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Parameters
|
|
27
|
+
|
|
28
|
+
### Constructor Parameters
|
|
29
|
+
|
|
30
|
+
<PropertiesTable
|
|
31
|
+
content={[
|
|
32
|
+
{
|
|
33
|
+
name: "teamSlug",
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Your Vercel team slug",
|
|
36
|
+
isOptional: false,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "projectName",
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Name of your Vercel project (will be created if it doesn't exist).",
|
|
42
|
+
isOptional: false,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "token",
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "Your Vercel authentication token.",
|
|
48
|
+
isOptional: false,
|
|
49
|
+
},
|
|
50
|
+
]}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Environment Variables
|
|
55
|
+
|
|
56
|
+
The VercelDeployer handles environment variables from multiple sources:
|
|
57
|
+
|
|
58
|
+
1. **Environment Files**: Variables from `.env.production` and `.env` files.
|
|
59
|
+
2. **Configuration**: Variables passed through the Mastra configuration.
|
|
60
|
+
3. **Vercel Dashboard**: Variables can also be managed through Vercel's web interface.
|
|
61
|
+
|
|
62
|
+
The deployer automatically synchronizes environment variables between your local development environment and Vercel's environment variable system, ensuring consistency across all deployment environments (production, preview, and development).
|
|
63
|
+
|
|
64
|
+
## Build Mastra Project
|
|
65
|
+
|
|
66
|
+
To build your Mastra project for Vercel deployment:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx mastra build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The build process generates the following output structure in the `.mastra/output` directory:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
.mastra/output/
|
|
76
|
+
├── vercel.json # Vercel configuration
|
|
77
|
+
└── index.mjs # Application entry point
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Vercel Configuration
|
|
81
|
+
|
|
82
|
+
The VercelDeployer automatically generates a `vercel.json` configuration file in `.mastra/output` with the following settings:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"version": 2,
|
|
87
|
+
"installCommand": "npm install --omit=dev",
|
|
88
|
+
"builds": [
|
|
89
|
+
{
|
|
90
|
+
"src": "index.mjs",
|
|
91
|
+
"use": "@vercel/node",
|
|
92
|
+
"config": {
|
|
93
|
+
"includeFiles": ["**"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"routes": [
|
|
98
|
+
{
|
|
99
|
+
"src": "/(.*)",
|
|
100
|
+
"dest": "index.mjs"
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Deployment Options
|
|
107
|
+
|
|
108
|
+
After building, you can deploy your Mastra application `.mastra/output` to Vercel using any of these methods:
|
|
109
|
+
|
|
110
|
+
1. **Vercel CLI**: Deploy directly using Vercel's official CLI tool
|
|
111
|
+
|
|
112
|
+
2. **Vercel Dashboard**: Connect your Git repository or drag-and-drop the build output through the Vercel dashboard
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## Platform Documentation
|
|
116
|
+
|
|
117
|
+
- [Vercel](https://vercel.com/docs)
|