@mastra/client-js 1.2.0 → 1.2.1-alpha.0

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 (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +10 -7
  3. package/dist/client.d.ts +11 -1
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/docs/SKILL.md +32 -22
  6. package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +1 -1
  7. package/dist/docs/{server/07-auth0.md → references/docs-server-auth-auth0.md} +68 -79
  8. package/dist/docs/{server/03-clerk.md → references/docs-server-auth-clerk.md} +41 -52
  9. package/dist/docs/{server/05-firebase.md → references/docs-server-auth-firebase.md} +83 -97
  10. package/dist/docs/{server/02-jwt.md → references/docs-server-auth-jwt.md} +46 -35
  11. package/dist/docs/{server/04-supabase.md → references/docs-server-auth-supabase.md} +33 -44
  12. package/dist/docs/{server/06-workos.md → references/docs-server-auth-workos.md} +45 -56
  13. package/dist/docs/{server/01-mastra-client.md → references/docs-server-mastra-client.md} +32 -20
  14. package/dist/docs/{ai-sdk/01-reference.md → references/reference-ai-sdk-to-ai-sdk-stream.md} +27 -153
  15. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v4-messages.md +79 -0
  16. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v5-messages.md +73 -0
  17. package/dist/docs/references/reference-client-js-agents.md +438 -0
  18. package/dist/docs/references/reference-client-js-error-handling.md +16 -0
  19. package/dist/docs/references/reference-client-js-logs.md +24 -0
  20. package/dist/docs/references/reference-client-js-mastra-client.md +63 -0
  21. package/dist/docs/references/reference-client-js-memory.md +225 -0
  22. package/dist/docs/references/reference-client-js-observability.md +72 -0
  23. package/dist/docs/references/reference-client-js-telemetry.md +20 -0
  24. package/dist/docs/references/reference-client-js-tools.md +44 -0
  25. package/dist/docs/references/reference-client-js-vectors.md +79 -0
  26. package/dist/docs/references/reference-client-js-workflows.md +199 -0
  27. package/dist/index.cjs +18 -1
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.js +18 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/types.d.ts +158 -27
  32. package/dist/types.d.ts.map +1 -1
  33. package/package.json +7 -7
  34. package/dist/docs/README.md +0 -33
  35. package/dist/docs/client-js/01-reference.md +0 -1180
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 1.2.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Update types and add new methods: ([#12704](https://github.com/mastra-ai/mastra/pull/12704))
8
+ - Updated `CreateStoredAgentParams` and `UpdateStoredAgentParams` types to match server schemas
9
+ - Added proper `SerializedMemoryConfig` type with all fields including `embedder` and `embedderOptions`
10
+ - Fixed `StoredAgentScorerConfig` to use correct sampling types (`'none' | 'ratio'`)
11
+ - Added `listVectors()` and `listEmbedders()` methods to the client
12
+ - Added corresponding `ListVectorsResponse` and `ListEmbeddersResponse` types
13
+
14
+ - Updated dependencies [[`90f7894`](https://github.com/mastra-ai/mastra/commit/90f7894568dc9481f40a4d29672234fae23090bb), [`8109aee`](https://github.com/mastra-ai/mastra/commit/8109aeeab758e16cd4255a6c36f044b70eefc6a6)]:
15
+ - @mastra/core@1.2.1-alpha.0
16
+
3
17
  ## 1.2.0
4
18
 
5
19
  ### Minor Changes
@@ -4677,8 +4677,16 @@ export declare type ObjectStreamPart<PARTIAL> = {
4677
4677
  usage: LanguageModelUsage;
4678
4678
  response: LanguageModelResponseMetadata;
4679
4679
  providerMetadata?: ProviderMetadata;
4680
- };
4681
-
4680
+ };
4681
+
4682
+ export declare namespace Output {
4683
+ export {
4684
+ output_Output as Output,
4685
+ output_object as object,
4686
+ output_text as text,
4687
+ };
4688
+ }
4689
+
4682
4690
  declare interface Output_2<OUTPUT, PARTIAL> {
4683
4691
  readonly type: 'object' | 'text';
4684
4692
  responseFormat: LanguageModelV2CallOptions['responseFormat'];
@@ -8503,9 +8511,4 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
8503
8511
 
8504
8512
  export { }
8505
8513
  export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, FlexibleSchema as FlexibleSchema, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, ContentPart as ContentPart, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
8506
-
8507
- export namespace Output {
8508
- export { output_Output as Output, output_object as object, output_text as text };
8509
- }
8510
-
8511
8514
  export { schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol, symbol_2, validatorSymbol };
package/dist/client.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { TraceRecord, ListTracesArgs, ListTracesResponse } from '@mastra/co
5
5
  import type { WorkflowInfo } from '@mastra/core/workflows';
6
6
  import { Agent, MemoryThread, Tool, Processor, Workflow, Vector, BaseResource, A2A, MCPTool, AgentBuilder, StoredAgent, Workspace } from './resources/index.js';
7
7
  import type { ListScoresBySpanParams, LegacyTracesPaginatedArg, LegacyGetTracesResponse } from './resources/observability.js';
8
- import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetToolResponse, GetProcessorResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetScorerResponse, ListScoresByScorerIdParams, ListScoresByRunIdParams, ListScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse, GetMemoryConfigParams, GetMemoryConfigResponse, ListMemoryThreadMessagesResponse, MemorySearchResponse, ListAgentsModelProvidersResponse, ListMemoryThreadsParams, ListMemoryThreadsResponse, ListStoredAgentsParams, ListStoredAgentsResponse, CreateStoredAgentParams, StoredAgentResponse, GetSystemPackagesResponse, ListScoresResponse as ListScoresResponseOld, GetObservationalMemoryParams, GetObservationalMemoryResponse, GetMemoryStatusResponse, ListWorkspacesResponse } from './types.js';
8
+ import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetToolResponse, GetProcessorResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetScorerResponse, ListScoresByScorerIdParams, ListScoresByRunIdParams, ListScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse, GetMemoryConfigParams, GetMemoryConfigResponse, ListMemoryThreadMessagesResponse, MemorySearchResponse, ListAgentsModelProvidersResponse, ListMemoryThreadsParams, ListMemoryThreadsResponse, ListStoredAgentsParams, ListStoredAgentsResponse, CreateStoredAgentParams, StoredAgentResponse, GetSystemPackagesResponse, ListScoresResponse as ListScoresResponseOld, GetObservationalMemoryParams, GetObservationalMemoryResponse, GetMemoryStatusResponse, ListWorkspacesResponse, ListVectorsResponse, ListEmbeddersResponse } from './types.js';
9
9
  export declare class MastraClient extends BaseResource {
10
10
  private observability;
11
11
  constructor(options: ClientOptions);
@@ -335,5 +335,15 @@ export declare class MastraClient extends BaseResource {
335
335
  * @returns Workspace instance
336
336
  */
337
337
  getWorkspace(workspaceId: string): Workspace;
338
+ /**
339
+ * Lists all available vector stores
340
+ * @returns Promise containing list of available vector stores
341
+ */
342
+ listVectors(): Promise<ListVectorsResponse>;
343
+ /**
344
+ * Lists all available embedding models
345
+ * @returns Promise containing list of available embedders
346
+ */
347
+ listEmbedders(): Promise<ListEmbeddersResponse>;
338
348
  }
339
349
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,GAAG,EACH,OAAO,EACP,YAAY,EAEZ,WAAW,EACX,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,gCAAgC,EAChC,oBAAoB,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ACI,cAAc,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAIxD;;;;OAIG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IAQnD;;;OAGG;IACI,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIlD;;;OAGG;IACI,aAAa,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAGvD"}
@@ -1,34 +1,44 @@
1
1
  ---
2
- name: mastra-client-js-docs
3
- description: Documentation for @mastra/client-js. Includes links to type definitions and readable implementation code in dist/.
2
+ name: mastra-client-js
3
+ description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
4
+ metadata:
5
+ package: "@mastra/client-js"
6
+ version: "1.2.1-alpha.0"
4
7
  ---
5
8
 
6
- # @mastra/client-js Documentation
9
+ ## When to use
7
10
 
8
- > **Version**: 1.2.0
9
- > **Package**: @mastra/client-js
11
+ Use this skill whenever you are working with @mastra/client-js to obtain the domain-specific knowledge.
10
12
 
11
- ## Quick Navigation
13
+ ## How to use
12
14
 
13
- Use SOURCE_MAP.json to find any export:
15
+ Read the individual reference documents for detailed explanations and code examples.
14
16
 
15
- ```bash
16
- cat docs/SOURCE_MAP.json
17
- ```
17
+ ### Docs
18
18
 
19
- Each export maps to:
20
- - **types**: `.d.ts` file with JSDoc and API signatures
21
- - **implementation**: `.js` chunk file with readable source
22
- - **docs**: Conceptual documentation in `docs/`
19
+ - [MastraAuthAuth0 Class](references/docs-server-auth-auth0.md) - Documentation for the MastraAuthAuth0 class, which authenticates Mastra applications using Auth0 authentication.
20
+ - [MastraAuthClerk Class](references/docs-server-auth-clerk.md) - Documentation for the MastraAuthClerk class, which authenticates Mastra applications using Clerk authentication.
21
+ - [MastraAuthFirebase Class](references/docs-server-auth-firebase.md) - Documentation for the MastraAuthFirebase class, which authenticates Mastra applications using Firebase Authentication.
22
+ - [MastraJwtAuth Class](references/docs-server-auth-jwt.md) - Documentation for the MastraJwtAuth class, which authenticates Mastra applications using JSON Web Tokens.
23
+ - [MastraAuthSupabase Class](references/docs-server-auth-supabase.md) - Documentation for the MastraAuthSupabase class, which authenticates Mastra applications using Supabase Auth.
24
+ - [MastraAuthWorkos Class](references/docs-server-auth-workos.md) - Documentation for the MastraAuthWorkos class, which authenticates Mastra applications using WorkOS authentication.
25
+ - [Mastra Client SDK](references/docs-server-mastra-client.md) - Learn how to set up and use the Mastra Client SDK
23
26
 
24
- ## Top Exports
27
+ ### Reference
25
28
 
29
+ - [Reference: toAISdkStream()](references/reference-ai-sdk-to-ai-sdk-stream.md) - API reference for toAISdkStream(), a function to convert Mastra streams to AI SDK-compatible streams.
30
+ - [Reference: toAISdkV4Messages()](references/reference-ai-sdk-to-ai-sdk-v4-messages.md) - API reference for toAISdkV4Messages(), a function to convert Mastra messages to AI SDK v4 UI messages.
31
+ - [Reference: toAISdkV5Messages()](references/reference-ai-sdk-to-ai-sdk-v5-messages.md) - API reference for toAISdkV5Messages(), a function to convert Mastra messages to AI SDK v5 UI messages.
32
+ - [Reference: Agents API](references/reference-client-js-agents.md) - Learn how to interact with Mastra AI agents, including generating responses, streaming interactions, and managing agent tools using the client-js SDK.
33
+ - [Reference: Error Handling](references/reference-client-js-error-handling.md) - Learn about the built-in retry mechanism and error handling capabilities in the Mastra client-js SDK.
34
+ - [Reference: Logs API](references/reference-client-js-logs.md) - Learn how to access and query system logs and debugging information in Mastra using the client-js SDK.
35
+ - [Reference: Mastra Client SDK](references/reference-client-js-mastra-client.md) - Learn how to interact with Mastra using the client-js SDK.
36
+ - [Reference: Memory API](references/reference-client-js-memory.md) - Learn how to manage conversation threads and message history in Mastra using the client-js SDK.
37
+ - [Reference: Observability API](references/reference-client-js-observability.md) - Learn how to retrieve traces, monitor application performance, and score traces using the client-js SDK.
38
+ - [Reference: Telemetry API](references/reference-client-js-telemetry.md) - Learn how to retrieve and analyze traces from your Mastra application for monitoring and debugging using the client-js SDK.
39
+ - [Reference: Tools API](references/reference-client-js-tools.md) - Learn how to interact with and execute tools available in the Mastra platform using the client-js SDK.
40
+ - [Reference: Vectors API](references/reference-client-js-vectors.md) - Learn how to work with vector embeddings for semantic search and similarity matching in Mastra using the client-js SDK.
41
+ - [Reference: Workflows API](references/reference-client-js-workflows.md) - Learn how to interact with and execute automated workflows in Mastra using the client-js SDK.
26
42
 
27
43
 
28
- See SOURCE_MAP.json for the complete list.
29
-
30
- ## Available Topics
31
-
32
- - [Ai sdk](ai-sdk/) - 3 file(s)
33
- - [Client js](client-js/) - 10 file(s)
34
- - [Server](server/) - 7 file(s)
44
+ Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0",
2
+ "version": "1.2.1-alpha.0",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,5 +1,3 @@
1
- > Documentation for the MastraAuthAuth0 class, which authenticates Mastra applications using Auth0 authentication.
2
-
3
1
  # MastraAuthAuth0 Class
4
2
 
5
3
  The `MastraAuthAuth0` class provides authentication for Mastra using Auth0. It verifies incoming requests using Auth0-issued JWT tokens and integrates with the Mastra server using the `auth` option.
@@ -13,16 +11,14 @@ This example uses Auth0 authentication. Make sure to:
13
11
  3. Configure an API in your Auth0 Dashboard with an identifier (audience)
14
12
  4. Configure your application's allowed callback URLs, web origins, and logout URLs
15
13
 
16
- ```env title=".env"
14
+ ```env
17
15
  AUTH0_DOMAIN=your-tenant.auth0.com
18
16
  AUTH0_AUDIENCE=your-api-identifier
19
17
  ```
20
18
 
21
- > **Note:**
22
-
23
- You can find your domain in the Auth0 Dashboard under Applications > Settings. The audience is the identifier of your API configured in Auth0 Dashboard > APIs.
24
-
25
- For detailed setup instructions, refer to the [Auth0 quickstarts](https://auth0.com/docs/quickstarts) for your specific platform.
19
+ > **Note:** You can find your domain in the Auth0 Dashboard under Applications > Settings. The audience is the identifier of your API configured in Auth0 Dashboard > APIs.
20
+ >
21
+ > For detailed setup instructions, refer to the [Auth0 quickstarts](https://auth0.com/docs/quickstarts) for your specific platform.
26
22
 
27
23
  ## Installation
28
24
 
@@ -36,7 +32,7 @@ npm install @mastra/auth-auth0@latest
36
32
 
37
33
  ### Basic usage with environment variables
38
34
 
39
- ```typescript {2,6} title="src/mastra/index.ts"
35
+ ```typescript
40
36
  import { Mastra } from "@mastra/core";
41
37
  import { MastraAuthAuth0 } from "@mastra/auth-auth0";
42
38
 
@@ -49,7 +45,7 @@ export const mastra = new Mastra({
49
45
 
50
46
  ### Custom configuration
51
47
 
52
- ```typescript {2,6-9} title="src/mastra/index.ts"
48
+ ```typescript
53
49
  import { Mastra } from "@mastra/core";
54
50
  import { MastraAuthAuth0 } from "@mastra/auth-auth0";
55
51
 
@@ -76,7 +72,7 @@ By default, `MastraAuthAuth0` allows all authenticated users who have valid Auth
76
72
 
77
73
  To customize user authorization, provide a custom `authorizeUser` function:
78
74
 
79
- ```typescript title="src/mastra/auth.ts"
75
+ ```typescript
80
76
  import { MastraAuthAuth0 } from "@mastra/auth-auth0";
81
77
 
82
78
  const auth0Provider = new MastraAuthAuth0({
@@ -87,9 +83,7 @@ const auth0Provider = new MastraAuthAuth0({
87
83
  });
88
84
  ```
89
85
 
90
- > **Note:**
91
-
92
- Visit [MastraAuthAuth0](https://mastra.ai/reference/auth/auth0) for all available configuration options.
86
+ > **Info:** Visit [MastraAuthAuth0](https://mastra.ai/reference/auth/auth0) for all available configuration options.
93
87
 
94
88
  ## Client-side setup
95
89
 
@@ -103,7 +97,7 @@ First, install and configure the Auth0 React SDK in your application:
103
97
  npm install @auth0/auth0-react
104
98
  ```
105
99
 
106
- ```typescript title="src/auth0-provider.tsx"
100
+ ```typescript
107
101
  import React from 'react';
108
102
  import { Auth0Provider } from '@auth0/auth0-react';
109
103
 
@@ -130,7 +124,7 @@ export default Auth0ProviderWithHistory;
130
124
 
131
125
  Use the Auth0 React SDK to authenticate users and retrieve their access tokens:
132
126
 
133
- ```typescript title="lib/auth.ts"
127
+ ```typescript
134
128
  import { useAuth0 } from "@auth0/auth0-react";
135
129
 
136
130
  export const useAuth0Token = () => {
@@ -145,15 +139,13 @@ export const useAuth0Token = () => {
145
139
  };
146
140
  ```
147
141
 
148
- > **Note:**
149
-
150
- Refer to the [Auth0 React SDK documentation](https://auth0.com/docs/libraries/auth0-react) for more authentication methods and configuration options.
142
+ > **Note:** Refer to the [Auth0 React SDK documentation](https://auth0.com/docs/libraries/auth0-react) for more authentication methods and configuration options.
151
143
 
152
144
  ## Configuring `MastraClient`
153
145
 
154
146
  When `auth` is enabled, all requests made with `MastraClient` must include a valid Auth0 access token in the `Authorization` header:
155
147
 
156
- ```typescript title="lib/mastra/mastra-client.ts"
148
+ ```typescript
157
149
  import { MastraClient } from "@mastra/client-js";
158
150
 
159
151
  export const createMastraClient = (accessToken: string) => {
@@ -166,68 +158,65 @@ export const createMastraClient = (accessToken: string) => {
166
158
  };
167
159
  ```
168
160
 
169
- > **Note:**
170
-
171
- The access token must be prefixed with `Bearer` in the Authorization header.
172
-
173
- Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
161
+ > **Info:** The access token must be prefixed with `Bearer` in the Authorization header.
162
+ >
163
+ > Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
174
164
 
175
165
  ### Making authenticated requests
176
166
 
177
167
  Once `MastraClient` is configured with the Auth0 access token, you can send authenticated requests:
178
168
 
179
- **react:**
180
-
181
- ```tsx title="src/components/mastra-api-test.tsx"
182
- import React, { useState } from 'react';
183
- import { useAuth0 } from '@auth0/auth0-react';
184
- import { MastraClient } from '@mastra/client-js';
185
-
186
- export const MastraApiTest = () => {
187
- const { getAccessTokenSilently } = useAuth0();
188
- const [result, setResult] = useState(null);
189
-
190
- const callMastraApi = async () => {
191
- const token = await getAccessTokenSilently();
192
-
193
- const mastra = new MastraClient({
194
- baseUrl: "http://localhost:4111",
195
- headers: {
196
- Authorization: `Bearer ${token}`
197
- }
198
- });
199
-
200
- const weatherAgent = mastra.getAgent("weatherAgent");
201
- const response = await weatherAgent.generate("What's the weather like in New York");
202
-
203
- setResult(response.text);
204
- };
205
-
206
- return (
207
- <div>
208
- <button onClick={callMastraApi}>
209
- Test Mastra API
210
- </button>
211
-
212
- {result && (
213
- <div className="result">
214
- <h6>Result:</h6>
215
- <pre>{result}</pre>
216
- </div>
217
- )}
169
+ **React**:
170
+
171
+ ```tsx
172
+ import React, { useState } from 'react';
173
+ import { useAuth0 } from '@auth0/auth0-react';
174
+ import { MastraClient } from '@mastra/client-js';
175
+
176
+ export const MastraApiTest = () => {
177
+ const { getAccessTokenSilently } = useAuth0();
178
+ const [result, setResult] = useState(null);
179
+
180
+ const callMastraApi = async () => {
181
+ const token = await getAccessTokenSilently();
182
+
183
+ const mastra = new MastraClient({
184
+ baseUrl: "http://localhost:4111",
185
+ headers: {
186
+ Authorization: `Bearer ${token}`
187
+ }
188
+ });
189
+
190
+ const weatherAgent = mastra.getAgent("weatherAgent");
191
+ const response = await weatherAgent.generate("What's the weather like in New York");
192
+
193
+ setResult(response.text);
194
+ };
195
+
196
+ return (
197
+ <div>
198
+ <button onClick={callMastraApi}>
199
+ Test Mastra API
200
+ </button>
201
+
202
+ {result && (
203
+ <div className="result">
204
+ <h6>Result:</h6>
205
+ <pre>{result}</pre>
218
206
  </div>
219
- );
220
- };
221
- ```
222
-
223
-
224
- **curl:**
225
-
226
- ```bash
227
- curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
228
- -H "Content-Type: application/json" \
229
- -H "Authorization: Bearer <your-auth0-access-token>" \
230
- -d '{
231
- "messages": "Weather in London"
232
- }'
233
- ```
207
+ )}
208
+ </div>
209
+ );
210
+ };
211
+ ```
212
+
213
+ **cURL**:
214
+
215
+ ```bash
216
+ curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
217
+ -H "Content-Type: application/json" \
218
+ -H "Authorization: Bearer <your-auth0-access-token>" \
219
+ -d '{
220
+ "messages": "Weather in London"
221
+ }'
222
+ ```
@@ -1,5 +1,3 @@
1
- > Documentation for the MastraAuthClerk class, which authenticates Mastra applications using Clerk authentication.
2
-
3
1
  # MastraAuthClerk Class
4
2
 
5
3
  The `MastraAuthClerk` class provides authentication for Mastra using Clerk. It verifies incoming requests using Clerk's authentication system and integrates with the Mastra server using the `auth` option.
@@ -8,15 +6,13 @@ The `MastraAuthClerk` class provides authentication for Mastra using Clerk. It v
8
6
 
9
7
  This example uses Clerk authentication. Make sure to add your Clerk credentials to your `.env` file and ensure your Clerk project is properly configured.
10
8
 
11
- ```env title=".env"
9
+ ```env
12
10
  CLERK_PUBLISHABLE_KEY=pk_test_...
13
11
  CLERK_SECRET_KEY=sk_test_...
14
12
  CLERK_JWKS_URI=https://your-clerk-domain.clerk.accounts.dev/.well-known/jwks.json
15
13
  ```
16
14
 
17
- > **Note:**
18
-
19
- You can find these keys in your Clerk Dashboard under "API Keys".
15
+ > **Note:** You can find these keys in your Clerk Dashboard under "API Keys".
20
16
 
21
17
  ## Installation
22
18
 
@@ -28,7 +24,7 @@ npm install @mastra/auth-clerk@latest
28
24
 
29
25
  ## Usage example
30
26
 
31
- ```typescript {2,6-10} title="src/mastra/index.ts"
27
+ ```typescript
32
28
  import { Mastra } from "@mastra/core";
33
29
  import { MastraAuthClerk } from "@mastra/auth-clerk";
34
30
 
@@ -43,11 +39,9 @@ export const mastra = new Mastra({
43
39
  });
44
40
  ```
45
41
 
46
- > **Note:**
47
-
48
- The default `authorizeUser` method allows all authenticated users. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
49
-
50
- Visit [MastraAuthClerk](https://mastra.ai/reference/auth/clerk) for all available configuration options.
42
+ > **Info:** The default `authorizeUser` method allows all authenticated users. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
43
+ >
44
+ > Visit [MastraAuthClerk](https://mastra.ai/reference/auth/clerk) for all available configuration options.
51
45
 
52
46
  ## Client-side setup
53
47
 
@@ -57,7 +51,7 @@ When using Clerk auth, you'll need to retrieve the access token from Clerk on th
57
51
 
58
52
  Use the Clerk React hooks to authenticate users and retrieve their access token:
59
53
 
60
- ```typescript title="lib/auth.ts"
54
+ ```typescript
61
55
  import { useAuth } from "@clerk/nextjs";
62
56
 
63
57
  export const useClerkAuth = () => {
@@ -72,15 +66,13 @@ export const useClerkAuth = () => {
72
66
  };
73
67
  ```
74
68
 
75
- > **Note:**
76
-
77
- Refer to the [Clerk documentation](https://clerk.com/docs) for more information.
69
+ > **Info:** Refer to the [Clerk documentation](https://clerk.com/docs) for more information.
78
70
 
79
71
  ## Configuring `MastraClient`
80
72
 
81
73
  When `auth` is enabled, all requests made with `MastraClient` must include a valid Clerk access token in the `Authorization` header:
82
74
 
83
- ```typescript {6} title="lib/mastra/mastra-client.ts"
75
+ ```typescript
84
76
  import { MastraClient } from "@mastra/client-js";
85
77
 
86
78
  export const mastraClient = new MastraClient({
@@ -91,53 +83,50 @@ export const mastraClient = new MastraClient({
91
83
  });
92
84
  ```
93
85
 
94
- > **Note:**
95
-
96
- The access token must be prefixed with `Bearer` in the Authorization header.
97
-
98
- Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
86
+ > **Info:** The access token must be prefixed with `Bearer` in the Authorization header.
87
+ >
88
+ > Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
99
89
 
100
90
  ### Making authenticated requests
101
91
 
102
92
  Once `MastraClient` is configured with the Clerk access token, you can send authenticated requests:
103
93
 
104
- **react:**
94
+ **React**:
105
95
 
106
- ```tsx title="src/components/test-agent.tsx"
107
- "use client";
96
+ ```tsx
97
+ "use client";
108
98
 
109
- import { useAuth } from "@clerk/nextjs";
110
- import { MastraClient } from "@mastra/client-js";
99
+ import { useAuth } from "@clerk/nextjs";
100
+ import { MastraClient } from "@mastra/client-js";
111
101
 
112
- export const TestAgent = () => {
113
- const { getToken } = useAuth();
102
+ export const TestAgent = () => {
103
+ const { getToken } = useAuth();
114
104
 
115
- async function handleClick() {
116
- const token = await getToken();
105
+ async function handleClick() {
106
+ const token = await getToken();
117
107
 
118
- const client = new MastraClient({
119
- baseUrl: "http://localhost:4111",
120
- headers: token ? { Authorization: `Bearer ${token}` } : undefined,
121
- });
108
+ const client = new MastraClient({
109
+ baseUrl: "http://localhost:4111",
110
+ headers: token ? { Authorization: `Bearer ${token}` } : undefined,
111
+ });
122
112
 
123
- const weatherAgent = client.getAgent("weatherAgent");
124
- const response = await weatherAgent.generate("What's the weather like in New York");
113
+ const weatherAgent = client.getAgent("weatherAgent");
114
+ const response = await weatherAgent.generate("What's the weather like in New York");
125
115
 
126
- console.log({ response });
127
- }
116
+ console.log({ response });
117
+ }
128
118
 
129
- return <button onClick={handleClick}>Test Agent</button>;
130
- };
131
- ```
119
+ return <button onClick={handleClick}>Test Agent</button>;
120
+ };
121
+ ```
132
122
 
133
-
134
- **curl:**
123
+ **cURL**:
135
124
 
136
- ```bash
137
- curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
138
- -H "Content-Type: application/json" \
139
- -H "Authorization: Bearer <your-clerk-access-token>" \
140
- -d '{
141
- "messages": "Weather in London"
142
- }'
143
- ```
125
+ ```bash
126
+ curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
127
+ -H "Content-Type: application/json" \
128
+ -H "Authorization: Bearer <your-clerk-access-token>" \
129
+ -d '{
130
+ "messages": "Weather in London"
131
+ }'
132
+ ```