@mastra/mcp 1.0.0-beta.0 → 1.0.0-beta.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/CHANGELOG.md +22 -0
- package/dist/client/client.d.ts +6 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/index.cjs +15 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -366,6 +366,7 @@ var ResourceClientActions = class {
|
|
|
366
366
|
};
|
|
367
367
|
|
|
368
368
|
// src/client/client.ts
|
|
369
|
+
var DEFAULT_SERVER_CONNECT_TIMEOUT_MSEC = 3e3;
|
|
369
370
|
function convertLogLevelToLoggerMethod(level) {
|
|
370
371
|
switch (level) {
|
|
371
372
|
case "debug":
|
|
@@ -483,7 +484,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
483
484
|
}
|
|
484
485
|
}
|
|
485
486
|
async connectHttp(url) {
|
|
486
|
-
const { requestInit, eventSourceInit, authProvider } = this.serverConfig;
|
|
487
|
+
const { requestInit, eventSourceInit, authProvider, connectTimeout } = this.serverConfig;
|
|
487
488
|
this.log("debug", `Attempting to connect to URL: ${url}`);
|
|
488
489
|
let shouldTrySSE = url.pathname.endsWith(`/sse`);
|
|
489
490
|
if (!shouldTrySSE) {
|
|
@@ -495,10 +496,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
495
496
|
authProvider
|
|
496
497
|
});
|
|
497
498
|
await this.client.connect(streamableTransport, {
|
|
498
|
-
timeout:
|
|
499
|
-
// this is hardcoded to 3s because the long default timeout would be extremely slow for sse backwards compat (60s)
|
|
500
|
-
3e3
|
|
501
|
-
)
|
|
499
|
+
timeout: connectTimeout ?? DEFAULT_SERVER_CONNECT_TIMEOUT_MSEC
|
|
502
500
|
});
|
|
503
501
|
this.transport = streamableTransport;
|
|
504
502
|
this.log("debug", "Successfully connected using Streamable HTTP transport.");
|
|
@@ -1580,7 +1578,7 @@ To fix this you have three different options:
|
|
|
1580
1578
|
}
|
|
1581
1579
|
};
|
|
1582
1580
|
|
|
1583
|
-
// ../../node_modules/.pnpm/hono@4.10.
|
|
1581
|
+
// ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/stream.js
|
|
1584
1582
|
var StreamingApi = class {
|
|
1585
1583
|
writer;
|
|
1586
1584
|
encoder;
|
|
@@ -1647,7 +1645,7 @@ var StreamingApi = class {
|
|
|
1647
1645
|
}
|
|
1648
1646
|
};
|
|
1649
1647
|
|
|
1650
|
-
// ../../node_modules/.pnpm/hono@4.10.
|
|
1648
|
+
// ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/helper/streaming/utils.js
|
|
1651
1649
|
var isOldBunVersion = () => {
|
|
1652
1650
|
const version = typeof Bun !== "undefined" ? Bun.version : void 0;
|
|
1653
1651
|
if (version === void 0) {
|
|
@@ -1658,7 +1656,7 @@ var isOldBunVersion = () => {
|
|
|
1658
1656
|
return result;
|
|
1659
1657
|
};
|
|
1660
1658
|
|
|
1661
|
-
// ../../node_modules/.pnpm/hono@4.10.
|
|
1659
|
+
// ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/html.js
|
|
1662
1660
|
var HtmlEscapedCallbackPhase = {
|
|
1663
1661
|
Stringify: 1};
|
|
1664
1662
|
var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
|
|
@@ -1689,7 +1687,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
1689
1687
|
}
|
|
1690
1688
|
};
|
|
1691
1689
|
|
|
1692
|
-
// ../../node_modules/.pnpm/hono@4.10.
|
|
1690
|
+
// ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/helper/streaming/sse.js
|
|
1693
1691
|
var SSEStreamingApi = class extends StreamingApi {
|
|
1694
1692
|
constructor(writable, readable) {
|
|
1695
1693
|
super(writable, readable);
|
|
@@ -2568,7 +2566,14 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
|
|
|
2568
2566
|
`Executing agent tool '${agentToolName}' for agent '${agent.name}' with message: "${inputData.message}"`
|
|
2569
2567
|
);
|
|
2570
2568
|
try {
|
|
2571
|
-
const
|
|
2569
|
+
const proxiedContext = context?.requestContext || new RequestContext();
|
|
2570
|
+
if (context?.mcp?.extra) {
|
|
2571
|
+
proxiedContext.set("mcp.extra", context.mcp.extra);
|
|
2572
|
+
}
|
|
2573
|
+
const response = await agent.generate(inputData.message, {
|
|
2574
|
+
...context ?? {},
|
|
2575
|
+
requestContext: proxiedContext
|
|
2576
|
+
});
|
|
2572
2577
|
return response;
|
|
2573
2578
|
} catch (error) {
|
|
2574
2579
|
this.logger.error(`Error executing agent tool '${agentToolName}' for agent '${agent.name}':`, error);
|