@mastra/mcp-docs-server 0.13.6 → 0.13.7-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +30 -30
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +30 -30
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Flance.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +43 -43
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Frag.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +8 -8
- package/.docs/organized/changelogs/create-mastra.md +15 -15
- package/.docs/organized/changelogs/mastra.md +43 -43
- package/.docs/organized/code-examples/a2a.md +1 -1
- package/.docs/organized/code-examples/agui.md +2 -2
- package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -1
- package/.docs/organized/code-examples/ai-sdk-v5.md +1 -1
- package/.docs/organized/code-examples/assistant-ui.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -1
- package/.docs/organized/code-examples/client-side-tools.md +2 -2
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/organized/code-examples/fireworks-r1.md +1 -1
- package/.docs/organized/code-examples/memory-with-mem0.md +1 -1
- package/.docs/organized/code-examples/memory-with-pg.md +1 -0
- package/.docs/organized/code-examples/openapi-spec-writer.md +1 -1
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +1 -1
- package/.docs/raw/agents/runtime-variables.mdx +1 -1
- package/.docs/raw/auth/index.mdx +24 -0
- package/.docs/raw/auth/jwt.mdx +99 -0
- package/.docs/raw/community/contributing-templates.mdx +192 -0
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +6 -5
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +84 -14
- package/.docs/raw/evals/custom-eval.mdx +12 -12
- package/.docs/raw/getting-started/installation.mdx +16 -0
- package/.docs/raw/getting-started/templates.mdx +95 -0
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/reference/agents/generate.mdx +18 -1
- package/.docs/raw/reference/agents/stream.mdx +18 -1
- package/.docs/raw/reference/auth/jwt.mdx +42 -0
- package/.docs/raw/reference/client-js/agents.mdx +3 -11
- package/.docs/raw/reference/client-js/error-handling.mdx +1 -21
- package/.docs/raw/reference/client-js/logs.mdx +2 -10
- package/.docs/raw/reference/client-js/mastra-client.mdx +141 -0
- package/.docs/raw/reference/client-js/memory.mdx +6 -18
- package/.docs/raw/reference/client-js/telemetry.mdx +1 -9
- package/.docs/raw/reference/client-js/tools.mdx +2 -10
- package/.docs/raw/reference/client-js/vectors.mdx +1 -9
- package/.docs/raw/reference/client-js/workflows-legacy.mdx +3 -11
- package/.docs/raw/reference/client-js/workflows.mdx +5 -13
- package/.docs/raw/reference/core/mastra-class.mdx +7 -1
- package/.docs/raw/reference/observability/providers/dash0.mdx +2 -2
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +115 -0
- package/.docs/raw/reference/scorers/bias.mdx +127 -0
- package/.docs/raw/reference/scorers/completeness.mdx +89 -0
- package/.docs/raw/reference/scorers/content-similarity.mdx +96 -0
- package/.docs/raw/reference/scorers/custom-code-scorer.mdx +155 -0
- package/.docs/raw/reference/scorers/faithfulness.mdx +123 -0
- package/.docs/raw/reference/scorers/hallucination.mdx +135 -0
- package/.docs/raw/reference/scorers/keyword-coverage.mdx +92 -0
- package/.docs/raw/reference/scorers/llm-scorer.mdx +166 -0
- package/.docs/raw/reference/scorers/mastra-scorer.mdx +218 -0
- package/.docs/raw/reference/scorers/textual-difference.mdx +76 -0
- package/.docs/raw/reference/scorers/tone-consistency.mdx +75 -0
- package/.docs/raw/reference/scorers/toxicity.mdx +109 -0
- package/.docs/raw/reference/templates.mdx +222 -0
- package/.docs/raw/reference/tools/vector-query-tool.mdx +29 -0
- package/.docs/raw/tools-mcp/overview.mdx +1 -1
- package/package.json +6 -6
- package/.docs/organized/changelogs/%40mastra%2Fagui.md +0 -302
|
@@ -23,7 +23,7 @@ const agent = mastra.getAgent("weatherAgent");
|
|
|
23
23
|
|
|
24
24
|
// Define your runtimeContext's type structure
|
|
25
25
|
type WeatherRuntimeContext = {
|
|
26
|
-
"temperature-scale": "celsius" | "fahrenheit";
|
|
26
|
+
"temperature-scale": "celsius" | "fahrenheit";
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const runtimeContext = new RuntimeContext<WeatherRuntimeContext>();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Auth Overview
|
|
3
|
+
description: Learn about different Auth options for your Mastra applications
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Auth Overview
|
|
7
|
+
|
|
8
|
+
Mastra lets you choose how you handle authentication, so you can secure access to your application's endpoints using the identity system that fits your stack.
|
|
9
|
+
|
|
10
|
+
You can start with simple shared secret JWT authentication and switch to providers like Supabase, Firebase Auth, Auth0, Clerk, or WorkOS when you need more advanced identity features.
|
|
11
|
+
|
|
12
|
+
## Available providers
|
|
13
|
+
|
|
14
|
+
- [JSON Web Token (JWT)](/docs/auth/jwt)
|
|
15
|
+
|
|
16
|
+
### Coming soon
|
|
17
|
+
|
|
18
|
+
The following providers will be available soon:
|
|
19
|
+
|
|
20
|
+
- Supabase Auth
|
|
21
|
+
- Firebase Auth
|
|
22
|
+
- Auth0
|
|
23
|
+
- Clerk
|
|
24
|
+
- WorkOS
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MastraJwtAuth"
|
|
3
|
+
description: "Documentation for the MastraJwtAuth class, which authenticates Mastra applications using JSON Web Tokens."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Tabs, Tab } from "@/components/tabs";
|
|
7
|
+
|
|
8
|
+
# MastraJwtAuth
|
|
9
|
+
|
|
10
|
+
The `MastraJwtAuth` class provides a lightweight authentication mechanism for Mastra using JSON Web Tokens (JWTs). It verifies incoming requests based on a shared secret and integrates with the Mastra server using the `experimental_auth` option.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash copy
|
|
15
|
+
npm install @mastra/auth
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage example
|
|
19
|
+
|
|
20
|
+
```typescript {2,7-9} filename="src/mastra/index.ts" showLineNumbers copy
|
|
21
|
+
import { Mastra } from "@mastra/core/mastra";
|
|
22
|
+
import { MastraJwtAuth } from '@mastra/auth';
|
|
23
|
+
|
|
24
|
+
export const mastra = new Mastra({
|
|
25
|
+
// ..
|
|
26
|
+
server: {
|
|
27
|
+
experimental_auth: new MastraJwtAuth({
|
|
28
|
+
secret: process.env.MASTRA_JWT_SECRET
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> See the [MastraJwtAuth](/reference/auth/jwt.mdx) API reference for all available configuration options.
|
|
35
|
+
|
|
36
|
+
## Configuring `MastraClient`
|
|
37
|
+
|
|
38
|
+
When `experimental_auth` is enabled, all requests made with `MastraClient` must include a valid JWT in the `Authorization` header:
|
|
39
|
+
|
|
40
|
+
```typescript {6} filename="lib/mastra/mastra-client.ts" showLineNumbers copy
|
|
41
|
+
import { MastraClient } from "@mastra/client-js";
|
|
42
|
+
|
|
43
|
+
export const mastraClient = new MastraClient({
|
|
44
|
+
baseUrl: "https://<mastra-api-url>",
|
|
45
|
+
headers: {
|
|
46
|
+
Authorization: `Bearer ${process.env.MASTRA_JWT_TOKEN}`
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> See [Mastra Client SDK](/docs/server-db/mastra-client.mdx) for more configuration options.
|
|
52
|
+
|
|
53
|
+
### Making authenticated requests
|
|
54
|
+
|
|
55
|
+
Once `MastraClient` is configured, you can send authenticated requests from your frontend application, or use `curl` for quick local testing:
|
|
56
|
+
|
|
57
|
+
<Tabs items={["MastraClient", "curl"]}>
|
|
58
|
+
<Tab>
|
|
59
|
+
```tsx filename="src/components/test-agent.tsx" showLineNumbers copy
|
|
60
|
+
import { mastraClient } from "../../lib/mastra-client";
|
|
61
|
+
|
|
62
|
+
export const TestAgent = () => {
|
|
63
|
+
async function handleClick() {
|
|
64
|
+
const agent = mastraClient.getAgent("weatherAgent");
|
|
65
|
+
|
|
66
|
+
const response = await agent.generate({
|
|
67
|
+
messages: "Weather in London"
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
console.log(response);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return <button onClick={handleClick}>Test Agent</button>;
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
</Tab>
|
|
77
|
+
<Tab>
|
|
78
|
+
```bash copy
|
|
79
|
+
curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
|
|
80
|
+
-H "Content-Type: application/json" \
|
|
81
|
+
-H "Authorization: Bearer <your-jwt>" \
|
|
82
|
+
-d '{
|
|
83
|
+
"messages": "Weather in London"
|
|
84
|
+
}'
|
|
85
|
+
```
|
|
86
|
+
</Tab>
|
|
87
|
+
</Tabs>
|
|
88
|
+
|
|
89
|
+
## Creating a JWT
|
|
90
|
+
|
|
91
|
+
To authenticate requests to your Mastra server, you'll need a valid JSON Web Token (JWT) signed with your `MASTRA_JWT_SECRET`.
|
|
92
|
+
|
|
93
|
+
The easiest way to generate one is using [jwt.io](https://www.jwt.io/):
|
|
94
|
+
|
|
95
|
+
1. Select **JWT Encoder**.
|
|
96
|
+
2. Scroll down to the **Sign JWT: Secret** section.
|
|
97
|
+
3. Enter your secret (for example: `supersecretdevkeythatishs256safe!`).
|
|
98
|
+
4. Click **Generate example** to create a valid JWT.
|
|
99
|
+
5. Copy the generated token and set it as `MASTRA_JWT_TOKEN` in your `.env` file.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Contributing Templates"
|
|
3
|
+
description: "How to contribute your own templates to the Mastra ecosystem"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Callout } from "nextra/components";
|
|
7
|
+
|
|
8
|
+
# Contributing Templates
|
|
9
|
+
|
|
10
|
+
The Mastra community plays a vital role in creating templates that showcase innovative application patterns. This guide explains how to contribute your own templates to the Mastra ecosystem.
|
|
11
|
+
|
|
12
|
+
## Template Contribution Process
|
|
13
|
+
|
|
14
|
+
### 1. Review Requirements
|
|
15
|
+
|
|
16
|
+
Before creating a template, ensure you understand:
|
|
17
|
+
|
|
18
|
+
- [Templates Reference](/reference/templates) - Technical requirements and conventions
|
|
19
|
+
- [Project Structure](/docs/getting-started/project-structure) - Standard Mastra project organization
|
|
20
|
+
- Community guidelines and quality standards
|
|
21
|
+
|
|
22
|
+
### 2. Develop Your Template
|
|
23
|
+
|
|
24
|
+
Create your template following the established patterns:
|
|
25
|
+
|
|
26
|
+
- Focus on a specific use case or pattern
|
|
27
|
+
- Include comprehensive documentation
|
|
28
|
+
- Test thoroughly with fresh installations
|
|
29
|
+
- Follow all technical requirements
|
|
30
|
+
|
|
31
|
+
### 3. Submit for Review
|
|
32
|
+
|
|
33
|
+
Once your template is ready, submit it through our contribution form. Templates undergo an approval process to ensure quality and consistency.
|
|
34
|
+
|
|
35
|
+
## Submission Guidelines
|
|
36
|
+
|
|
37
|
+
### Template Criteria
|
|
38
|
+
|
|
39
|
+
We accept templates that:
|
|
40
|
+
|
|
41
|
+
- **Demonstrate unique value** - Show innovative use cases or patterns not covered by existing templates
|
|
42
|
+
- **Follow conventions** - Adhere to all technical requirements and structural guidelines
|
|
43
|
+
- **Include quality documentation** - Provide clear setup instructions and usage examples
|
|
44
|
+
- **Work reliably** - Function correctly with minimal setup after installation
|
|
45
|
+
|
|
46
|
+
### Quality Standards
|
|
47
|
+
|
|
48
|
+
Templates must meet these quality benchmarks:
|
|
49
|
+
|
|
50
|
+
- **Code quality** - Clean, well-commented, and maintainable code
|
|
51
|
+
- **Error handling** - Proper error handling for external APIs and user inputs
|
|
52
|
+
- **Type safety** - Full TypeScript typing with Zod validation where appropriate
|
|
53
|
+
- **Documentation** - Comprehensive README with setup and usage instructions
|
|
54
|
+
- **Testing** - Verified to work with fresh installations
|
|
55
|
+
|
|
56
|
+
## Submission Process
|
|
57
|
+
|
|
58
|
+
### 1. Prepare Your Template
|
|
59
|
+
|
|
60
|
+
Ensure your template meets all requirements outlined in the [Templates Reference](/reference/templates):
|
|
61
|
+
|
|
62
|
+
- Proper project structure in `src/mastra/` directory
|
|
63
|
+
- Standard TypeScript configuration
|
|
64
|
+
- Comprehensive `.env.example` file
|
|
65
|
+
- Detailed README with setup instructions
|
|
66
|
+
|
|
67
|
+
### 2. Submit Your Template
|
|
68
|
+
|
|
69
|
+
Submit your template using our contribution form:
|
|
70
|
+
|
|
71
|
+
**[Submit Template Contribution](https://forms.gle/5qcU5UTKYcgFdVfE7)**
|
|
72
|
+
|
|
73
|
+
### Required Information
|
|
74
|
+
|
|
75
|
+
When submitting your template, provide:
|
|
76
|
+
|
|
77
|
+
- **Template Name** - Clear, descriptive name indicating the use case
|
|
78
|
+
- **Template Author Name** - Your name or organization name
|
|
79
|
+
- **Template Author Email** - Contact email for communication about your submission
|
|
80
|
+
- **GitHub URL** - Link to your template repository
|
|
81
|
+
- **Description** - Detailed explanation of what the template does and its value
|
|
82
|
+
- **Optional Image** - Screenshot or diagram showing the template in action
|
|
83
|
+
- **Optional Demo Video** - Link to a video demonstrating the template's functionality
|
|
84
|
+
|
|
85
|
+
## Review Process
|
|
86
|
+
|
|
87
|
+
### Review Criteria
|
|
88
|
+
|
|
89
|
+
Templates are evaluated on:
|
|
90
|
+
|
|
91
|
+
- **Technical compliance** - Adherence to template rules and conventions
|
|
92
|
+
- **Code quality** - Clean, maintainable, and well-documented code
|
|
93
|
+
- **Uniqueness** - Novel use cases or innovative implementation patterns
|
|
94
|
+
- **Educational value** - Ability to teach Mastra concepts effectively
|
|
95
|
+
- **Community benefit** - Potential value to the broader Mastra community
|
|
96
|
+
|
|
97
|
+
### Feedback and Iteration
|
|
98
|
+
|
|
99
|
+
If your template needs improvements:
|
|
100
|
+
|
|
101
|
+
- You'll receive specific feedback on required changes
|
|
102
|
+
- Make the requested modifications and resubmit
|
|
103
|
+
- The review process continues until the template meets standards
|
|
104
|
+
|
|
105
|
+
## Community Guidelines
|
|
106
|
+
|
|
107
|
+
### Template Ideas
|
|
108
|
+
|
|
109
|
+
Consider creating templates for:
|
|
110
|
+
|
|
111
|
+
- **Industry-specific use cases** - Healthcare, finance, education, etc.
|
|
112
|
+
- **Integration patterns** - Specific API or service integrations
|
|
113
|
+
- **Advanced techniques** - Complex workflows, multi-agent systems, or novel patterns
|
|
114
|
+
- **Learning resources** - Step-by-step tutorials for specific concepts
|
|
115
|
+
|
|
116
|
+
### Development Best Practices
|
|
117
|
+
|
|
118
|
+
- **Start simple** - Begin with a minimal working example and add complexity gradually
|
|
119
|
+
- **Document thoroughly** - Include detailed comments and comprehensive README
|
|
120
|
+
- **Test extensively** - Verify your template works across different environments
|
|
121
|
+
- **Seek feedback** - Share with the community for early feedback before submission
|
|
122
|
+
|
|
123
|
+
### Community Engagement
|
|
124
|
+
|
|
125
|
+
- **Join Discord** - Participate in the [Mastra Discord community](https://discord.gg/BTYqqHKUrf)
|
|
126
|
+
- **Share progress** - Update the community on your template development
|
|
127
|
+
- **Help others** - Assist other contributors with their templates
|
|
128
|
+
- **Stay updated** - Keep track of new Mastra features and conventions
|
|
129
|
+
|
|
130
|
+
## Template Maintenance
|
|
131
|
+
|
|
132
|
+
### Ongoing Responsibilities
|
|
133
|
+
|
|
134
|
+
As a template contributor, you may be asked to:
|
|
135
|
+
|
|
136
|
+
- **Update dependencies** - Keep templates current with latest Mastra versions
|
|
137
|
+
- **Fix issues** - Address bugs or compatibility problems
|
|
138
|
+
- **Improve documentation** - Enhance instructions based on user feedback
|
|
139
|
+
- **Add features** - Extend templates with new capabilities
|
|
140
|
+
|
|
141
|
+
### Community Support
|
|
142
|
+
|
|
143
|
+
The Mastra team and community provide:
|
|
144
|
+
|
|
145
|
+
- **Technical guidance** - Help with complex implementation challenges
|
|
146
|
+
- **Review feedback** - Detailed feedback to improve template quality
|
|
147
|
+
- **Promotion** - Showcase approved templates to the community
|
|
148
|
+
- **Maintenance assistance** - Support for keeping templates up-to-date
|
|
149
|
+
|
|
150
|
+
## Validation Checklist
|
|
151
|
+
|
|
152
|
+
Before submitting a template, verify:
|
|
153
|
+
|
|
154
|
+
- [ ] All code organized in `src/mastra/` directory
|
|
155
|
+
- [ ] Uses standard Mastra TypeScript configuration
|
|
156
|
+
- [ ] Includes comprehensive `.env.example`
|
|
157
|
+
- [ ] Has detailed README with setup instructions
|
|
158
|
+
- [ ] No monorepo or web framework boilerplate
|
|
159
|
+
- [ ] Successfully runs after fresh install and environment setup
|
|
160
|
+
- [ ] Follows all code quality standards
|
|
161
|
+
- [ ] Demonstrates clear, valuable use case
|
|
162
|
+
|
|
163
|
+
## Community Showcase
|
|
164
|
+
|
|
165
|
+
### Template Gallery
|
|
166
|
+
|
|
167
|
+
Approved templates will be featured in:
|
|
168
|
+
|
|
169
|
+
- **mastra.ai/templates** - Community template gallery (coming soon)
|
|
170
|
+
- **Documentation** - Referenced in relevant documentation sections
|
|
171
|
+
- **Community highlights** - Featured in newsletters and community updates
|
|
172
|
+
|
|
173
|
+
### Recognition
|
|
174
|
+
|
|
175
|
+
Template contributors receive:
|
|
176
|
+
|
|
177
|
+
- **Attribution** - Your name and contact information with the template
|
|
178
|
+
- **Community recognition** - Acknowledgment in community channels
|
|
179
|
+
|
|
180
|
+
## Getting Started
|
|
181
|
+
|
|
182
|
+
Ready to contribute a template?
|
|
183
|
+
|
|
184
|
+
1. **Explore existing templates** - Review current templates for inspiration and patterns
|
|
185
|
+
2. **Plan your template** - Define the use case and value proposition
|
|
186
|
+
3. **Follow the requirements** - Ensure compliance with all technical requirements
|
|
187
|
+
4. **Build and test** - Create a working, well-documented template
|
|
188
|
+
5. **Submit for review** - Use the contribution form to submit your template
|
|
189
|
+
|
|
190
|
+
<Callout type="info">
|
|
191
|
+
Your contributions help grow the Mastra ecosystem and provide valuable resources for the entire community. We look forward to seeing your innovative templates!
|
|
192
|
+
</Callout>
|
|
@@ -18,8 +18,8 @@ Deploy your Mastra applications to Azure App Services.
|
|
|
18
18
|
|
|
19
19
|
### Prerequisites
|
|
20
20
|
|
|
21
|
-
- An Azure account with an active subscription
|
|
22
|
-
- A GitHub repository containing your Mastra application
|
|
21
|
+
- An [Azure account](https://azure.microsoft.com/) with an active subscription
|
|
22
|
+
- A [GitHub repository](https://github.com/) containing your Mastra application
|
|
23
23
|
- Your Mastra application should be created using `npx create-mastra@latest`
|
|
24
24
|
|
|
25
25
|
### Deployment Steps
|
|
@@ -29,7 +29,7 @@ Deploy your Mastra applications to Azure App Services.
|
|
|
29
29
|
#### Create a new App Service
|
|
30
30
|
|
|
31
31
|
- Log in to the [Azure Portal](https://portal.azure.com)
|
|
32
|
-
- Navigate to **App Services** or search for it in the top search bar
|
|
32
|
+
- Navigate to **[App Services](https://docs.microsoft.com/en-us/azure/app-service/)** or search for it in the top search bar
|
|
33
33
|
- Click **Create** to create a new App Service
|
|
34
34
|
- In the drop-down, select **Web App**
|
|
35
35
|
|
|
@@ -67,7 +67,7 @@ Before setting up deployment, configure your environment variables:
|
|
|
67
67
|
- Navigate to **Deployment Center** in the left sidebar
|
|
68
68
|
- Select **GitHub** as your source
|
|
69
69
|
- Sign in to GitHub if you're not already authenticated with Azure
|
|
70
|
-
- In this example, we will keep GitHub Actions as our provider
|
|
70
|
+
- In this example, we will keep [GitHub Actions](https://docs.github.com/en/actions) as our provider
|
|
71
71
|
- Select your organization, repository, and branch
|
|
72
72
|
- Azure will generate a GitHub workflow file and you can preview it before proceeding
|
|
73
73
|
- Click **Save** (the save button is located at the top of the page)
|
|
@@ -84,7 +84,7 @@ Pull the latest changes to your local repository and modify the generated workfl
|
|
|
84
84
|
|
|
85
85
|
1. **Update the build step**: Find the step named "npm install, build, and test" and:
|
|
86
86
|
- Change the step name to "npm install and build"
|
|
87
|
-
-
|
|
87
|
+
- If you haven't set up proper tests in your Mastra application, remove the `npm test` command from the run section as the default test script will fail and disrupt deployment. If you have working tests, you can keep the test command.
|
|
88
88
|
|
|
89
89
|
2. **Update the zip artifact step**: Find the "Zip artifact for deployment" step and replace the zip command with:
|
|
90
90
|
|
|
@@ -133,4 +133,5 @@ such as `LibSQLStore` with a file URL. Consider using cloud-based storage soluti
|
|
|
133
133
|
- [Mastra Client SDK](/docs/client-js/overview)
|
|
134
134
|
- [Configure custom domains](https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain)
|
|
135
135
|
- [Enable HTTPS](https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-bindings)
|
|
136
|
+
- [Azure App Service documentation](https://docs.microsoft.com/en-us/azure/app-service/)
|
|
136
137
|
|
|
@@ -4,7 +4,6 @@ description: "Deploy your Mastra applications to Digital Ocean."
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import { Callout, Steps, Tabs } from "nextra/components";
|
|
7
|
-
import ServerConfig from "@/components/content-blocks/server-config.mdx";
|
|
8
7
|
|
|
9
8
|
## Digital Ocean
|
|
10
9
|
|
|
@@ -25,8 +24,8 @@ Deploy your Mastra applications to Digital Ocean's App Platform and Droplets.
|
|
|
25
24
|
|
|
26
25
|
#### Prerequisites [#app-platform-prerequisites]
|
|
27
26
|
|
|
28
|
-
- A Git repository containing your Mastra application. This can be a GitHub repository, GitLab repository, or any other compatible source provider.
|
|
29
|
-
- A Digital Ocean account
|
|
27
|
+
- A Git repository containing your Mastra application. This can be a [GitHub](https://github.com/) repository, [GitLab](https://gitlab.com/) repository, or any other compatible source provider.
|
|
28
|
+
- A [Digital Ocean account](https://www.digitalocean.com/)
|
|
30
29
|
|
|
31
30
|
#### Deployment Steps
|
|
32
31
|
|
|
@@ -34,8 +33,8 @@ Deploy your Mastra applications to Digital Ocean's App Platform and Droplets.
|
|
|
34
33
|
|
|
35
34
|
#### Create a new App
|
|
36
35
|
|
|
37
|
-
- Log in to your Digital Ocean dashboard.
|
|
38
|
-
- Navigate to the App Platform service.
|
|
36
|
+
- Log in to your [Digital Ocean dashboard](https://cloud.digitalocean.com/).
|
|
37
|
+
- Navigate to the [App Platform](https://docs.digitalocean.com/products/app-platform/) service.
|
|
39
38
|
- Select your source provider and create a new app.
|
|
40
39
|
|
|
41
40
|
#### Configure Deployment Source
|
|
@@ -76,21 +75,86 @@ such as `LibSQLStore` with a file URL.
|
|
|
76
75
|
### Droplets
|
|
77
76
|
|
|
78
77
|
Deploy your Mastra application to Digital Ocean's Droplets.
|
|
79
|
-
This guide will cover setting up a droplet, a reverse proxy using Nginx, and running your Mastra application.
|
|
80
|
-
|
|
81
|
-
<Callout>
|
|
82
|
-
The guide assumes your droplet runs Ubuntu 24+.
|
|
83
|
-
</Callout>
|
|
84
78
|
|
|
85
79
|
#### Prerequisites [#droplets-prerequisites]
|
|
86
80
|
|
|
87
|
-
- A Digital Ocean account
|
|
88
|
-
- A
|
|
81
|
+
- A [Digital Ocean account](https://www.digitalocean.com/)
|
|
82
|
+
- A [Droplet](https://docs.digitalocean.com/products/droplets/) running Ubuntu 24+
|
|
89
83
|
- A domain name with an A record pointing to your droplet
|
|
84
|
+
- A reverse proxy configured (e.g., using [nginx](https://nginx.org/))
|
|
85
|
+
- SSL certificate configured (e.g., using [Let's Encrypt](https://letsencrypt.org/))
|
|
86
|
+
- Node.js 18+ installed on your droplet
|
|
87
|
+
|
|
88
|
+
#### Deployment Steps
|
|
89
|
+
|
|
90
|
+
<Steps>
|
|
91
|
+
|
|
92
|
+
#### Clone your Mastra application
|
|
93
|
+
|
|
94
|
+
Connect to your Droplet and clone your repository:
|
|
95
|
+
|
|
96
|
+
<Tabs items={["Public Repository", "Private Repository"]}>
|
|
97
|
+
<Tabs.Tab>
|
|
98
|
+
|
|
99
|
+
```bash copy
|
|
100
|
+
git clone https://github.com/<your-username>/<your-repository>.git
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</Tabs.Tab>
|
|
104
|
+
|
|
105
|
+
<Tabs.Tab>
|
|
106
|
+
|
|
107
|
+
```bash copy
|
|
108
|
+
git clone https://<your-username>:<your-personal-access-token>@github.com/<your-username>/<your-repository>.git
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
</Tabs.Tab>
|
|
112
|
+
</Tabs>
|
|
113
|
+
|
|
114
|
+
Navigate to the repository directory:
|
|
90
115
|
|
|
91
|
-
|
|
116
|
+
```bash copy
|
|
117
|
+
cd "<your-repository>"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Install dependencies
|
|
121
|
+
|
|
122
|
+
```bash copy
|
|
123
|
+
npm install
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Set up environment variables
|
|
127
|
+
|
|
128
|
+
Create a `.env` file and add your environment variables:
|
|
92
129
|
|
|
93
|
-
|
|
130
|
+
```bash copy
|
|
131
|
+
touch .env
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Edit the `.env` file and add your environment variables:
|
|
135
|
+
|
|
136
|
+
```bash copy
|
|
137
|
+
OPENAI_API_KEY=<your-openai-api-key>
|
|
138
|
+
# Add other required environment variables
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Build the application
|
|
142
|
+
|
|
143
|
+
```bash copy
|
|
144
|
+
npm run build
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Run the application
|
|
148
|
+
|
|
149
|
+
```bash copy
|
|
150
|
+
node --import=./.mastra/output/instrumentation.mjs --env-file=".env" .mastra/output/index.mjs
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
<Callout>
|
|
154
|
+
Your Mastra application will run on port 4111 by default. Ensure your reverse proxy is configured to forward requests to this port.
|
|
155
|
+
</Callout>
|
|
156
|
+
|
|
157
|
+
</Steps>
|
|
94
158
|
|
|
95
159
|
</Tabs.Tab>
|
|
96
160
|
|
|
@@ -109,3 +173,9 @@ const mastraClient = new MastraClient({
|
|
|
109
173
|
baseUrl: "https://<your-domain-name>",
|
|
110
174
|
});
|
|
111
175
|
```
|
|
176
|
+
|
|
177
|
+
## Next steps
|
|
178
|
+
|
|
179
|
+
- [Mastra Client SDK](/docs/client-js/overview)
|
|
180
|
+
- [Digital Ocean App Platform documentation](https://docs.digitalocean.com/products/app-platform/)
|
|
181
|
+
- [Digital Ocean Droplets documentation](https://docs.digitalocean.com/products/droplets/)
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Create
|
|
3
|
-
description: "Mastra allows
|
|
2
|
+
title: "Create a custom eval"
|
|
3
|
+
description: "Mastra allows you to create your own evals, here is how."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Create
|
|
6
|
+
# Create a Custom Eval
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Create a custom eval by extending the `Metric` class and implementing the `measure` method. This gives you full control over how scores are calculated and what information is returned. For LLM-based evaluations, extend the `MastraAgentJudge` class to define how the model reasons and scores output.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Native JavaScript evaluation
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
You can write lightweight custom metrics using plain JavaScript/TypeScript. These are ideal for simple string comparisons, pattern checks, or other rule-based logic.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
See our [Word Inclusion example](/examples/evals/custom-native-javascript-eval.mdx), which scores responses based on the number of reference words found in the output.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## LLM as a judge evaluation
|
|
17
|
+
|
|
18
|
+
For more complex evaluations, you can build a judge powered by an LLM. This lets you capture more nuanced criteria, like factual accuracy, tone, or reasoning.
|
|
19
|
+
|
|
20
|
+
See the [Real World Countries example](/examples/evals/custom-llm-judge-eval.mdx) for a complete walkthrough of building a custom judge and metric that evaluates real-world factual accuracy.
|
|
17
21
|
|
|
18
|
-
- Medical Q&A → Judge checks for medical accuracy and safety
|
|
19
|
-
- Customer Service → Judge evaluates tone and helpfulness
|
|
20
|
-
- Code Generation → Judge verifies code correctness and style
|
|
21
22
|
|
|
22
|
-
For a practical example, see how we evaluate [Chef Michel's](/docs/guides/chef-michel) recipes for gluten content in our [Gluten Checker example](/examples/evals/custom-eval).
|
|
@@ -68,6 +68,22 @@ You can also run the Mastra CLI in non-interactive mode by passing all required
|
|
|
68
68
|
npx create-mastra@latest --project-name hello-mastra --example --components tools,agents,workflows --llm openai
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
**Install with a template**
|
|
72
|
+
|
|
73
|
+
Start with a pre-built template that demonstrates specific use cases:
|
|
74
|
+
|
|
75
|
+
```bash copy
|
|
76
|
+
npx create-mastra@latest --template template-name
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For example, to create a text-to-SQL application:
|
|
80
|
+
|
|
81
|
+
```bash copy
|
|
82
|
+
npx create-mastra@latest --template text-to-sql
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> Browse available templates and learn more in [Templates](/docs/getting-started/templates).
|
|
86
|
+
|
|
71
87
|
> See the [create-mastra](/reference/cli/create-mastra) documentation for a full list of available CLI options.
|
|
72
88
|
|
|
73
89
|
### Add your API key
|