@mastra/mcp 0.4.1-alpha.3 → 0.4.1-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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +15 -0
- package/README.md +72 -49
- package/dist/_tsup-dts-rollup.d.cts +57 -30
- package/dist/_tsup-dts-rollup.d.ts +57 -30
- package/dist/index.cjs +72 -21
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +69 -22
- package/package.json +5 -4
- package/src/client.ts +14 -1
- package/src/configuration.test.ts +17 -17
- package/src/configuration.ts +90 -25
- package/src/index.ts +2 -1
- package/src/server-logging.test.ts +4 -4
- package/src/server.test.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/mcp@0.4.1-alpha.
|
|
2
|
+
> @mastra/mcp@0.4.1-alpha.5 build /home/runner/work/mastra/mastra/packages/mcp
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 16456ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
|
-
Analysis will use the bundled TypeScript version 5.8.
|
|
12
|
+
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
|
-
Analysis will use the bundled TypeScript version 5.8.
|
|
14
|
+
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 14716ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
23
|
-
[32mESM[39m ⚡️ Build success in
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m205.23 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 2992ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m204.37 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 2992ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 0.4.1-alpha.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e4943b8]
|
|
8
|
+
- Updated dependencies [479f490]
|
|
9
|
+
- @mastra/core@0.9.1-alpha.4
|
|
10
|
+
|
|
11
|
+
## 0.4.1-alpha.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 2526527: We are deprecating the MastraMCPClient class in favour of using MCPClient (formerly MCPConfiguration). MCPClient can handle 1+ MCP servers, whereas MastraMCPClient can only handle a single MCP server. Rather than having two different interfaces to use when using a single MCP vs multiple, we opted to nudge people towards using the interface that is more flexible.
|
|
16
|
+
- a2ccb71: improved mcp config cache
|
|
17
|
+
|
|
3
18
|
## 0.4.1-alpha.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -20,37 +20,59 @@ The client automatically detects the transport type based on your server configu
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
|
-
import {
|
|
23
|
+
import { MCPClient } from '@mastra/mcp';
|
|
24
24
|
|
|
25
25
|
// Create a client with a Stdio server
|
|
26
|
-
const stdioClient = new
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
const stdioClient = new MCPClient({
|
|
27
|
+
servers: {
|
|
28
|
+
myStdioClient: {
|
|
29
|
+
command: 'your-mcp-server-command',
|
|
30
|
+
args: ['--your', 'args'],
|
|
31
|
+
env: { API_KEY: 'your-api-key' }, // optional environment variables
|
|
32
|
+
capabilities: {}, // optional ClientCapabilities
|
|
33
|
+
timeout: 60000, // optional timeout for tool calls in milliseconds
|
|
34
|
+
},
|
|
33
35
|
},
|
|
34
|
-
capabilities: {}, // optional ClientCapabilities
|
|
35
|
-
timeout: 60000, // optional timeout for tool calls in milliseconds
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
// Create a client with an HTTP server (tries Streamable HTTP, falls back to SSE)
|
|
39
|
-
const httpClient = new
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
const httpClient = new MCPClient({
|
|
40
|
+
servers: {
|
|
41
|
+
myHttpClient: {
|
|
42
|
+
url: new URL('https://your-mcp-server.com/mcp'), // Use the base URL for Streamable HTTP
|
|
43
|
+
requestInit: {
|
|
44
|
+
// Optional fetch request configuration
|
|
45
|
+
headers: { Authorization: 'Bearer your-token' },
|
|
46
|
+
},
|
|
47
|
+
// eventSourceInit is only needed for custom headers with the legacy SSE fallback
|
|
48
|
+
eventSourceInit: {
|
|
49
|
+
/* ... */
|
|
50
|
+
},
|
|
47
51
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Or create a client with SSE server
|
|
56
|
+
const sseClient = new MCPClient({
|
|
57
|
+
servers: {
|
|
58
|
+
mySseClient: {
|
|
59
|
+
url: new URL('https://your-mcp-server.com/sse'),
|
|
60
|
+
requestInit: {
|
|
61
|
+
headers: { Authorization: 'Bearer your-token' },
|
|
62
|
+
},
|
|
63
|
+
eventSourceInit: {
|
|
64
|
+
fetch(input: Request | URL | string, init?: RequestInit) {
|
|
65
|
+
const headers = new Headers(init?.headers || {});
|
|
66
|
+
headers.set('Authorization', 'Bearer your-token');
|
|
67
|
+
return fetch(input, {
|
|
68
|
+
...init,
|
|
69
|
+
headers,
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
timeout: 60000, // optional timeout for tool calls in milliseconds
|
|
51
74
|
},
|
|
52
75
|
},
|
|
53
|
-
timeout: 60000, // optional timeout for tool calls in milliseconds
|
|
54
76
|
});
|
|
55
77
|
|
|
56
78
|
// Connect to the MCP server (using one of the clients above)
|
|
@@ -68,12 +90,12 @@ await httpClient.disconnect();
|
|
|
68
90
|
|
|
69
91
|
## Managing Multiple MCP Servers
|
|
70
92
|
|
|
71
|
-
For applications that need to interact with multiple MCP servers, the `
|
|
93
|
+
For applications that need to interact with multiple MCP servers, the `MCPClient` class provides a convenient way to manage multiple server connections and their tools. It also uses the automatic transport detection based on the `server` configuration:
|
|
72
94
|
|
|
73
95
|
```typescript
|
|
74
|
-
import {
|
|
96
|
+
import { MCPClient } from '@mastra/mcp';
|
|
75
97
|
|
|
76
|
-
const mcp = new
|
|
98
|
+
const mcp = new MCPClient({
|
|
77
99
|
servers: {
|
|
78
100
|
// Stdio-based server
|
|
79
101
|
stockPrice: {
|
|
@@ -106,7 +128,7 @@ const toolsets = await mcp.getToolsets();
|
|
|
106
128
|
The MCP client provides per-server logging capabilities, allowing you to monitor interactions with each MCP server separately:
|
|
107
129
|
|
|
108
130
|
```typescript
|
|
109
|
-
import {
|
|
131
|
+
import { MCPClient, LogMessage, LoggingLevel } from '@mastra/mcp';
|
|
110
132
|
|
|
111
133
|
// Define a custom log handler
|
|
112
134
|
const weatherLogger = (logMessage: LogMessage) => {
|
|
@@ -118,7 +140,7 @@ const weatherLogger = (logMessage: LogMessage) => {
|
|
|
118
140
|
};
|
|
119
141
|
|
|
120
142
|
// Initialize MCP configuration with server-specific loggers
|
|
121
|
-
const mcp = new
|
|
143
|
+
const mcp = new MCPClient({
|
|
122
144
|
servers: {
|
|
123
145
|
weatherService: {
|
|
124
146
|
command: 'npx',
|
|
@@ -182,7 +204,7 @@ const createFileLogger = (filePath: string) => {
|
|
|
182
204
|
};
|
|
183
205
|
|
|
184
206
|
// Use the factory in configuration
|
|
185
|
-
const mcp = new
|
|
207
|
+
const mcp = new MCPClient({
|
|
186
208
|
servers: {
|
|
187
209
|
weatherService: {
|
|
188
210
|
command: 'npx',
|
|
@@ -197,7 +219,7 @@ See the `examples/server-logging.ts` file for comprehensive examples of various
|
|
|
197
219
|
|
|
198
220
|
### Tools vs Toolsets
|
|
199
221
|
|
|
200
|
-
The
|
|
222
|
+
The MCPClient class provides two ways to access MCP tools:
|
|
201
223
|
|
|
202
224
|
#### Tools (`getTools()`)
|
|
203
225
|
|
|
@@ -230,12 +252,12 @@ Use this when:
|
|
|
230
252
|
- Tool configuration needs to change dynamically
|
|
231
253
|
|
|
232
254
|
```typescript
|
|
233
|
-
import {
|
|
255
|
+
import { MCPClient } from '@mastra/mcp';
|
|
234
256
|
import { Agent } from '@mastra/core/agent';
|
|
235
257
|
import { openai } from '@ai-sdk/openai';
|
|
236
258
|
|
|
237
259
|
// Configure MCP servers with user-specific settings before getting toolsets
|
|
238
|
-
const mcp = new
|
|
260
|
+
const mcp = new MCPClient({
|
|
239
261
|
servers: {
|
|
240
262
|
stockPrice: {
|
|
241
263
|
command: 'npx',
|
|
@@ -272,7 +294,7 @@ const response = await agent.generate('What is the weather in London?', {
|
|
|
272
294
|
console.log(response.text);
|
|
273
295
|
```
|
|
274
296
|
|
|
275
|
-
The `
|
|
297
|
+
The `MCPClient` class automatically:
|
|
276
298
|
|
|
277
299
|
- Manages connections to multiple MCP servers
|
|
278
300
|
- Namespaces tools to prevent naming conflicts
|
|
@@ -288,23 +310,24 @@ The `eventSourceInit` configuration allows you to customize the underlying fetch
|
|
|
288
310
|
To properly include authentication headers or other custom headers in SSE connections when using the legacy fallback, you need to use both `requestInit` and `eventSourceInit`:
|
|
289
311
|
|
|
290
312
|
```typescript
|
|
291
|
-
const sseClient = new
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
313
|
+
const sseClient = new MCPClient({
|
|
314
|
+
servers: {
|
|
315
|
+
authenticatedSseClient: {
|
|
316
|
+
url: new URL('https://your-mcp-server.com/sse'), // Note the typical /sse path for legacy servers
|
|
317
|
+
// requestInit alone isn't enough for SSE connections
|
|
318
|
+
requestInit: {
|
|
319
|
+
headers: { Authorization: 'Bearer your-token' },
|
|
320
|
+
},
|
|
321
|
+
// eventSourceInit is required to include headers in the SSE connection
|
|
322
|
+
eventSourceInit: {
|
|
323
|
+
fetch(input: Request | URL | string, init?: RequestInit) {
|
|
324
|
+
const headers = new Headers(init?.headers || {});
|
|
325
|
+
headers.set('Authorization', 'Bearer your-token');
|
|
326
|
+
return fetch(input, {
|
|
327
|
+
...init,
|
|
328
|
+
headers,
|
|
329
|
+
});
|
|
330
|
+
},
|
|
308
331
|
},
|
|
309
332
|
},
|
|
310
333
|
},
|
|
@@ -40,38 +40,13 @@ declare type HttpServerDefinition = BaseServerOptions & {
|
|
|
40
40
|
sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export declare
|
|
44
|
-
info: (message: string, data?: any) => Promise<void>;
|
|
45
|
-
warning: (message: string, data?: any) => Promise<void>;
|
|
46
|
-
error: (message: string, error?: any) => Promise<void>;
|
|
47
|
-
debug: (message: string, data?: any) => Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export declare const logger: Logger;
|
|
51
|
-
|
|
52
|
-
export { LoggingLevel }
|
|
53
|
-
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
54
|
-
|
|
55
|
-
declare type LogHandler = (logMessage: LogMessage) => void;
|
|
56
|
-
export { LogHandler }
|
|
57
|
-
export { LogHandler as LogHandler_alias_1 }
|
|
58
|
-
|
|
59
|
-
declare interface LogMessage {
|
|
60
|
-
level: LoggingLevel;
|
|
61
|
-
message: string;
|
|
62
|
-
timestamp: Date;
|
|
63
|
-
serverName: string;
|
|
64
|
-
details?: Record<string, any>;
|
|
65
|
-
}
|
|
66
|
-
export { LogMessage }
|
|
67
|
-
export { LogMessage as LogMessage_alias_1 }
|
|
68
|
-
|
|
69
|
-
declare class MastraMCPClient extends MastraBase {
|
|
43
|
+
export declare class InternalMastraMCPClient extends MastraBase {
|
|
70
44
|
name: string;
|
|
71
45
|
private client;
|
|
72
46
|
private readonly timeout;
|
|
73
47
|
private logHandler?;
|
|
74
48
|
private enableServerLogs?;
|
|
49
|
+
private static hasWarned;
|
|
75
50
|
private serverConfig;
|
|
76
51
|
private transport?;
|
|
77
52
|
constructor({ name, version, server, capabilities, timeout, }: {
|
|
@@ -102,6 +77,37 @@ declare class MastraMCPClient extends MastraBase {
|
|
|
102
77
|
resources(): Promise<ReturnType<Protocol<any, any, any>['request']>>;
|
|
103
78
|
tools(): Promise<Record<string, any>>;
|
|
104
79
|
}
|
|
80
|
+
|
|
81
|
+
export declare interface Logger {
|
|
82
|
+
info: (message: string, data?: any) => Promise<void>;
|
|
83
|
+
warning: (message: string, data?: any) => Promise<void>;
|
|
84
|
+
error: (message: string, error?: any) => Promise<void>;
|
|
85
|
+
debug: (message: string, data?: any) => Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare const logger: Logger;
|
|
89
|
+
|
|
90
|
+
export { LoggingLevel }
|
|
91
|
+
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
92
|
+
|
|
93
|
+
declare type LogHandler = (logMessage: LogMessage) => void;
|
|
94
|
+
export { LogHandler }
|
|
95
|
+
export { LogHandler as LogHandler_alias_1 }
|
|
96
|
+
|
|
97
|
+
declare interface LogMessage {
|
|
98
|
+
level: LoggingLevel;
|
|
99
|
+
message: string;
|
|
100
|
+
timestamp: Date;
|
|
101
|
+
serverName: string;
|
|
102
|
+
details?: Record<string, any>;
|
|
103
|
+
}
|
|
104
|
+
export { LogMessage }
|
|
105
|
+
export { LogMessage as LogMessage_alias_1 }
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated MastraMCPClient is deprecated and will be removed in a future release. Please use MCPClient instead.
|
|
109
|
+
*/
|
|
110
|
+
declare const MastraMCPClient: typeof InternalMastraMCPClient;
|
|
105
111
|
export { MastraMCPClient }
|
|
106
112
|
export { MastraMCPClient as MastraMCPClient_alias_1 }
|
|
107
113
|
|
|
@@ -109,11 +115,13 @@ declare type MastraMCPServerDefinition = StdioServerDefinition | HttpServerDefin
|
|
|
109
115
|
export { MastraMCPServerDefinition }
|
|
110
116
|
export { MastraMCPServerDefinition as MastraMCPServerDefinition_alias_1 }
|
|
111
117
|
|
|
112
|
-
declare class
|
|
118
|
+
declare class MCPClient extends MastraBase {
|
|
113
119
|
private serverConfigs;
|
|
114
120
|
private id;
|
|
115
121
|
private defaultTimeout;
|
|
116
|
-
|
|
122
|
+
private mcpClientsById;
|
|
123
|
+
private disconnectPromise;
|
|
124
|
+
constructor(args: MCPClientOptions);
|
|
117
125
|
private addToInstanceCache;
|
|
118
126
|
private makeId;
|
|
119
127
|
disconnect(): Promise<void>;
|
|
@@ -124,13 +132,32 @@ declare class MCPConfiguration extends MastraBase {
|
|
|
124
132
|
* Returns an object mapping server names to their session IDs.
|
|
125
133
|
*/
|
|
126
134
|
get sessionIds(): Record<string, string>;
|
|
127
|
-
private mcpClientsById;
|
|
128
135
|
private getConnectedClient;
|
|
129
136
|
private eachClientTools;
|
|
130
137
|
}
|
|
138
|
+
export { MCPClient }
|
|
139
|
+
export { MCPClient as MCPClient_alias_1 }
|
|
140
|
+
|
|
141
|
+
declare interface MCPClientOptions {
|
|
142
|
+
id?: string;
|
|
143
|
+
servers: Record<string, MastraMCPServerDefinition>;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
}
|
|
146
|
+
export { MCPClientOptions }
|
|
147
|
+
export { MCPClientOptions as MCPClientOptions_alias_1 }
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated MCPConfiguration is deprecated and will be removed in a future release. Use MCPClient instead.
|
|
151
|
+
*/
|
|
152
|
+
declare class MCPConfiguration extends MCPClient {
|
|
153
|
+
constructor(args: MCPClientOptions);
|
|
154
|
+
}
|
|
131
155
|
export { MCPConfiguration }
|
|
132
156
|
export { MCPConfiguration as MCPConfiguration_alias_1 }
|
|
133
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated MCPConfigurationOptions is deprecated and will be removed in a future release. Use MCPClientOptions instead.
|
|
160
|
+
*/
|
|
134
161
|
declare interface MCPConfigurationOptions {
|
|
135
162
|
id?: string;
|
|
136
163
|
servers: Record<string, MastraMCPServerDefinition>;
|
|
@@ -40,38 +40,13 @@ declare type HttpServerDefinition = BaseServerOptions & {
|
|
|
40
40
|
sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export declare
|
|
44
|
-
info: (message: string, data?: any) => Promise<void>;
|
|
45
|
-
warning: (message: string, data?: any) => Promise<void>;
|
|
46
|
-
error: (message: string, error?: any) => Promise<void>;
|
|
47
|
-
debug: (message: string, data?: any) => Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export declare const logger: Logger;
|
|
51
|
-
|
|
52
|
-
export { LoggingLevel }
|
|
53
|
-
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
54
|
-
|
|
55
|
-
declare type LogHandler = (logMessage: LogMessage) => void;
|
|
56
|
-
export { LogHandler }
|
|
57
|
-
export { LogHandler as LogHandler_alias_1 }
|
|
58
|
-
|
|
59
|
-
declare interface LogMessage {
|
|
60
|
-
level: LoggingLevel;
|
|
61
|
-
message: string;
|
|
62
|
-
timestamp: Date;
|
|
63
|
-
serverName: string;
|
|
64
|
-
details?: Record<string, any>;
|
|
65
|
-
}
|
|
66
|
-
export { LogMessage }
|
|
67
|
-
export { LogMessage as LogMessage_alias_1 }
|
|
68
|
-
|
|
69
|
-
declare class MastraMCPClient extends MastraBase {
|
|
43
|
+
export declare class InternalMastraMCPClient extends MastraBase {
|
|
70
44
|
name: string;
|
|
71
45
|
private client;
|
|
72
46
|
private readonly timeout;
|
|
73
47
|
private logHandler?;
|
|
74
48
|
private enableServerLogs?;
|
|
49
|
+
private static hasWarned;
|
|
75
50
|
private serverConfig;
|
|
76
51
|
private transport?;
|
|
77
52
|
constructor({ name, version, server, capabilities, timeout, }: {
|
|
@@ -102,6 +77,37 @@ declare class MastraMCPClient extends MastraBase {
|
|
|
102
77
|
resources(): Promise<ReturnType<Protocol<any, any, any>['request']>>;
|
|
103
78
|
tools(): Promise<Record<string, any>>;
|
|
104
79
|
}
|
|
80
|
+
|
|
81
|
+
export declare interface Logger {
|
|
82
|
+
info: (message: string, data?: any) => Promise<void>;
|
|
83
|
+
warning: (message: string, data?: any) => Promise<void>;
|
|
84
|
+
error: (message: string, error?: any) => Promise<void>;
|
|
85
|
+
debug: (message: string, data?: any) => Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare const logger: Logger;
|
|
89
|
+
|
|
90
|
+
export { LoggingLevel }
|
|
91
|
+
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
92
|
+
|
|
93
|
+
declare type LogHandler = (logMessage: LogMessage) => void;
|
|
94
|
+
export { LogHandler }
|
|
95
|
+
export { LogHandler as LogHandler_alias_1 }
|
|
96
|
+
|
|
97
|
+
declare interface LogMessage {
|
|
98
|
+
level: LoggingLevel;
|
|
99
|
+
message: string;
|
|
100
|
+
timestamp: Date;
|
|
101
|
+
serverName: string;
|
|
102
|
+
details?: Record<string, any>;
|
|
103
|
+
}
|
|
104
|
+
export { LogMessage }
|
|
105
|
+
export { LogMessage as LogMessage_alias_1 }
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated MastraMCPClient is deprecated and will be removed in a future release. Please use MCPClient instead.
|
|
109
|
+
*/
|
|
110
|
+
declare const MastraMCPClient: typeof InternalMastraMCPClient;
|
|
105
111
|
export { MastraMCPClient }
|
|
106
112
|
export { MastraMCPClient as MastraMCPClient_alias_1 }
|
|
107
113
|
|
|
@@ -109,11 +115,13 @@ declare type MastraMCPServerDefinition = StdioServerDefinition | HttpServerDefin
|
|
|
109
115
|
export { MastraMCPServerDefinition }
|
|
110
116
|
export { MastraMCPServerDefinition as MastraMCPServerDefinition_alias_1 }
|
|
111
117
|
|
|
112
|
-
declare class
|
|
118
|
+
declare class MCPClient extends MastraBase {
|
|
113
119
|
private serverConfigs;
|
|
114
120
|
private id;
|
|
115
121
|
private defaultTimeout;
|
|
116
|
-
|
|
122
|
+
private mcpClientsById;
|
|
123
|
+
private disconnectPromise;
|
|
124
|
+
constructor(args: MCPClientOptions);
|
|
117
125
|
private addToInstanceCache;
|
|
118
126
|
private makeId;
|
|
119
127
|
disconnect(): Promise<void>;
|
|
@@ -124,13 +132,32 @@ declare class MCPConfiguration extends MastraBase {
|
|
|
124
132
|
* Returns an object mapping server names to their session IDs.
|
|
125
133
|
*/
|
|
126
134
|
get sessionIds(): Record<string, string>;
|
|
127
|
-
private mcpClientsById;
|
|
128
135
|
private getConnectedClient;
|
|
129
136
|
private eachClientTools;
|
|
130
137
|
}
|
|
138
|
+
export { MCPClient }
|
|
139
|
+
export { MCPClient as MCPClient_alias_1 }
|
|
140
|
+
|
|
141
|
+
declare interface MCPClientOptions {
|
|
142
|
+
id?: string;
|
|
143
|
+
servers: Record<string, MastraMCPServerDefinition>;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
}
|
|
146
|
+
export { MCPClientOptions }
|
|
147
|
+
export { MCPClientOptions as MCPClientOptions_alias_1 }
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated MCPConfiguration is deprecated and will be removed in a future release. Use MCPClient instead.
|
|
151
|
+
*/
|
|
152
|
+
declare class MCPConfiguration extends MCPClient {
|
|
153
|
+
constructor(args: MCPClientOptions);
|
|
154
|
+
}
|
|
131
155
|
export { MCPConfiguration }
|
|
132
156
|
export { MCPConfiguration as MCPConfiguration_alias_1 }
|
|
133
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated MCPConfigurationOptions is deprecated and will be removed in a future release. Use MCPClientOptions instead.
|
|
160
|
+
*/
|
|
134
161
|
declare interface MCPConfigurationOptions {
|
|
135
162
|
id?: string;
|
|
136
163
|
servers: Record<string, MastraMCPServerDefinition>;
|