@mastra/mcp 1.7.1-alpha.0 → 1.8.0-alpha.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/dist/index.js CHANGED
@@ -965,18 +965,25 @@ var InternalMastraMCPClient = class extends MastraBase {
965
965
  try {
966
966
  let requireApproval;
967
967
  let needsApprovalFn;
968
+ const annotations = tool.annotations;
968
969
  if (typeof this.requireToolApproval === "function") {
969
970
  const serverApprovalFn = this.requireToolApproval;
970
971
  const toolName = tool.name;
971
972
  requireApproval = true;
972
973
  needsApprovalFn = (args, ctx = {}) => {
973
- return serverApprovalFn({ toolName, args, ...ctx });
974
+ return serverApprovalFn({ toolName, args, ...ctx, annotations });
974
975
  };
975
976
  } else if (this.requireToolApproval === true) {
976
977
  requireApproval = true;
977
978
  }
978
979
  const rawMeta = tool._meta;
979
980
  const toolMeta = rawMeta ? this.stampServerIdInMeta(rawMeta) : void 0;
981
+ const mcpToolProps = toolMeta || annotations ? {
982
+ mcp: {
983
+ ...toolMeta ? { _meta: toolMeta } : {},
984
+ ...annotations ? { annotations } : {}
985
+ }
986
+ } : {};
980
987
  const mastraTool = createTool({
981
988
  id: `${this.name}_${tool.name}`,
982
989
  description: tool.description || "",
@@ -984,7 +991,9 @@ var InternalMastraMCPClient = class extends MastraBase {
984
991
  strict: getMastraToolStrictMeta(toolMeta),
985
992
  // Preserve the full _meta from the remote MCP server (including ui.resourceUri
986
993
  // for MCP Apps) so downstream consumers (e.g. Studio) can detect app tools.
987
- ...toolMeta ? { mcp: { _meta: toolMeta } } : {},
994
+ // Also propagate MCP tool annotations so listTools() / listToolsets() consumers
995
+ // can read them via `tool.mcp.annotations`.
996
+ ...mcpToolProps,
988
997
  // Don't pass outputSchema to createTool — the MCP SDK's Client.callTool()
989
998
  // already validates structuredContent against the tool's outputSchema using AJV.
990
999
  // Passing it here causes Zod to strip unrecognized keys from the CallToolResult
@@ -2240,12 +2249,6 @@ var MCPOAuthClientProvider = class {
2240
2249
  }
2241
2250
  return verifier;
2242
2251
  }
2243
- /**
2244
- * Optional: Custom client authentication for token requests.
2245
- * Uses default behavior if not implemented.
2246
- */
2247
- async addClientAuthentication(_headers, _params, _url, _metadata) {
2248
- }
2249
2252
  /**
2250
2253
  * Invalidate credentials when server indicates they're no longer valid.
2251
2254
  */