@mastra/mcp-docs-server 0.13.24-alpha.0 → 0.13.24-alpha.3
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%2Fagent-builder.md +18 -0
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +44 -44
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Frag.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +18 -18
- package/.docs/organized/changelogs/mastra.md +42 -42
- package/.docs/raw/agents/dynamic-agents.mdx +19 -0
- package/.docs/raw/agents/overview.mdx +46 -0
- package/.docs/raw/auth/auth0.mdx +235 -0
- package/.docs/raw/auth/index.mdx +2 -7
- package/.docs/raw/auth/workos.mdx +198 -0
- package/.docs/raw/getting-started/installation.mdx +1 -1
- package/.docs/raw/memory/conversation-history.mdx +23 -0
- package/.docs/raw/memory/overview.mdx +35 -150
- package/.docs/raw/memory/semantic-recall.mdx +36 -0
- package/.docs/raw/memory/threads-and-resources.mdx +94 -0
- package/.docs/raw/reference/agents/agent.mdx +82 -5
- package/.docs/raw/reference/agents/getInstructions.mdx +2 -2
- package/.docs/raw/reference/auth/auth0.mdx +117 -0
- package/.docs/raw/reference/auth/workos.mdx +128 -0
- package/.docs/raw/reference/memory/Memory.mdx +41 -0
- package/.docs/raw/reference/rag/pg.mdx +28 -1
- package/.docs/raw/reference/workflows/step.mdx +1 -1
- package/CHANGELOG.md +22 -0
- package/package.json +5 -5
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MastraAuthWorkos Class"
|
|
3
|
+
description: "API reference for the MastraAuthWorkos class, which authenticates Mastra applications using WorkOS authentication."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MastraAuthWorkos Class
|
|
7
|
+
|
|
8
|
+
The `MastraAuthWorkos` class provides authentication for Mastra using WorkOS. It verifies incoming requests using WorkOS access tokens and integrates with the Mastra server using the `experimental_auth` option.
|
|
9
|
+
|
|
10
|
+
## Usage example
|
|
11
|
+
|
|
12
|
+
```typescript filename="src/mastra/index.ts" showLineNumbers copy
|
|
13
|
+
import { Mastra } from "@mastra/core/mastra";
|
|
14
|
+
import { MastraAuthWorkos } from '@mastra/auth-workos';
|
|
15
|
+
|
|
16
|
+
export const mastra = new Mastra({
|
|
17
|
+
// ..
|
|
18
|
+
server: {
|
|
19
|
+
experimental_auth: new MastraAuthWorkos({
|
|
20
|
+
apiKey: process.env.WORKOS_API_KEY,
|
|
21
|
+
clientId: process.env.WORKOS_CLIENT_ID
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
> **Note:** You can omit the constructor parameters if you have the appropriately named environment variables (`WORKOS_API_KEY` and `WORKOS_CLIENT_ID`) set. In that case, simply use `new MastraAuthWorkos()` without any arguments.
|
|
28
|
+
|
|
29
|
+
## Constructor parameters
|
|
30
|
+
|
|
31
|
+
<PropertiesTable
|
|
32
|
+
content={[
|
|
33
|
+
{
|
|
34
|
+
name: "apiKey",
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Your WorkOS API key. This is used to authenticate with the WorkOS API for user verification and organization management.",
|
|
37
|
+
isOptional: true,
|
|
38
|
+
defaultValue: "process.env.WORKOS_API_KEY"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "clientId",
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Your WorkOS Client ID. This identifies your application when exchanging authorization codes for access tokens.",
|
|
44
|
+
isOptional: true,
|
|
45
|
+
defaultValue: "process.env.WORKOS_CLIENT_ID"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "name",
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "Custom name for the auth provider instance.",
|
|
51
|
+
isOptional: true,
|
|
52
|
+
defaultValue: '"workos"'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "authorizeUser",
|
|
56
|
+
type: "(user: WorkosUser) => Promise<boolean> | boolean",
|
|
57
|
+
description: "Custom authorization function to determine if a user should be granted access. Called after token verification. By default, checks if the user has an 'admin' role in any organization membership.",
|
|
58
|
+
isOptional: true,
|
|
59
|
+
},
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
## Environment Variables
|
|
64
|
+
|
|
65
|
+
The following environment variables are automatically used when constructor options are not provided:
|
|
66
|
+
|
|
67
|
+
<PropertiesTable
|
|
68
|
+
content={[
|
|
69
|
+
{
|
|
70
|
+
name: "WORKOS_API_KEY",
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "Your WorkOS API key. Can be found in your WorkOS Dashboard under API Keys.",
|
|
73
|
+
isOptional: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "WORKOS_CLIENT_ID",
|
|
77
|
+
type: "string",
|
|
78
|
+
description: "Your WorkOS Client ID. Can be found in your WorkOS Dashboard under Applications.",
|
|
79
|
+
isOptional: true,
|
|
80
|
+
},
|
|
81
|
+
]}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
## Default Authorization Behavior
|
|
85
|
+
|
|
86
|
+
By default, `MastraAuthWorkos` implements role-based authorization that checks for admin access:
|
|
87
|
+
|
|
88
|
+
1. **Token Verification**: The access token is verified with WorkOS to ensure it's valid and not expired
|
|
89
|
+
2. **User Retrieval**: User information is extracted from the verified token
|
|
90
|
+
3. **Organization Membership Check**: The system queries WorkOS for all organization memberships associated with the user's ID
|
|
91
|
+
4. **Role Extraction**: All roles from the user's organization memberships are collected
|
|
92
|
+
5. **Admin Check**: The system checks if any role has the slug 'admin'
|
|
93
|
+
6. **Authorization Decision**: Access is granted only if the user has an admin role in at least one organization
|
|
94
|
+
|
|
95
|
+
This means that by default, only users with admin privileges in at least one organization will be authorized to access your Mastra endpoints.
|
|
96
|
+
|
|
97
|
+
To implement custom authorization logic (e.g., allow all authenticated users, check for specific roles, or implement custom business logic), provide a custom `authorizeUser` function.
|
|
98
|
+
|
|
99
|
+
## WorkOS User Type
|
|
100
|
+
|
|
101
|
+
The `WorkosUser` type used in the `authorizeUser` function corresponds to the JWT token payload returned by WorkOS. WorkOS allows administrators to set up custom JWT templates, so the exact structure may vary based on your configuration. Here's an example of what the user object might look like:
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
{
|
|
105
|
+
'urn:myapp:full_name': 'John Doe',
|
|
106
|
+
'urn:myapp:email': 'john.doe@example.com',
|
|
107
|
+
'urn:myapp:organization_tier': 'bronze',
|
|
108
|
+
'urn:myapp:user_language': 'en',
|
|
109
|
+
'urn:myapp:organization_domain': 'example.com',
|
|
110
|
+
iss: 'https://api.workos.com/user_management/client_01ABC123DEF456GHI789JKL012',
|
|
111
|
+
sub: 'user_01XYZ789ABC123DEF456GHI012',
|
|
112
|
+
sid: 'session_01PQR456STU789VWX012YZA345',
|
|
113
|
+
jti: '01MNO678PQR901STU234VWX567',
|
|
114
|
+
org_id: 'org_01DEF234GHI567JKL890MNO123',
|
|
115
|
+
role: 'member',
|
|
116
|
+
roles: [ 'member' ],
|
|
117
|
+
permissions: [],
|
|
118
|
+
exp: 1758290589,
|
|
119
|
+
iat: 1758290289
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The properties with `urn:myapp:` prefixes are custom claims configured in your WorkOS JWT template. Standard JWT claims include `sub` (user ID), `iss` (issuer), `exp` (expiration), and WorkOS-specific claims like `org_id`, `role`, and `roles`.
|
|
124
|
+
|
|
125
|
+
## Related
|
|
126
|
+
|
|
127
|
+
[MastraAuthWorkos Class](/docs/auth/workos)
|
|
128
|
+
|
|
@@ -152,6 +152,47 @@ export const agent = new Agent({
|
|
|
152
152
|
});
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
+
## PostgreSQL with index configuration
|
|
156
|
+
|
|
157
|
+
```typescript filename="src/mastra/agents/pg-agent.ts" showLineNumbers copy
|
|
158
|
+
import { Memory } from "@mastra/memory";
|
|
159
|
+
import { Agent } from "@mastra/core/agent";
|
|
160
|
+
import { openai } from "@ai-sdk/openai";
|
|
161
|
+
import { PgStore, PgVector } from "@mastra/pg";
|
|
162
|
+
|
|
163
|
+
export const agent = new Agent({
|
|
164
|
+
name: "pg-agent",
|
|
165
|
+
instructions: "You are an agent with optimized PostgreSQL memory.",
|
|
166
|
+
model: openai("gpt-4o"),
|
|
167
|
+
memory: new Memory({
|
|
168
|
+
storage: new PgStore({
|
|
169
|
+
connectionString: process.env.DATABASE_URL
|
|
170
|
+
}),
|
|
171
|
+
vector: new PgVector({
|
|
172
|
+
connectionString: process.env.DATABASE_URL
|
|
173
|
+
}),
|
|
174
|
+
embedder: openai.embedding("text-embedding-3-small"),
|
|
175
|
+
options: {
|
|
176
|
+
lastMessages: 20,
|
|
177
|
+
semanticRecall: {
|
|
178
|
+
topK: 5,
|
|
179
|
+
messageRange: 3,
|
|
180
|
+
scope: 'resource',
|
|
181
|
+
indexConfig: {
|
|
182
|
+
type: 'hnsw', // Use HNSW for better performance
|
|
183
|
+
metric: 'dotproduct', // Optimal for OpenAI embeddings
|
|
184
|
+
m: 16, // Number of bi-directional links
|
|
185
|
+
efConstruction: 64 // Construction-time candidate list size
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
workingMemory: {
|
|
189
|
+
enabled: true
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
155
196
|
### Related
|
|
156
197
|
|
|
157
198
|
- [Getting Started with Memory](/docs/memory/overview.mdx)
|
|
@@ -498,11 +498,38 @@ try {
|
|
|
498
498
|
}
|
|
499
499
|
```
|
|
500
500
|
|
|
501
|
+
## Index Configuration Guide
|
|
502
|
+
|
|
503
|
+
### Performance Optimization
|
|
504
|
+
|
|
505
|
+
#### IVFFlat Tuning
|
|
506
|
+
- **lists parameter**: Set to `sqrt(n) * 2` where n is the number of vectors
|
|
507
|
+
- More lists = better accuracy but slower build time
|
|
508
|
+
- Fewer lists = faster build but potentially lower accuracy
|
|
509
|
+
|
|
510
|
+
#### HNSW Tuning
|
|
511
|
+
- **m parameter**:
|
|
512
|
+
- 8-16: Moderate accuracy, lower memory
|
|
513
|
+
- 16-32: High accuracy, moderate memory
|
|
514
|
+
- 32-64: Very high accuracy, high memory
|
|
515
|
+
- **efConstruction**:
|
|
516
|
+
- 32-64: Fast build, good quality
|
|
517
|
+
- 64-128: Slower build, better quality
|
|
518
|
+
- 128-256: Slowest build, best quality
|
|
519
|
+
|
|
520
|
+
### Index Recreation Behavior
|
|
521
|
+
|
|
522
|
+
The system automatically detects configuration changes and only rebuilds indexes when necessary:
|
|
523
|
+
- Same configuration: Index is kept (no recreation)
|
|
524
|
+
- Changed configuration: Index is dropped and rebuilt
|
|
525
|
+
- This prevents the performance issues from unnecessary index recreations
|
|
526
|
+
|
|
501
527
|
## Best Practices
|
|
502
528
|
|
|
503
529
|
- Regularly evaluate your index configuration to ensure optimal performance.
|
|
504
530
|
- Adjust parameters like `lists` and `m` based on dataset size and query requirements.
|
|
505
|
-
-
|
|
531
|
+
- **Monitor index performance** using `describeIndex()` to track usage
|
|
532
|
+
- Rebuild indexes periodically to maintain efficiency, especially after significant data changes
|
|
506
533
|
|
|
507
534
|
## Direct Pool Access
|
|
508
535
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 0.13.24-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a)]:
|
|
8
|
+
- @mastra/core@0.18.0-alpha.3
|
|
9
|
+
|
|
10
|
+
## 0.13.24-alpha.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`5b1ee71`](https://github.com/mastra-ai/mastra/commit/5b1ee71dc3ac92383226dc1e375642ca5f9b4224)]:
|
|
15
|
+
- @mastra/core@0.18.0-alpha.2
|
|
16
|
+
- @mastra/mcp@0.13.1-alpha.0
|
|
17
|
+
|
|
18
|
+
## 0.13.24-alpha.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb)]:
|
|
23
|
+
- @mastra/core@0.17.2-alpha.1
|
|
24
|
+
|
|
3
25
|
## 0.13.24-alpha.0
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.24-alpha.
|
|
3
|
+
"version": "0.13.24-alpha.3",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"uuid": "^11.1.0",
|
|
34
34
|
"zod": "^3.25.76",
|
|
35
35
|
"zod-to-json-schema": "^3.24.6",
|
|
36
|
-
"@mastra/core": "0.
|
|
37
|
-
"@mastra/mcp": "^0.13.0"
|
|
36
|
+
"@mastra/core": "0.18.0-alpha.3",
|
|
37
|
+
"@mastra/mcp": "^0.13.1-alpha.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@hono/node-server": "^1.19.
|
|
40
|
+
"@hono/node-server": "^1.19.4",
|
|
41
41
|
"@types/jsdom": "^21.1.7",
|
|
42
42
|
"@types/node": "^20.19.0",
|
|
43
43
|
"@types/turndown": "^5.0.5",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
51
|
"vitest": "^3.2.4",
|
|
52
52
|
"@internal/lint": "0.0.41",
|
|
53
|
-
"@mastra/core": "0.
|
|
53
|
+
"@mastra/core": "0.18.0-alpha.3"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://mastra.ai",
|
|
56
56
|
"repository": {
|