@mastra/mcp-docs-server 0.13.22-alpha.2 → 0.13.22-alpha.4

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.
Files changed (104) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +20 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +9 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fastra.md +11 -11
  4. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +13 -13
  5. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
  6. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +23 -23
  7. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +21 -21
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
  9. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +10 -10
  10. package/.docs/organized/changelogs/%40mastra%2Fcore.md +56 -56
  11. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +33 -33
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +28 -28
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +22 -22
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +23 -23
  16. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +61 -61
  17. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +19 -19
  18. package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
  19. package/.docs/organized/changelogs/%40mastra%2Flance.md +11 -11
  20. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +11 -11
  21. package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
  22. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +19 -19
  23. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
  24. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +21 -21
  25. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +21 -21
  26. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +10 -10
  27. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +10 -10
  28. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
  29. package/.docs/organized/changelogs/%40mastra%2Fpg.md +13 -13
  30. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
  31. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +39 -39
  32. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +11 -11
  33. package/.docs/organized/changelogs/%40mastra%2Frag.md +16 -16
  34. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +11 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fserver.md +21 -21
  36. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
  37. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +11 -11
  38. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
  39. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +10 -10
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +10 -10
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +9 -0
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +10 -10
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +10 -10
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +10 -10
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +10 -10
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +19 -19
  52. package/.docs/organized/changelogs/create-mastra.md +9 -9
  53. package/.docs/organized/changelogs/mastra.md +58 -58
  54. package/.docs/organized/code-examples/agent-network.md +2 -1
  55. package/.docs/organized/code-examples/quick-start.md +2 -1
  56. package/.docs/organized/code-examples/weather-agent.md +11 -4
  57. package/.docs/organized/code-examples/workflow-ai-recruiter.md +2 -1
  58. package/.docs/raw/agents/overview.mdx +1 -1
  59. package/.docs/raw/auth/firebase.mdx +285 -0
  60. package/.docs/raw/auth/index.mdx +3 -3
  61. package/.docs/raw/course/04-workflows/08-running-workflows-programmatically.md +2 -2
  62. package/.docs/raw/deployment/overview.mdx +7 -1
  63. package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +108 -0
  64. package/.docs/raw/getting-started/installation.mdx +0 -1
  65. package/.docs/raw/memory/overview.mdx +1 -1
  66. package/.docs/raw/reference/agents/network.mdx +258 -0
  67. package/.docs/raw/reference/auth/firebase.mdx +128 -0
  68. package/.docs/raw/reference/cli/dev.mdx +7 -1
  69. package/.docs/raw/reference/client-js/agents.mdx +3 -3
  70. package/.docs/raw/reference/client-js/memory.mdx +1 -1
  71. package/.docs/raw/reference/client-js/tools.mdx +1 -1
  72. package/.docs/raw/reference/core/getWorkflow.mdx +0 -1
  73. package/.docs/raw/reference/core/getWorkflows.mdx +0 -1
  74. package/.docs/raw/reference/core/setTelemetry.mdx +2 -2
  75. package/.docs/raw/reference/storage/dynamodb.mdx +0 -4
  76. package/.docs/raw/reference/{agents → streaming}/ChunkType.mdx +12 -12
  77. package/.docs/raw/reference/{agents → streaming}/MastraModelOutput.mdx +10 -10
  78. package/.docs/raw/reference/tools/mcp-server.mdx +1 -1
  79. package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +2 -2
  80. package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
  81. package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +3 -3
  82. package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
  83. package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
  84. package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +1 -1
  85. package/.docs/raw/reference/workflows/workflow-methods/map.mdx +1 -1
  86. package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
  87. package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +1 -1
  88. package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +1 -1
  89. package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +1 -1
  90. package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
  91. package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +1 -1
  92. package/.docs/raw/server-db/local-dev-playground.mdx +31 -9
  93. package/.docs/raw/server-db/mastra-client.mdx +189 -73
  94. package/.docs/raw/server-db/snapshots.mdx +155 -114
  95. package/.docs/raw/workflows/inngest-workflow.mdx +82 -0
  96. package/CHANGELOG.md +18 -0
  97. package/package.json +5 -5
  98. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +0 -302
  99. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +0 -302
  100. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +0 -302
  101. package/.docs/organized/changelogs/%40mastra%2Fragie.md +0 -302
  102. package/.docs/organized/code-examples/memory-with-mem0.md +0 -108
  103. /package/.docs/raw/reference/{agents → streaming}/stream.mdx +0 -0
  104. /package/.docs/raw/reference/{agents → streaming}/streamVNext.mdx +0 -0
