@mastra/mcp-docs-server 1.1.35-alpha.3 → 1.1.35-alpha.5
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/memory/observational-memory.md +2 -1
- package/.docs/docs/memory/overview.md +2 -1
- package/.docs/models/providers/opencode-go.md +1 -1
- package/.docs/reference/harness/harness-class.md +2 -0
- package/.docs/reference/tools/mcp-client.md +47 -0
- package/CHANGELOG.md +7 -0
- package/package.json +4 -4
|
@@ -458,4 +458,5 @@ In practical terms, OM replaces both working memory and message history, and has
|
|
|
458
458
|
- [Observational Memory Reference](https://mastra.ai/reference/memory/observational-memory)
|
|
459
459
|
- [Memory Overview](https://mastra.ai/docs/memory/overview)
|
|
460
460
|
- [Message History](https://mastra.ai/docs/memory/message-history)
|
|
461
|
-
- [Memory Processors](https://mastra.ai/docs/memory/memory-processors)
|
|
461
|
+
- [Memory Processors](https://mastra.ai/docs/memory/memory-processors)
|
|
462
|
+
- [Mastra Code](https://code.mastra.ai/): A coding agent using Observational Memory
|
|
@@ -237,4 +237,5 @@ export const memoryAgent = new Agent({
|
|
|
237
237
|
|
|
238
238
|
- [`Memory` reference](https://mastra.ai/reference/memory/memory-class)
|
|
239
239
|
- [Tracing](https://mastra.ai/docs/observability/tracing/overview)
|
|
240
|
-
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
240
|
+
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
241
|
+
- [Mastra Code](https://code.mastra.ai/): A coding agent using Mastra's memory system
|
|
@@ -39,7 +39,7 @@ for await (const chunk of stream) {
|
|
|
39
39
|
| `opencode-go/glm-5` | 203K | | | | | | $1 | $3 |
|
|
40
40
|
| `opencode-go/glm-5.1` | 203K | | | | | | $1 | $4 |
|
|
41
41
|
| `opencode-go/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
|
|
42
|
-
| `opencode-go/kimi-k2.6` | 262K | | | | | | $0.
|
|
42
|
+
| `opencode-go/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
43
43
|
| `opencode-go/mimo-v2-omni` | 262K | | | | | | $0.40 | $2 |
|
|
44
44
|
| `opencode-go/mimo-v2-pro` | 1.0M | | | | | | $1 | $3 |
|
|
45
45
|
| `opencode-go/mimo-v2.5` | 1.0M | | | | | | $0.40 | $2 |
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
**Added in:** `@mastra/core@1.5.0`
|
|
4
4
|
|
|
5
5
|
> **Warning:** The `Harness` class is in alpha stage and subject to change. It won't follow semantic versioning guarantees until it graduates from experimental status. Use with caution and expect breaking changes in minor versions.
|
|
6
|
+
>
|
|
7
|
+
> [Mastra Code](https://code.mastra.ai/) is the flagship implementation of the `Harness` class, showcasing how it can be used to build a powerful terminal-based coding agent with multi-model support, persistent conversations, and built-in tools.
|
|
6
8
|
|
|
7
9
|
The `Harness` class orchestrates multiple agent modes, shared state, memory, and storage. It provides a control layer that a TUI or other UI can drive to manage threads, switch models and modes, send messages, handle tool approvals, and track events.
|
|
8
10
|
|
|
@@ -987,6 +987,53 @@ await agent.generate('Hello!', {
|
|
|
987
987
|
})
|
|
988
988
|
```
|
|
989
989
|
|
|
990
|
+
## Handling auth failures inside custom fetch
|
|
991
|
+
|
|
992
|
+
A custom `fetch` should not `throw` when authentication is unavailable. The Streamable HTTP transport in the MCP SDK opens a long-lived `GET /mcp` "standalone listener" stream in the background to receive server-pushed notifications. Errors on that stream are retried with exponential backoff, and a thrown `fetch` or a cleanly-closed stream can produce an indefinite reconnect loop at roughly one attempt per second.
|
|
993
|
+
|
|
994
|
+
Return a synthetic `Response` instead. The [MCP Streamable HTTP specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports) defines `405 Method Not Allowed` as the signal a server returns when it does not offer the GET SSE stream, and the SDK honors it as a terminal status that stops the listener cleanly. Use this to disable the listener when your server does not push notifications.
|
|
995
|
+
|
|
996
|
+
The following pattern waits for an auth token on POST requests, attaches it to outgoing headers, and short-circuits the GET listener with a synthetic 405:
|
|
997
|
+
|
|
998
|
+
```typescript
|
|
999
|
+
async function waitForToken(timeoutMs = 5000): Promise<string | null> {
|
|
1000
|
+
// Replace with your token lookup. Return null if no token is available.
|
|
1001
|
+
return getAuthToken({ timeoutMs })
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
const mcpClient = new MCPClient({
|
|
1005
|
+
servers: {
|
|
1006
|
+
apiServer: {
|
|
1007
|
+
url: new URL('https://api.example.com/mcp'),
|
|
1008
|
+
fetch: async (url, init) => {
|
|
1009
|
+
const method = (init?.method || 'GET').toUpperCase()
|
|
1010
|
+
|
|
1011
|
+
// The SDK opens a background GET stream for server-pushed notifications.
|
|
1012
|
+
// If your server does not use it, short-circuit with 405 to stop reconnect attempts.
|
|
1013
|
+
if (method === 'GET') {
|
|
1014
|
+
return new Response(null, { status: 405, statusText: 'Method Not Allowed' })
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// POST: wait for the token, then forward the request with an Authorization header.
|
|
1018
|
+
const token = await waitForToken()
|
|
1019
|
+
if (!token) {
|
|
1020
|
+
// Forward the request without a token and let the server reject it.
|
|
1021
|
+
// The SDK surfaces non-2xx POST responses as errors to the caller of
|
|
1022
|
+
// tools/list, tools/call, etc., which is the desired behavior here.
|
|
1023
|
+
return fetch(url, init)
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
const headers = new Headers(init?.headers)
|
|
1027
|
+
headers.set('authorization', `Bearer ${token}`)
|
|
1028
|
+
return fetch(url, { ...init, headers })
|
|
1029
|
+
},
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
})
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
Return `405` for the GET listener only when your server does not push notifications back to the client. If your server uses the standalone GET stream, attach the auth token on `GET` requests as well and let the request through.
|
|
1036
|
+
|
|
990
1037
|
## Using SSE request headers
|
|
991
1038
|
|
|
992
1039
|
When using the legacy SSE MCP transport, you must configure both `requestInit` and `eventSourceInit` due to a bug in the MCP SDK. Alternatively, you can use a custom `fetch` function which will be automatically used for both POST requests and SSE connections:
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.35-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`dccd8f1`](https://github.com/mastra-ai/mastra/commit/dccd8f1f8b8f1ad203b77556207e5529567c616d)]:
|
|
8
|
+
- @mastra/core@1.33.0-alpha.1
|
|
9
|
+
|
|
3
10
|
## 1.1.35-alpha.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.35-alpha.
|
|
3
|
+
"version": "1.1.35-alpha.5",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"jsdom": "^26.1.0",
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@mastra/core": "1.33.0-alpha.
|
|
32
|
+
"@mastra/core": "1.33.0-alpha.1",
|
|
33
33
|
"@mastra/mcp": "^1.7.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"tsx": "^4.21.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
48
|
"vitest": "4.1.5",
|
|
49
|
+
"@internal/lint": "0.0.92",
|
|
49
50
|
"@internal/types-builder": "0.0.67",
|
|
50
|
-
"@mastra/core": "1.33.0-alpha.
|
|
51
|
-
"@internal/lint": "0.0.92"
|
|
51
|
+
"@mastra/core": "1.33.0-alpha.1"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|