@mastra/mcp-docs-server 1.1.40-alpha.16 → 1.1.40-alpha.17
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/docs/agents/signals.md +21 -0
- package/.docs/docs/workspace/filesystem.md +2 -0
- package/.docs/reference/client-js/agents.md +5 -2
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/workspace/files-sdk-filesystem.md +187 -0
- package/CHANGELOG.md +8 -0
- package/package.json +6 -6
|
@@ -204,9 +204,30 @@ await subscription.processDataStream({
|
|
|
204
204
|
onChunk: chunk => {
|
|
205
205
|
console.log(chunk)
|
|
206
206
|
},
|
|
207
|
+
reconnect: true,
|
|
207
208
|
})
|
|
208
209
|
```
|
|
209
210
|
|
|
211
|
+
Use `reconnect: true` for long-lived subscriptions. The client resubscribes when the stream closes or a reconnect request fails, such as after a proxy idle timeout or a dropped network connection.
|
|
212
|
+
|
|
213
|
+
## Keep custom SSE subscriptions alive
|
|
214
|
+
|
|
215
|
+
If you expose your own Server-Sent Events (SSE) endpoint for thread subscriptions, send periodic heartbeat frames while the stream is idle. This keeps browsers, proxies, and load balancers from closing the connection before the next signal or model chunk arrives.
|
|
216
|
+
|
|
217
|
+
The following example sends an SSE comment every 25 seconds:
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
const heartbeat = setInterval(() => {
|
|
221
|
+
controller.enqueue(encoder.encode(': keep-alive\n\n'))
|
|
222
|
+
}, 25_000)
|
|
223
|
+
|
|
224
|
+
request.signal.addEventListener('abort', () => {
|
|
225
|
+
clearInterval(heartbeat)
|
|
226
|
+
})
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Use heartbeats together with client-side reconnect logic. Heartbeats reduce idle disconnects, while reconnects recover when the network or runtime still closes the stream.
|
|
230
|
+
|
|
210
231
|
## Related
|
|
211
232
|
|
|
212
233
|
- [`Agent.sendSignal()`](https://mastra.ai/reference/agents/agent)
|
|
@@ -23,6 +23,7 @@ Available providers:
|
|
|
23
23
|
- [`GCSFilesystem`](https://mastra.ai/reference/workspace/gcs-filesystem): Stores files in Google Cloud Storage
|
|
24
24
|
- [`GoogleDriveFilesystem`](https://mastra.ai/reference/workspace/google-drive-filesystem): Stores files inside a Google Drive folder
|
|
25
25
|
- [`AzureBlobFilesystem`](https://mastra.ai/reference/workspace/azure-blob-filesystem): Stores files in Azure Blob Storage
|
|
26
|
+
- [`FilesSDKFilesystem`](https://mastra.ai/reference/workspace/files-sdk-filesystem): Stores files in any [FilesSDK](https://files-sdk.dev) adapter (S3, R2, GCS, Azure Blob, Vercel Blob, local filesystem, and more) — useful when you want one provider that can target multiple backends
|
|
26
27
|
- [`AgentFSFilesystem`](https://mastra.ai/reference/workspace/agentfs-filesystem): Stores files in a Turso/SQLite database via AgentFS
|
|
27
28
|
|
|
28
29
|
> **Tip:** `LocalFilesystem` is the simplest way to get started as it requires no external services. For cloud storage, use `S3Filesystem`, `GCSFilesystem`, or `AzureBlobFilesystem`. For database-backed storage without external services, use `AgentFSFilesystem`.
|
|
@@ -223,6 +224,7 @@ When you configure a filesystem on a workspace, agents receive tools for reading
|
|
|
223
224
|
- [GCSFilesystem reference](https://mastra.ai/reference/workspace/gcs-filesystem)
|
|
224
225
|
- [GoogleDriveFilesystem reference](https://mastra.ai/reference/workspace/google-drive-filesystem)
|
|
225
226
|
- [AzureBlobFilesystem reference](https://mastra.ai/reference/workspace/azure-blob-filesystem)
|
|
227
|
+
- [FilesSDKFilesystem reference](https://mastra.ai/reference/workspace/files-sdk-filesystem)
|
|
226
228
|
- [AgentFSFilesystem reference](https://mastra.ai/reference/workspace/agentfs-filesystem)
|
|
227
229
|
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|
|
228
230
|
- [Sandbox](https://mastra.ai/docs/workspace/sandbox)
|
|
@@ -228,18 +228,21 @@ const subscription = await agent.subscribeToThread({
|
|
|
228
228
|
})
|
|
229
229
|
|
|
230
230
|
await subscription.processDataStream({
|
|
231
|
-
onChunk:
|
|
231
|
+
onChunk: chunk => {
|
|
232
232
|
console.log(chunk)
|
|
233
233
|
},
|
|
234
|
+
reconnect: true,
|
|
234
235
|
})
|
|
235
236
|
```
|
|
236
237
|
|
|
237
|
-
`subscribeToThread()` returns the underlying `Response` plus a `processDataStream()` helper. The helper reads the subscription stream until the connection closes or the request is aborted.
|
|
238
|
+
`subscribeToThread()` returns the underlying `Response` plus a `processDataStream()` helper. The helper reads the subscription stream until the connection closes or the request is aborted. Pass `reconnect: true` to resubscribe when the transport closes or a reconnect request fails, such as after a proxy idle timeout.
|
|
238
239
|
|
|
239
240
|
**resourceId** (`string`): Resource ID for the memory thread.
|
|
240
241
|
|
|
241
242
|
**threadId** (`string`): Thread ID to subscribe to.
|
|
242
243
|
|
|
244
|
+
**processDataStream().reconnect** (`boolean | { maxRetries?: number; delayMs?: number }`): Reconnects the subscription stream after it closes or a reconnect request fails. \`true\` retries indefinitely with a one-second delay.
|
|
245
|
+
|
|
243
246
|
### `streamUntilIdle()`
|
|
244
247
|
|
|
245
248
|
Stream a response and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. The server re-enters the agentic loop on each task completion so the LLM can react to results in the same call. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `stream()`.
|
package/.docs/reference/index.md
CHANGED
|
@@ -309,6 +309,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
309
309
|
- [DaytonaSandbox](https://mastra.ai/reference/workspace/daytona-sandbox)
|
|
310
310
|
- [DockerSandbox](https://mastra.ai/reference/workspace/docker-sandbox)
|
|
311
311
|
- [E2BSandbox](https://mastra.ai/reference/workspace/e2b-sandbox)
|
|
312
|
+
- [FilesSDKFilesystem](https://mastra.ai/reference/workspace/files-sdk-filesystem)
|
|
312
313
|
- [GCSFilesystem](https://mastra.ai/reference/workspace/gcs-filesystem)
|
|
313
314
|
- [GoogleDriveFilesystem](https://mastra.ai/reference/workspace/google-drive-filesystem)
|
|
314
315
|
- [LocalFilesystem](https://mastra.ai/reference/workspace/local-filesystem)
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# FilesSDKFilesystem
|
|
2
|
+
|
|
3
|
+
Stores files in any storage backend supported by [FilesSDK](https://files-sdk.dev) — a unified abstraction over S3, Cloudflare R2, Google Cloud Storage, Azure Blob, Vercel Blob, MinIO, the local filesystem, and more.
|
|
4
|
+
|
|
5
|
+
> **Info:** For interface details, see [WorkspaceFilesystem Interface](https://mastra.ai/reference/workspace/filesystem).
|
|
6
|
+
|
|
7
|
+
Use `FilesSDKFilesystem` when you want a single adapter that can target multiple storage backends with the same code. Swap the underlying driver without changing the workspace setup. If you only target one backend and want first-class options for that backend, prefer the dedicated provider (for example [`S3Filesystem`](https://mastra.ai/reference/workspace/s3-filesystem) or [`GCSFilesystem`](https://mastra.ai/reference/workspace/gcs-filesystem)).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
**npm**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @mastra/files-sdk files-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**pnpm**:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @mastra/files-sdk files-sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Yarn**:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add @mastra/files-sdk files-sdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Bun**:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun add @mastra/files-sdk files-sdk
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`files-sdk` is a peer dependency you configure with the adapter you want to use.
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Create a `Files` instance from FilesSDK with the adapter of your choice, then pass it to `FilesSDKFilesystem`:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { Agent } from '@mastra/core/agent'
|
|
43
|
+
import { Workspace } from '@mastra/core/workspace'
|
|
44
|
+
import { FilesSDKFilesystem } from '@mastra/files-sdk'
|
|
45
|
+
import { Files } from 'files-sdk'
|
|
46
|
+
import { s3 } from 'files-sdk/s3'
|
|
47
|
+
|
|
48
|
+
const files = new Files({
|
|
49
|
+
adapter: s3({
|
|
50
|
+
bucket: 'my-bucket',
|
|
51
|
+
region: 'us-east-1',
|
|
52
|
+
}),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const workspace = new Workspace({
|
|
56
|
+
filesystem: new FilesSDKFilesystem({ files }),
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const agent = new Agent({
|
|
60
|
+
name: 'file-agent',
|
|
61
|
+
model: 'anthropic/claude-opus-4-6',
|
|
62
|
+
workspace,
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Swapping adapters
|
|
67
|
+
|
|
68
|
+
The same `FilesSDKFilesystem` works with any FilesSDK adapter. Replace the driver factory to switch backends:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { Files } from 'files-sdk'
|
|
72
|
+
import { r2 } from 'files-sdk/r2'
|
|
73
|
+
import { gcs } from 'files-sdk/gcs'
|
|
74
|
+
import { azure } from 'files-sdk/azure'
|
|
75
|
+
import { fs } from 'files-sdk/fs'
|
|
76
|
+
|
|
77
|
+
// Cloudflare R2
|
|
78
|
+
const r2Files = new Files({ adapter: r2({ accountId, bucket, accessKeyId, secretAccessKey }) })
|
|
79
|
+
|
|
80
|
+
// Google Cloud Storage
|
|
81
|
+
const gcsFiles = new Files({ adapter: gcs({ bucket, projectId }) })
|
|
82
|
+
|
|
83
|
+
// Azure Blob
|
|
84
|
+
const azureFiles = new Files({ adapter: azure({ container, connectionString }) })
|
|
85
|
+
|
|
86
|
+
// Local filesystem (useful for tests and development)
|
|
87
|
+
const localFiles = new Files({ adapter: fs({ root: './workspace' }) })
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
See the [FilesSDK documentation](https://files-sdk.dev) for the full adapter catalog and configuration options.
|
|
91
|
+
|
|
92
|
+
### Read-only mounts
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
const filesystem = new FilesSDKFilesystem({
|
|
96
|
+
files,
|
|
97
|
+
readOnly: true,
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
All write operations (`writeFile`, `appendFile`, `deleteFile`, `copyFile`, `moveFile`, `mkdir`, `rmdir`) throw `WorkspaceReadOnlyError` while reads succeed.
|
|
102
|
+
|
|
103
|
+
## Constructor parameters
|
|
104
|
+
|
|
105
|
+
**files** (`Files`): A pre-configured FilesSDK \`Files\` instance bound to the adapter and credentials you want to use.
|
|
106
|
+
|
|
107
|
+
**id** (`string`): Unique identifier for this filesystem instance. (Default: `Auto-generated`)
|
|
108
|
+
|
|
109
|
+
**displayName** (`string`): Human-friendly display name for the UI.
|
|
110
|
+
|
|
111
|
+
**icon** (`FilesystemIcon`): Icon identifier for the UI.
|
|
112
|
+
|
|
113
|
+
**description** (`string`): Short description of this filesystem for the UI.
|
|
114
|
+
|
|
115
|
+
**readOnly** (`boolean`): When true, all write operations are blocked. (Default: `false`)
|
|
116
|
+
|
|
117
|
+
## Properties
|
|
118
|
+
|
|
119
|
+
**id** (`string`): Filesystem instance identifier.
|
|
120
|
+
|
|
121
|
+
**name** (`string`): Provider name ('FilesSDKFilesystem').
|
|
122
|
+
|
|
123
|
+
**provider** (`string`): Provider identifier ('files-sdk').
|
|
124
|
+
|
|
125
|
+
**readOnly** (`boolean | undefined`): Whether the filesystem is in read-only mode.
|
|
126
|
+
|
|
127
|
+
## Methods
|
|
128
|
+
|
|
129
|
+
`FilesSDKFilesystem` implements the [WorkspaceFilesystem interface](https://mastra.ai/reference/workspace/filesystem), providing all standard filesystem methods:
|
|
130
|
+
|
|
131
|
+
- `readFile(path, options?)` - Read file contents
|
|
132
|
+
- `writeFile(path, content, options?)` - Write content to a file
|
|
133
|
+
- `appendFile(path, content)` - Append content to a file
|
|
134
|
+
- `deleteFile(path, options?)` - Delete a file
|
|
135
|
+
- `copyFile(src, dest, options?)` - Copy a file
|
|
136
|
+
- `moveFile(src, dest, options?)` - Move or rename a file
|
|
137
|
+
- `mkdir(path, options?)` - Create a directory (no-op for object stores)
|
|
138
|
+
- `rmdir(path, options?)` - Remove a directory
|
|
139
|
+
- `readdir(path, options?)` - List directory contents
|
|
140
|
+
- `exists(path)` - Check if a path exists
|
|
141
|
+
- `stat(path)` - Get file or directory metadata
|
|
142
|
+
|
|
143
|
+
### `init()`
|
|
144
|
+
|
|
145
|
+
Initialize the filesystem. Verifies that the configured adapter can list keys with the supplied credentials.
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
await filesystem.init()
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### `getInfo()`
|
|
152
|
+
|
|
153
|
+
Returns metadata about this filesystem instance.
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const info = filesystem.getInfo()
|
|
157
|
+
// { id: '...', name: 'FilesSDKFilesystem', provider: 'files-sdk', status: 'ready' }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `files`
|
|
161
|
+
|
|
162
|
+
The underlying FilesSDK `Files` instance is exposed as a public property if you need to call adapter-specific APIs directly.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
const url = await filesystem.files.url('reports/q3.pdf')
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Object-store semantics
|
|
169
|
+
|
|
170
|
+
`FilesSDKFilesystem` treats the configured backend as an object store, even when the underlying adapter is hierarchical (such as `fs`). This keeps behavior consistent across adapters:
|
|
171
|
+
|
|
172
|
+
- **`mkdir`** is a no-op. Directories exist implicitly when keys with that prefix exist.
|
|
173
|
+
- **`exists`** returns `true` only when an exact key is present as a file, or when the path is a prefix that contains at least one child key. Empty leftover directories on hierarchical adapters do not count.
|
|
174
|
+
- **`deleteFile`** throws `FileNotFoundError` when the key does not exist, unless `{ force: true }` is passed.
|
|
175
|
+
- **`deleteFile`** on a directory delegates to `rmdir({ recursive: true })`, matching the [`S3Filesystem`](https://mastra.ai/reference/workspace/s3-filesystem) and [`GCSFilesystem`](https://mastra.ai/reference/workspace/gcs-filesystem) behavior.
|
|
176
|
+
- **`moveFile`** is implemented as `copyFile` followed by `deleteFile`. It is **not atomic** — if the source delete fails after a successful copy, the destination remains and the source is not removed.
|
|
177
|
+
- **`appendFile`** is a read-modify-write operation. Concurrent appends to the same key may overwrite each other; this is inherent to object storage and not specific to FilesSDK.
|
|
178
|
+
- **`readdir({ recursive: true })`** emits intermediate directory entries (for example, `a/b` is emitted alongside `a/b/c.txt`).
|
|
179
|
+
|
|
180
|
+
## Related
|
|
181
|
+
|
|
182
|
+
- [WorkspaceFilesystem interface](https://mastra.ai/reference/workspace/filesystem)
|
|
183
|
+
- [S3Filesystem reference](https://mastra.ai/reference/workspace/s3-filesystem)
|
|
184
|
+
- [GCSFilesystem reference](https://mastra.ai/reference/workspace/gcs-filesystem)
|
|
185
|
+
- [AzureBlobFilesystem reference](https://mastra.ai/reference/workspace/azure-blob-filesystem)
|
|
186
|
+
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|
|
187
|
+
- [FilesSDK documentation](https://files-sdk.dev)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.40-alpha.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`9d2c663`](https://github.com/mastra-ai/mastra/commit/9d2c663b88f5b12bc3fea1c97f40b4eeb3665df1), [`c35b962`](https://github.com/mastra-ai/mastra/commit/c35b9625c7e854fcfdeee226a3338a750d0ff211), [`4084113`](https://github.com/mastra-ai/mastra/commit/408411370fc48a822e8b616b3b63f9409774e0e9)]:
|
|
8
|
+
- @mastra/mcp@1.8.1-alpha.0
|
|
9
|
+
- @mastra/core@1.37.0-alpha.8
|
|
10
|
+
|
|
3
11
|
## 1.1.40-alpha.15
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.40-alpha.
|
|
3
|
+
"version": "1.1.40-alpha.17",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
29
29
|
"jsdom": "^26.1.0",
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
|
-
"zod": "^4.3
|
|
32
|
-
"@mastra/
|
|
33
|
-
"@mastra/
|
|
31
|
+
"zod": "^4.4.3",
|
|
32
|
+
"@mastra/core": "1.37.0-alpha.8",
|
|
33
|
+
"@mastra/mcp": "^1.8.1-alpha.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@hono/node-server": "^1.19.11",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"tsx": "^4.21.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
48
|
"vitest": "4.1.5",
|
|
49
|
+
"@mastra/core": "1.37.0-alpha.8",
|
|
49
50
|
"@internal/lint": "0.0.97",
|
|
50
|
-
"@internal/types-builder": "0.0.72"
|
|
51
|
-
"@mastra/core": "1.37.0-alpha.7"
|
|
51
|
+
"@internal/types-builder": "0.0.72"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|