@@ -0,0 +1,285 @@
1
+ ---
2
+ title: "MastraAuthFirebase Class"
3
+ description: "Documentation for the MastraAuthFirebase class, which authenticates Mastra applications using Firebase Authentication."
4
+ ---
5
+
6
+ import { Tabs, Tab } from "@/components/tabs";
7
+
8
+ # MastraAuthFirebase Class
9
+
10
+ The `MastraAuthFirebase` class provides authentication for Mastra using Firebase Authentication. It verifies incoming requests using Firebase ID tokens and integrates with the Mastra server using the `experimental_auth` option.
11
+
12
+ ## Prerequisites
13
+
14
+ This example uses Firebase Authentication. Make sure to:
15
+
16
+ 1. Create a Firebase project in the [Firebase Console](https://console.firebase.google.com/)
17
+ 2. Enable Authentication and configure your preferred sign-in methods (Google, Email/Password, etc.)
18
+ 3. Generate a service account key from Project Settings > Service Accounts
19
+ 4. Download the service account JSON file
20
+
21
+ ```env filename=".env" copy
22
+ FIREBASE_SERVICE_ACCOUNT=/path/to/your/service-account-key.json
23
+ FIRESTORE_DATABASE_ID=(default)
24
+ # Alternative environment variable names:
25
+ # FIREBASE_DATABASE_ID=(default)
26
+ ```
27
+
28
+ > **Note:** Store your service account JSON file securely and never commit it to version control.
29
+
30
+ ## Installation
31
+
32
+ Before you can use the `MastraAuthFirebase` class you have to install the `@mastra/auth-firebase` package.
33
+
34
+ ```bash copy
35
+ npm install @mastra/auth-firebase@latest
36
+ ```
37
+
38
+ ## Usage examples
39
+
40
+ ### Basic usage with environment variables
41
+
42
+ If you set the required environment variables (`FIREBASE_SERVICE_ACCOUNT` and `FIRESTORE_DATABASE_ID`), you can initialize `MastraAuthFirebase` without any constructor arguments. The class will automatically read these environment variables as configuration:
43
+
44
+ ```typescript {2,7} filename="src/mastra/index.ts" showLineNumbers copy
45
+ import { Mastra } from "@mastra/core/mastra";
46
+ import { MastraAuthFirebase } from '@mastra/auth-firebase';
47
+
48
+ // Automatically uses FIREBASE_SERVICE_ACCOUNT and FIRESTORE_DATABASE_ID env vars
49
+ export const mastra = new Mastra({
50
+ // ..
51
+ server: {
52
+ experimental_auth: new MastraAuthFirebase(),
53
+ },
54
+ });
55
+ ```
56
+
57
+ ### Custom configuration
58
+
59
+ ```typescript {2,7-10} filename="src/mastra/index.ts" showLineNumbers copy
60
+ import { Mastra } from "@mastra/core/mastra";
61
+ import { MastraAuthFirebase } from '@mastra/auth-firebase';
62
+
63
+ export const mastra = new Mastra({
64
+ // ..
65
+ server: {
66
+ experimental_auth: new MastraAuthFirebase({
67
+ serviceAccount: '/path/to/service-account.json',
68
+ databaseId: 'your-database-id'
69
+ }),
70
+ },
71
+ });
72
+ ```
73
+
74
+ ## Configuration
75
+
76
+ The `MastraAuthFirebase` class can be configured through constructor options or environment variables.
77
+
78
+ ### Environment Variables
79
+
80
+ - `FIREBASE_SERVICE_ACCOUNT`: Path to Firebase service account JSON file
81
+ - `FIRESTORE_DATABASE_ID` or `FIREBASE_DATABASE_ID`: Firestore database ID
82
+
83
+ > **Note:** When constructor options are not provided, the class automatically reads these environment variables. This means you can simply call `new MastraAuthFirebase()` without any arguments if your environment variables are properly configured.
84
+
85
+ ### User Authorization
86
+
87
+ By default, `MastraAuthFirebase` uses Firestore to manage user access. It expects a collection named `user_access` with documents keyed by user UIDs. The presence of a document in this collection determines whether a user is authorized.
88
+
89
+ ```typescript filename="firestore-structure.txt" copy
90
+ user_access/
91
+ {user_uid_1}/ // Document exists = user authorized
92
+ {user_uid_2}/ // Document exists = user authorized
93
+ ```
94
+
95
+ To customize user authorization, provide a custom `authorizeUser` function:
96
+
97
+ ```typescript filename="src/mastra/auth.ts" showLineNumbers copy
98
+ import { MastraAuthFirebase } from '@mastra/auth-firebase';
99
+
100
+ const firebaseAuth = new MastraAuthFirebase({
101
+ authorizeUser: async (user) => {
102
+ // Custom authorization logic
103
+ return user.email?.endsWith('@yourcompany.com') || false;
104
+ }
105
+ });
106
+ ```
107
+
108
+ > See the [MastraAuthFirebase](/reference/auth/firebase.mdx) API reference for all available configuration options.
109
+
110
+ ## Client-side setup
111
+
112
+ When using Firebase auth, you'll need to initialize Firebase on the client side, authenticate users, and retrieve their ID tokens to pass to your Mastra requests.
113
+
114
+ ### Setting up Firebase on the client
115
+
116
+ First, initialize Firebase in your client application:
117
+
118
+ ```typescript filename="lib/firebase.ts" showLineNumbers copy
119
+ import { initializeApp } from 'firebase/app';
120
+ import { getAuth, GoogleAuthProvider } from 'firebase/auth';
121
+
122
+ const firebaseConfig = {
123
+ apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
124
+ authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
125
+ projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
126
+ };
127
+
128
+ const app = initializeApp(firebaseConfig);
129
+ export const auth = getAuth(app);
130
+ export const googleProvider = new GoogleAuthProvider();
131
+ ```
132
+
133
+ ### Authenticating users and retrieving tokens
134
+
135
+ Use Firebase authentication to sign in users and retrieve their ID tokens:
136
+
137
+ ```typescript filename="lib/auth.ts" showLineNumbers copy
138
+ import { signInWithPopup, signOut, User } from 'firebase/auth';
139
+ import { auth, googleProvider } from './firebase';
140
+
141
+ export const signInWithGoogle = async () => {
142
+ try {
143
+ const result = await signInWithPopup(auth, googleProvider);
144
+ return result.user;
145
+ } catch (error) {
146
+ console.error('Error signing in:', error);
147
+ throw error;
148
+ }
149
+ };
150
+
151
+ export const getIdToken = async (user: User) => {
152
+ try {
153
+ const idToken = await user.getIdToken();
154
+ return idToken;
155
+ } catch (error) {
156
+ console.error('Error getting ID token:', error);
157
+ throw error;
158
+ }
159
+ };
160
+
161
+ export const signOutUser = async () => {
162
+ try {
163
+ await signOut(auth);
164
+ } catch (error) {
165
+ console.error('Error signing out:', error);
166
+ throw error;
167
+ }
168
+ };
169
+ ```
170
+
171
+ > Refer to the [Firebase documentation](https://firebase.google.com/docs/auth) for other authentication methods like email/password, phone authentication, and more.
172
+
173
+ ## Configuring `MastraClient`
174
+
175
+ When `experimental_auth` is enabled, all requests made with `MastraClient` must include a valid Firebase ID token in the `Authorization` header:
176
+
177
+ ```typescript {6} filename="lib/mastra/mastra-client.ts" showLineNumbers copy
178
+ import { MastraClient } from "@mastra/client-js";
179
+
180
+ export const createMastraClient = (idToken: string) => {
181
+ return new MastraClient({
182
+ baseUrl: "https://<mastra-api-url>",
183
+ headers: {
184
+ Authorization: `Bearer ${idToken}`
185
+ }
186
+ });
187
+ };
188
+ ```
189
+
190
+ > **Note:** The ID token must be prefixed with `Bearer` in the Authorization header.
191
+
192
+ > See [Mastra Client SDK](/docs/server-db/mastra-client.mdx) for more configuration options.
193
+
194
+ ### Making authenticated requests
195
+
196
+ Once `MastraClient` is configured with the Firebase ID token, you can send authenticated requests:
197
+
198
+ <Tabs items={["React Component", "Node.js Server", "curl"]}>
199
+ <Tab>
200
+ ```tsx filename="src/components/test-agent.tsx" showLineNumbers copy
201
+ "use client";
202
+
203
+ import { useAuthState } from 'react-firebase-hooks/auth';
204
+ import { MastraClient } from "@mastra/client-js";
205
+ import { auth } from '../lib/firebase';
206
+ import { getIdToken } from '../lib/auth';
207
+
208
+ export const TestAgent = () => {
209
+ const [user] = useAuthState(auth);
210
+
211
+ async function handleClick() {
212
+ if (!user) return;
213
+
214
+ const token = await getIdToken(user);
215
+ const client = createMastraClient(token);
216
+
217
+ const weatherAgent = client.getAgent("weatherAgent");
218
+ const response = await weatherAgent.generate({
219
+ messages: "What's the weather like in New York",
220
+ });
221
+
222
+ console.log({ response });
223
+ }
224
+
225
+ return (
226
+ <button onClick={handleClick} disabled={!user}>
227
+ Test Agent
228
+ </button>
229
+ );
230
+ };
231
+ ```
232
+ </Tab>
233
+ <Tab>
234
+ ```typescript filename="server.js" showLineNumbers copy
235
+ const express = require('express');
236
+ const admin = require('firebase-admin');
237
+ const { MastraClient } = require('@mastra/client-js');
238
+
239
+ // Initialize Firebase Admin
240
+ admin.initializeApp({
241
+ credential: admin.credential.cert({
242
+ // Your service account credentials
243
+ })
244
+ });
245
+
246
+ const app = express();
247
+ app.use(express.json());
248
+
249
+ app.post('/generate', async (req, res) => {
250
+ try {
251
+ const { idToken } = req.body;
252
+
253
+ // Verify the token
254
+ await admin.auth().verifyIdToken(idToken);
255
+
256
+ const mastra = new MastraClient({
257
+ baseUrl: "http://localhost:4111",
258
+ headers: {
259
+ Authorization: `Bearer ${idToken}`
260
+ }
261
+ });
262
+
263
+ const weatherAgent = mastra.getAgent("weatherAgent");
264
+ const response = await weatherAgent.generate({
265
+ messages: "What's the weather like in Nairobi"
266
+ });
267
+
268
+ res.json({ response: response.text });
269
+ } catch (error) {
270
+ res.status(401).json({ error: 'Unauthorized' });
271
+ }
272
+ });
273
+ ```
274
+ </Tab>
275
+ <Tab>
276
+ ```bash copy
277
+ curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
278
+ -H "Content-Type: application/json" \
279
+ -H "Authorization: Bearer <your-firebase-id-token>" \
280
+ -d '{
281
+ "messages": "Weather in London"
282
+ }'
283
+ ```
284
+ </Tab>
285
+ </Tabs>
@@ -12,13 +12,13 @@ You can start with simple shared secret JWT authentication and switch to provide
12
12
  ## Available providers
13
13
 
14
14
  - [JSON Web Token (JWT)](/docs/auth/jwt)
15
+ - [Clerk](/docs/auth/clerk)
16
+ - [Supabase](/docs/auth/supabase)
17
+ - [Firebase](/docs/auth/firebase)
15
18
 
16
19
  ### Coming soon
17
20
 
18
21
  The following providers will be available soon:
19
22
 
20
- - Supabase Auth
21
- - Firebase Auth
22
23
  - Auth0
23
- - Clerk
24
24
  - WorkOS
@@ -22,7 +22,7 @@ async function runContentWorkflow() {
22
22
  }
23
23
 
24
24
  // Create a run instance
25
- const run = workflow.createRun();
25
+ const run = await workflow.createRunAsync();
26
26
 
27
27
  // Execute with test data
28
28
  const result = await run.start({
@@ -63,7 +63,7 @@ npx tsx src/run-workflow.ts
63
63
  ## Key Methods
64
64
 
65
65
  - **`mastra.getWorkflow(id)`**: Gets a registered workflow by ID
66
- - **`workflow.createRun()`**: Creates a new execution instance
66
+ - **`workflow.createRunAsync()`**: Creates a new execution instance
67
67
  - **`run.start(inputData)`**: Executes the workflow with provided data
68
68
 
69
69
  ## Return Value
@@ -9,6 +9,13 @@ Mastra offers multiple deployment options to suit your application's needs, from
9
9
 
10
10
  ## Deployment Options
11
11
 
12
+ ### Runtime support
13
+
14
+ - Node.js `v20.0` or higher
15
+ - Bun
16
+ - Deno
17
+ - [Cloudflare](../deployment/serverless-platforms/cloudflare-deployer.mdx)
18
+
12
19
  ### Mastra Cloud
13
20
 
14
21
  Mastra Cloud is a deployment platform that connects to your GitHub repository, automatically deploys on code changes, and provides monitoring tools. It includes:
@@ -21,7 +28,6 @@ Mastra Cloud is a deployment platform that connects to your GitHub repository, a
21
28
 
22
29
  [View Mastra Cloud documentation →](../mastra-cloud/overview.mdx)
23
30
 
24
-
25
31
  ### With a Web Framework
26
32
 
27
33
  Mastra can be integrated with a variety of web frameworks. For example, see one of the following for a detailed guide.
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: 'Cedar-OS Integration'
3
+ description: 'Build AI-native frontends for your Mastra agents with Cedar-OS'
4
+ ---
5
+
6
+
7
+ import { Tabs, Steps } from "nextra/components";
8
+
9
+ # Integrate Cedar-OS with Mastra
10
+
11
+ Cedar-OS is an open-source agentic UI framework designed specifically for building the most ambitious AI-native applications. We built Cedar with Mastra in mind.
12
+
13
+ ## Should you use Cedar?
14
+
15
+ There are a few pillars we care about strongly that you can read more about [here](https://docs.cedarcopilot.com/introduction/philosophy):
16
+
17
+ #### 1. Developer experience
18
+ - **Every single component is downloaded shadcn-style** – You own all the code and can style it however you want
19
+ - **Works out of the box** – Just drop in our chat component, and it'll work
20
+ - **Fully extensible** - Built on a [Zustand store architecture](https://docs.cedarcopilot.com/introduction/architecture) that you can customize completely. Every single internal function can be overridden in one line.
21
+
22
+ #### 2. Enabling truly AI-native applications
23
+ For the first time in history, products can come to life. We want to help you build something with life.
24
+ - **[Spells](https://docs.cedarcopilot.com/spells/spells#what-are-spells)** - Users can trigger AI from keyboard shortcuts, mouse events, text selection, and other components
25
+ - **[State Diff Management](https://docs.cedarcopilot.com/state-diff/using-state-diff)** - Give users control over accepting/rejecting agent outputs
26
+ - **[Voice Integration](https://docs.cedarcopilot.com/voice/voice-integration)** - Let users control your app with their voice
27
+
28
+ ## Quick Start
29
+
30
+ <Steps>
31
+ ### Set up your project
32
+
33
+ Run Cedar's CLI command:
34
+ ``` bash
35
+ npx cedar-os-cli plant-seed
36
+ ```
37
+
38
+ If starting from scratch, select the **Mastra starter** template for a complete setup with both frontend and backend in a monorepo
39
+
40
+ If you already have a Mastra backend, use the **blank frontend cedar repo** option instead.
41
+ - This will give you the option to download components and download all dependencies for Cedar. We recommend at least downloading one of the chat components to get started.
42
+
43
+ ### Wrap your app with CedarCopilot
44
+
45
+ Wrap your application with the CedarCopilot provider to connect to your Mastra backend:
46
+
47
+ ```tsx
48
+ import { CedarCopilot } from 'cedar-os';
49
+
50
+ function App() {
51
+ return (
52
+ <CedarCopilot
53
+ llmProvider={{
54
+ provider: 'mastra',
55
+ baseURL: 'http://localhost:4111', // default dev port for Mastra
56
+ apiKey: process.env.NEXT_PUBLIC_MASTRA_API_KEY, // optional — only for backend auth
57
+ }}>
58
+ <YourApp />
59
+ </CedarCopilot>
60
+ );
61
+ }
62
+ ```
63
+
64
+ ### Configure Mastra endpoints
65
+
66
+ Configure your Mastra backend to work with Cedar by following the [Mastra Configuration Options](https://docs.cedarcopilot.com/agent-backend-connection/agent-backend-connection#mastra-configuration-options).
67
+
68
+ [Register API routes](https://mastra.ai/en/examples/deployment/custom-api-route) in your Mastra server (or NextJS serverless routes if in a monorepo):
69
+
70
+ ```ts mastra/src/index.ts
71
+ import { registerApiRoute } from '@mastra/core/server';
72
+
73
+ // POST /chat
74
+ // The chat's non-streaming default endpoint
75
+ registerApiRoute('/chat', {
76
+ method: 'POST',
77
+ // …validate input w/ zod
78
+ handler: async (c) => {
79
+ /* your agent.generate() logic */
80
+ },
81
+ });
82
+
83
+ // POST /chat/stream (SSE)
84
+ // The chat's streaming default endpoint
85
+ registerApiRoute('/chat/stream', {
86
+ method: 'POST',
87
+ handler: async (c) => {
88
+ /* stream agent output in SSE format */
89
+ },
90
+ });
91
+ ```
92
+
93
+ ### Add Cedar components
94
+
95
+ Drop Cedar components into your frontend – see [Chat Overview](https://docs.cedarcopilot.com/chat/chat-overview).
96
+
97
+ Your backend and frontend are now linked! You're ready to start building AI-native experiences with your Mastra agents.
98
+ </Steps>
99
+
100
+
101
+ ## More information
102
+
103
+ - Check out the [detailed Mastra integration guide](https://docs.cedarcopilot.com/agent-backend-connection/mastra#extending-mastra) for more configuration options (or for manual installation instructions if something goes wrong)
104
+ - Explore Mastra-specific optimizations and features we've built
105
+ - **Seamless event streaming** - Automatic rendering of [Mastra streamed events](https://docs.cedarcopilot.com/chat/custom-message-rendering#mastra-event-renderer)
106
+ - **Voice endpoint support** - Built-in [voice backend integration](https://docs.cedarcopilot.com/voice/agentic-backend#endpoint-configuration)
107
+ - **End-to-End type safety** - [Types](https://docs.cedarcopilot.com/type-safety/typing-agent-requests) for communicating between your app and Mastra backend
108
+ - [Join our Discord!](https://discord.gg/4AWawRjNdZ) We're excited to have you :)
@@ -12,7 +12,6 @@ To get started with Mastra, you’ll need access to a large language model (LLM)
12
12
 
13
13
  Mastra also supports other LLM providers. For a full list of supported models and setup instructions, see [Model Providers](/docs/getting-started/model-providers).
14
14
 
15
-
16
15
  ## Prerequisites
17
16
 
18
17
  - Node.js `v20.0` or higher
@@ -26,7 +26,7 @@ All memory types are [thread-scoped](./working-memory.mdx#thread-scoped-memory-d
26
26
 
27
27
  ### Working memory
28
28
 
29
- Stores persistent user-specific details such as names, preferences, goals, and other structured data. Uses [Markdown templates](./working-memory-template.mdx) or [Zod schemas](./working-memory-schema.mdx) to define structure.
29
+ Stores persistent user-specific details such as names, preferences, goals, and other structured data. Uses [Markdown templates](./working-memory.mdx) or [Zod schemas](./working-memory.mdx#structured-working-memory) to define structure.
30
30
 
31
31
  ### Conversation history
32
32