@mastra/mcp 1.0.0-beta.0 → 1.0.0-beta.1

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @mastra/mcp
2
2
 
3
+ ## 1.0.0-beta.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix MCP auth context propagation to tools called by agents ([#9948](https://github.com/mastra-ai/mastra/pull/9948))
8
+
9
+ Fixes the issue where MCP authentication context wasn't being passed to tools when called by agents. Tools can now access MCP context via `context.requestContext.get('mcp.extra')` when invoked via agents.
10
+
11
+ - Updated dependencies [[`465ac05`](https://github.com/mastra-ai/mastra/commit/465ac0526a91d175542091c675181f1a96c98c46)]:
12
+ - @mastra/core@1.0.0-beta.2
13
+
3
14
  ## 1.0.0-beta.0
4
15
 
5
16
  ### Major Changes
package/dist/index.cjs CHANGED
@@ -2575,7 +2575,14 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
2575
2575
  `Executing agent tool '${agentToolName}' for agent '${agent.name}' with message: "${inputData.message}"`
2576
2576
  );
2577
2577
  try {
2578
- const response = await agent.generate(inputData.message, context);
2578
+ const proxiedContext = context?.requestContext || new requestContext.RequestContext();
2579
+ if (context?.mcp?.extra) {
2580
+ proxiedContext.set("mcp.extra", context.mcp.extra);
2581
+ }
2582
+ const response = await agent.generate(inputData.message, {
2583
+ ...context ?? {},
2584
+ requestContext: proxiedContext
2585
+ });
2579
2586
  return response;
2580
2587
  } catch (error) {
2581
2588
  this.logger.error(`Error executing agent tool '${agentToolName}' for agent '${agent.name}':`, error);