@mastra/mcp-docs-server 0.13.23 → 0.13.24-alpha.2
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 +8 -8
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +19 -0
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +18 -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 +35 -35
- 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 +46 -46
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +38 -38
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
- 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 +30 -30
- 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 +10 -10
- 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 +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +51 -51
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Frag.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +10 -10
- 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 +14 -14
- package/.docs/organized/changelogs/mastra.md +46 -46
- 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/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/workflows/step.mdx +1 -1
- package/CHANGELOG.md +22 -0
- package/package.json +4 -4
|
@@ -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
|
+
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 0.13.24-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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)]:
|
|
8
|
+
- @mastra/core@0.18.0-alpha.2
|
|
9
|
+
- @mastra/mcp@0.13.1-alpha.0
|
|
10
|
+
|
|
11
|
+
## 0.13.24-alpha.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb)]:
|
|
16
|
+
- @mastra/core@0.17.2-alpha.1
|
|
17
|
+
|
|
18
|
+
## 0.13.24-alpha.0
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad)]:
|
|
23
|
+
- @mastra/core@0.17.2-alpha.0
|
|
24
|
+
|
|
3
25
|
## 0.13.23
|
|
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.
|
|
3
|
+
"version": "0.13.24-alpha.2",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
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.2",
|
|
37
|
+
"@mastra/mcp": "^0.13.1-alpha.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@hono/node-server": "^1.19.3",
|
|
@@ -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.2"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://mastra.ai",
|
|
56
56
|
"repository": {
|