@mastra/mcp 1.8.1 → 1.9.0-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.
- package/CHANGELOG.md +68 -0
- package/dist/client/client.d.ts +5 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +7 -0
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/types.d.ts +17 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-tools-mcp-client.md +51 -0
- package/dist/index.cjs +45 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 1.9.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added opt-in MCP server instructions forwarding into agent system prompts. ([#17155](https://github.com/mastra-ai/mastra/pull/17155))
|
|
8
|
+
|
|
9
|
+
When an MCP server advertises instructions during initialization, you can now forward that guidance into the system prompt of agents that use the server's tools. This is **opt-in** — set `forwardInstructions: true` per server to enable it. Forwarded instructions are injected into the agent's system prompt, so only enable this for servers you trust.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const mcp = new MCPClient({
|
|
13
|
+
servers: {
|
|
14
|
+
db: {
|
|
15
|
+
url: new URL('http://localhost:4111/mcp'),
|
|
16
|
+
forwardInstructions: true, // opt in; defaults to false
|
|
17
|
+
instructionsMaxLength: 512, // max chars forwarded per server
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const agent = new Agent({
|
|
23
|
+
id: 'db-agent',
|
|
24
|
+
name: 'DB Agent',
|
|
25
|
+
instructions: 'Help with database changes.',
|
|
26
|
+
model,
|
|
27
|
+
tools: await mcp.listTools(),
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You can always inspect cached instructions without forwarding them:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const instructions = mcp.getServerInstructions();
|
|
35
|
+
// => { db: 'Always validate before migrating.', other: undefined }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- Added native multimodal tool-result support. Core now converts MCP-style tool results with image and audio `content` parts into model-native media output when building model prompts, without requiring MCP tools to persist duplicate media payloads in `providerMetadata.mastra.modelOutput`. ([#16866](https://github.com/mastra-ai/mastra/pull/16866))
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{ type: 'text', text: 'Screenshot captured' },
|
|
44
|
+
{ type: 'image', data: base64Png, mimeType: 'image/png' },
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Support conditional, function-based tool approvals. ([#17337](https://github.com/mastra-ai/mastra/pull/17337))
|
|
52
|
+
- MCP tools that wrap a server-level `requireToolApproval` function are now honored end-to-end. The per-tool approval function was previously dropped when the agent converted MCP tools (it kept only the boolean flag), so conditional approval silently fell back to always-on. `CoreToolBuilder` now preserves a `needsApprovalFn` attached directly to a tool instance.
|
|
53
|
+
- The global `requireToolApproval` option on `agent.stream`/`agent.generate` now accepts a function in addition to a boolean. It is evaluated per tool call with the tool name, arguments, and request context, enabling policies such as regex allowlists on tool names. Returning `true` requires approval for that call; `false` allows it. On error the call defaults to requiring approval. When a function policy is set, tool calls run sequentially so approval suspensions don't race. Durable agents and stored agents continue to accept only a boolean (a function degrades to requiring approval for every call, since their options must be serializable).
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
// Approve only tool calls whose name is not on an allowlist.
|
|
57
|
+
const allowlist = /^(get|list|search)_/;
|
|
58
|
+
await agent.generate('...', {
|
|
59
|
+
requireToolApproval: ({ toolName }) => !allowlist.test(toolName),
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- Precedence is unchanged from before: a per-tool approval function (`createTool({ requireApproval: fn })` or an MCP-derived `needsApprovalFn`) is authoritative for that tool and overrides the global setting, so a tool can still opt out of approval by returning `false` even when the global option is on. The only new behavior is that the global option may now be a function in addition to a boolean.
|
|
64
|
+
- The previously implicit, runtime-attached per-tool approval predicate is now a typed contract: `@mastra/core` exports `NeedsApprovalFn` and declares the optional `needsApprovalFn` property on the `Tool` class. The MCP client and the agent runtime now share this typed contract instead of reaching through `any`. This is additive — no public API changes.
|
|
65
|
+
|
|
66
|
+
- Close the stale MCP transport before reconnecting so SSE connections no longer leak orphaned EventSource instances and accumulate server-side sessions on implicit reconnect. ([#17326](https://github.com/mastra-ai/mastra/pull/17326))
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [[`8ace89d`](https://github.com/mastra-ai/mastra/commit/8ace89df77f762e622d3b9f7f65ad7524350d050), [`fa63872`](https://github.com/mastra-ai/mastra/commit/fa6387280954e6b667bec5714b55ba082bc627ff), [`f07b646`](https://github.com/mastra-ai/mastra/commit/f07b64604ab7d25391179790b7fd4823df9e2dff), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`40f9297`](https://github.com/mastra-ai/mastra/commit/40f9297003b921c62373d3e8d3a4bda76c9f6de3), [`0f0d1ba`](https://github.com/mastra-ai/mastra/commit/0f0d1ba67bfcb2204e571401662f1eceefc03357), [`8c31bcd`](https://github.com/mastra-ai/mastra/commit/8c31bcdb00e597880d5939b1b7d7566fbe5dacae), [`95b14cd`](https://github.com/mastra-ai/mastra/commit/95b14cdd820e86d97ac05fe568424c513a252e31), [`aa36be2`](https://github.com/mastra-ai/mastra/commit/aa36be23aa513b7dc53cb8ca16b7fab8f20e43ad), [`212c635`](https://github.com/mastra-ai/mastra/commit/212c635203e61d036ab41db8ff86c3893dc795b3), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`9aa5a73`](https://github.com/mastra-ai/mastra/commit/9aa5a73e7e110f6e9365eec69364a33d5f03bb56), [`f73c789`](https://github.com/mastra-ai/mastra/commit/f73c789e8ef21561580395d2c410119cab5848c8), [`8bd16da`](https://github.com/mastra-ai/mastra/commit/8bd16da73a4cb874d739373643dbd6a6e7f88684), [`c8630f8`](https://github.com/mastra-ai/mastra/commit/c8630f80d4f40cb5d22e60ab162b618b1907167a), [`47f71dc`](https://github.com/mastra-ai/mastra/commit/47f71dc6fbcbd12d71e21a979e676e20a02bd77d), [`50ceae2`](https://github.com/mastra-ai/mastra/commit/50ceae270878e2f8fb2b2c6c2faab09df0007c8a), [`8cdde58`](https://github.com/mastra-ai/mastra/commit/8cdde5875bbba6702d9df226f2b20232b8d75d6c), [`847ff1e`](https://github.com/mastra-ai/mastra/commit/847ff1e0d94368d94b2e173e4e0908e115568ef3), [`259d409`](https://github.com/mastra-ai/mastra/commit/259d409a514174299dbde1ff5e1121209b3ba850), [`9e16c68`](https://github.com/mastra-ai/mastra/commit/9e16c6818b6485ccb43df28aba6f3a2219d28662), [`cefca33`](https://github.com/mastra-ai/mastra/commit/cefca33ae666e69810c935fedf95a929c173d1d7), [`d00e8c5`](https://github.com/mastra-ai/mastra/commit/d00e8c50daebe5bce5bf2f48bde39c86fc3d2fe4), [`36fa7e2`](https://github.com/mastra-ai/mastra/commit/36fa7e24d14e58a1eb46147097b32f583e5b8775), [`87e9774`](https://github.com/mastra-ai/mastra/commit/87e97741c1e493cd6d62f478eb810b49bda4d57c), [`65a72e7`](https://github.com/mastra-ai/mastra/commit/65a72e70c25eedea8ff985a6624b96be2850236b), [`0f77241`](https://github.com/mastra-ai/mastra/commit/0f7724108806703799a8ba80ad0f09414afd5066), [`92ff509`](https://github.com/mastra-ai/mastra/commit/92ff5098ef8a990438ca038077021a5f7541ec1d), [`3fce5e7`](https://github.com/mastra-ai/mastra/commit/3fce5e70d011d289043e75003ef3336ed4aa43c3), [`a763592`](https://github.com/mastra-ai/mastra/commit/a763592c3db46963ef1011cfe16fe372816e775e), [`80c7737`](https://github.com/mastra-ai/mastra/commit/80c7737e32d7917b5f356957d67c169d01744fd3), [`3f1cf47`](https://github.com/mastra-ai/mastra/commit/3f1cf476f74c1e4cc2df908837e05853a5347e31)]:
|
|
69
|
+
- @mastra/core@1.38.0-alpha.3
|
|
70
|
+
|
|
3
71
|
## 1.8.1
|
|
4
72
|
|
|
5
73
|
### Patch Changes
|
package/dist/client/client.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare class InternalMastraMCPClient extends MastraBase {
|
|
|
29
29
|
private exitHookUnsubscribe?;
|
|
30
30
|
private sigTermHandler?;
|
|
31
31
|
private sigHupHandler?;
|
|
32
|
+
private serverInstructions?;
|
|
32
33
|
private _roots;
|
|
33
34
|
private readonly requireToolApproval;
|
|
34
35
|
/** Provides access to resource operations (list, read, subscribe, etc.) */
|
|
@@ -122,6 +123,10 @@ export declare class InternalMastraMCPClient extends MastraBase {
|
|
|
122
123
|
* @internal
|
|
123
124
|
*/
|
|
124
125
|
get stderr(): Stream | null;
|
|
126
|
+
get instructions(): string | undefined;
|
|
127
|
+
get forwardInstructions(): boolean;
|
|
128
|
+
get instructionsMaxLength(): number;
|
|
129
|
+
private refreshServerInstructions;
|
|
125
130
|
disconnect(): Promise<void>;
|
|
126
131
|
/**
|
|
127
132
|
* Forces a reconnection to the MCP server by disconnecting and reconnecting.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRo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
|
reconnectServer(serverName: string): Promise<void>;
|
|
536
|
+
/**
|
|
537
|
+
* Returns instructions advertised by connected MCP servers during initialize.
|
|
538
|
+
*
|
|
539
|
+
* Servers that have not connected yet, or did not advertise instructions,
|
|
540
|
+
* return `undefined`.
|
|
541
|
+
*/
|
|
542
|
+
getServerInstructions(): Record<string, string | undefined>;
|
|
536
543
|
/**
|
|
537
544
|
* Retrieves all tools from all configured servers with namespaced names.
|
|
538
545
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/client/configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,MAAM,EACN,QAAQ,EACR,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAO1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wHAAwH;IACxH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACnD,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,aAAa,CAAiD;IACtE,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC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;;;;;;;;;OAsBG;IACI,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAU1D;;;;;;;;;;;;;;OAcG;IACH,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQvC;IAED;;;;;;;;OAQG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;YAM3C,kBAAkB;YA0DlB,2BAA2B;YAQ3B,iBAAiB;CAuBhC"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -151,6 +151,23 @@ export type BaseServerOptions = {
|
|
|
151
151
|
enableServerLogs?: boolean;
|
|
152
152
|
/** Whether to enable progress tracking (default: false) */
|
|
153
153
|
enableProgressTracking?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Whether instructions returned by this MCP server during initialization should
|
|
156
|
+
* be forwarded to agents that use the server's tools.
|
|
157
|
+
*
|
|
158
|
+
* Disabled by default: forwarded instructions are injected into the agent's
|
|
159
|
+
* system prompt, so only enable this for servers you trust.
|
|
160
|
+
*
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
forwardInstructions?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Maximum number of characters of this server's instructions to forward into
|
|
166
|
+
* an agent system prompt.
|
|
167
|
+
*
|
|
168
|
+
* @default 512
|
|
169
|
+
*/
|
|
170
|
+
instructionsMaxLength?: number;
|
|
154
171
|
/**
|
|
155
172
|
* Whether tools from this server require explicit user approval before execution.
|
|
156
173
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,KAAK,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8C;IAC9C,SAAS,CAAC,EAAE,oCAAoC,CAAC,WAAW,CAAC,CAAC;IAC9D;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,MAAM,EAAE,yBAAyB,CAAC;IAClC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -53,6 +53,10 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
|
|
|
53
53
|
|
|
54
54
|
**enableServerLogs** (`boolean`): Whether to enable logging for this server. (Default: `true`)
|
|
55
55
|
|
|
56
|
+
**forwardInstructions** (`boolean`): Whether to append instructions advertised by this MCP server to an agent's system prompt when the agent uses this server's tools. Disabled by default; enable it only for servers you trust, since the instructions are injected into the agent's system prompt. (Default: `false`)
|
|
57
|
+
|
|
58
|
+
**instructionsMaxLength** (`number`): Maximum number of server instruction characters to append to an agent's system prompt. (Default: `512`)
|
|
59
|
+
|
|
56
60
|
**requireToolApproval** (`boolean | (params: RequireToolApprovalContext) => boolean | Promise<boolean>`): Require human approval before executing tools from this server. When set to \`true\`, all tools require approval. When set to a function, the function is called with the tool name, arguments, request context, and any tool annotations advertised by the server to dynamically decide whether approval is needed.
|
|
57
61
|
|
|
58
62
|
## Tool approval
|
|
@@ -123,6 +127,36 @@ Per the MCP specification, **clients MUST consider tool annotations to be untrus
|
|
|
123
127
|
|
|
124
128
|
The same annotations are also exposed on the tools returned by `listTools()` and `listToolsets()` under `tool.mcp.annotations`, so you can inspect them when wiring tools into an agent.
|
|
125
129
|
|
|
130
|
+
## Server instructions
|
|
131
|
+
|
|
132
|
+
When an MCP server advertises instructions during initialization, `MCPClient` stores them for that server. Forwarding those instructions into an agent's system prompt is **opt-in**: set `forwardInstructions: true` on a server to have agents that use its tools (via `listTools()` or `listToolsets()`) receive its instructions automatically.
|
|
133
|
+
|
|
134
|
+
The guidance is grouped by server name and truncated to `instructionsMaxLength` characters per server.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const mcp = new MCPClient({
|
|
138
|
+
servers: {
|
|
139
|
+
db: {
|
|
140
|
+
url: new URL('http://localhost:3000/mcp'),
|
|
141
|
+
forwardInstructions: true,
|
|
142
|
+
instructionsMaxLength: 512,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const agent = new Agent({
|
|
148
|
+
id: 'db-agent',
|
|
149
|
+
name: 'DB Agent',
|
|
150
|
+
instructions: 'Help with database changes.',
|
|
151
|
+
model,
|
|
152
|
+
tools: await mcp.listTools(),
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
When `forwardInstructions` is omitted (the default), instructions are still cached and can be inspected via [`getServerInstructions()`](#getserverinstructions), but are not added to any agent's system prompt.
|
|
157
|
+
|
|
158
|
+
> **Security note:** server instructions are forwarded verbatim (subject only to length truncation) into the agent's system prompt. A malicious or compromised MCP server can use them to inject instructions the agent will treat as trusted system guidance. Only enable `forwardInstructions` for servers you trust, and prefer reviewing instructions with `getServerInstructions()` before forwarding instructions from third-party servers.
|
|
159
|
+
|
|
126
160
|
## Methods
|
|
127
161
|
|
|
128
162
|
### `listTools()`
|
|
@@ -143,6 +177,23 @@ const res = await agent.stream(prompt, {
|
|
|
143
177
|
})
|
|
144
178
|
```
|
|
145
179
|
|
|
180
|
+
### `getServerInstructions()`
|
|
181
|
+
|
|
182
|
+
Returns the instructions currently known for each configured MCP server. Servers that have not connected yet, or do not advertise instructions, return `undefined`.
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
getServerInstructions(): Record<string, string | undefined>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Example:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
await mcp.listTools()
|
|
192
|
+
|
|
193
|
+
const instructionsByServer = mcp.getServerInstructions()
|
|
194
|
+
console.log(instructionsByServer.db)
|
|
195
|
+
```
|
|
196
|
+
|
|
146
197
|
### `disconnect()`
|
|
147
198
|
|
|
148
199
|
Disconnects from all MCP servers and cleans up resources.
|
package/dist/index.cjs
CHANGED
|
@@ -425,6 +425,7 @@ function isReconnectableMCPError(error) {
|
|
|
425
425
|
|
|
426
426
|
// src/client/client.ts
|
|
427
427
|
var DEFAULT_SERVER_CONNECT_TIMEOUT_MSEC = 3e3;
|
|
428
|
+
var DEFAULT_INSTRUCTIONS_MAX_LENGTH = 512;
|
|
428
429
|
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
429
430
|
var SSE_FALLBACK_STATUS_CODES = [400, 404, 405];
|
|
430
431
|
var DATADOG_TRACER_TEST_SYMBOL = /* @__PURE__ */ Symbol.for("mastra.mcp.dd-trace-test-tracer");
|
|
@@ -507,6 +508,7 @@ var InternalMastraMCPClient = class extends base.MastraBase {
|
|
|
507
508
|
exitHookUnsubscribe;
|
|
508
509
|
sigTermHandler;
|
|
509
510
|
sigHupHandler;
|
|
511
|
+
serverInstructions;
|
|
510
512
|
_roots;
|
|
511
513
|
requireToolApproval;
|
|
512
514
|
/** Provides access to resource operations (list, read, subscribe, etc.) */
|
|
@@ -753,11 +755,19 @@ var InternalMastraMCPClient = class extends base.MastraBase {
|
|
|
753
755
|
} else {
|
|
754
756
|
throw new Error("Server configuration must include either a command or a url.");
|
|
755
757
|
}
|
|
758
|
+
this.refreshServerInstructions();
|
|
756
759
|
resolve(true);
|
|
757
760
|
const originalOnClose = this.client.onclose;
|
|
758
761
|
this.client.onclose = () => {
|
|
759
762
|
this.log("debug", `MCP server connection closed`);
|
|
763
|
+
const staleTransport = this.transport;
|
|
764
|
+
this.transport = void 0;
|
|
760
765
|
this.isConnected = null;
|
|
766
|
+
this.serverInstructions = void 0;
|
|
767
|
+
if (staleTransport) {
|
|
768
|
+
void staleTransport.close().catch(() => {
|
|
769
|
+
});
|
|
770
|
+
}
|
|
761
771
|
if (typeof originalOnClose === "function") {
|
|
762
772
|
originalOnClose();
|
|
763
773
|
}
|
|
@@ -815,6 +825,18 @@ var InternalMastraMCPClient = class extends base.MastraBase {
|
|
|
815
825
|
}
|
|
816
826
|
return null;
|
|
817
827
|
}
|
|
828
|
+
get instructions() {
|
|
829
|
+
return this.serverInstructions;
|
|
830
|
+
}
|
|
831
|
+
get forwardInstructions() {
|
|
832
|
+
return this.serverConfig.forwardInstructions ?? false;
|
|
833
|
+
}
|
|
834
|
+
get instructionsMaxLength() {
|
|
835
|
+
return this.serverConfig.instructionsMaxLength ?? DEFAULT_INSTRUCTIONS_MAX_LENGTH;
|
|
836
|
+
}
|
|
837
|
+
refreshServerInstructions() {
|
|
838
|
+
this.serverInstructions = this.client.getInstructions();
|
|
839
|
+
}
|
|
818
840
|
async disconnect() {
|
|
819
841
|
if (!this.transport) {
|
|
820
842
|
this.log("debug", "Disconnect called but no transport was connected.");
|
|
@@ -832,6 +854,7 @@ var InternalMastraMCPClient = class extends base.MastraBase {
|
|
|
832
854
|
} finally {
|
|
833
855
|
this.transport = void 0;
|
|
834
856
|
this.isConnected = null;
|
|
857
|
+
this.serverInstructions = void 0;
|
|
835
858
|
if (this.exitHookUnsubscribe) {
|
|
836
859
|
this.exitHookUnsubscribe();
|
|
837
860
|
this.exitHookUnsubscribe = void 0;
|
|
@@ -870,6 +893,7 @@ var InternalMastraMCPClient = class extends base.MastraBase {
|
|
|
870
893
|
}
|
|
871
894
|
this.transport = void 0;
|
|
872
895
|
this.isConnected = null;
|
|
896
|
+
this.serverInstructions = void 0;
|
|
873
897
|
await this.connect();
|
|
874
898
|
this.log("debug", "Successfully reconnected to MCP server");
|
|
875
899
|
}
|
|
@@ -1008,7 +1032,10 @@ var InternalMastraMCPClient = class extends base.MastraBase {
|
|
|
1008
1032
|
requireApproval,
|
|
1009
1033
|
mcpMetadata: {
|
|
1010
1034
|
serverName: this.name,
|
|
1011
|
-
serverVersion: this.client.getServerVersion()?.version
|
|
1035
|
+
serverVersion: this.client.getServerVersion()?.version,
|
|
1036
|
+
serverInstructions: this.serverInstructions,
|
|
1037
|
+
forwardInstructions: this.forwardInstructions,
|
|
1038
|
+
instructionsMaxLength: this.instructionsMaxLength
|
|
1012
1039
|
},
|
|
1013
1040
|
execute: async (input, context) => {
|
|
1014
1041
|
const operationContext = context?.requestContext ?? null;
|
|
@@ -1872,6 +1899,19 @@ To fix this you have three different options:
|
|
|
1872
1899
|
await this.getConnectedClientForServer(serverName);
|
|
1873
1900
|
}
|
|
1874
1901
|
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Returns instructions advertised by connected MCP servers during initialize.
|
|
1904
|
+
*
|
|
1905
|
+
* Servers that have not connected yet, or did not advertise instructions,
|
|
1906
|
+
* return `undefined`.
|
|
1907
|
+
*/
|
|
1908
|
+
getServerInstructions() {
|
|
1909
|
+
const instructions = {};
|
|
1910
|
+
for (const serverName of Object.keys(this.serverConfigs)) {
|
|
1911
|
+
instructions[serverName] = this.mcpClientsById.get(serverName)?.instructions;
|
|
1912
|
+
}
|
|
1913
|
+
return instructions;
|
|
1914
|
+
}
|
|
1875
1915
|
/**
|
|
1876
1916
|
* Retrieves all tools from all configured servers with namespaced names.
|
|
1877
1917
|
*
|
|
@@ -2317,7 +2357,7 @@ function createSimpleTokenProvider(accessToken, options) {
|
|
|
2317
2357
|
});
|
|
2318
2358
|
}
|
|
2319
2359
|
|
|
2320
|
-
//
|
|
2360
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/utils/stream.js
|
|
2321
2361
|
var StreamingApi = class {
|
|
2322
2362
|
writer;
|
|
2323
2363
|
encoder;
|
|
@@ -2394,7 +2434,7 @@ var StreamingApi = class {
|
|
|
2394
2434
|
}
|
|
2395
2435
|
};
|
|
2396
2436
|
|
|
2397
|
-
//
|
|
2437
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/helper/streaming/utils.js
|
|
2398
2438
|
var isOldBunVersion = () => {
|
|
2399
2439
|
const version = typeof Bun !== "undefined" ? Bun.version : void 0;
|
|
2400
2440
|
if (version === void 0) {
|
|
@@ -2405,7 +2445,7 @@ var isOldBunVersion = () => {
|
|
|
2405
2445
|
return result;
|
|
2406
2446
|
};
|
|
2407
2447
|
|
|
2408
|
-
//
|
|
2448
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/utils/html.js
|
|
2409
2449
|
var HtmlEscapedCallbackPhase = {
|
|
2410
2450
|
Stringify: 1};
|
|
2411
2451
|
var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
|
|
@@ -2436,7 +2476,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
2436
2476
|
}
|
|
2437
2477
|
};
|
|
2438
2478
|
|
|
2439
|
-
//
|
|
2479
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.18/a4592d669eb2c33e4f24995614864047f2c1a155accc9d64dd2de0f4e8d608a9/node_modules/hono/dist/helper/streaming/sse.js
|
|
2440
2480
|
var SSEStreamingApi = class extends StreamingApi {
|
|
2441
2481
|
constructor(writable, readable) {
|
|
2442
2482
|
super(writable, readable);
|