@mastra/mcp 2.1.2 → 2.2.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/dist/client/client.d.ts +4 -1
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +12 -1
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types.d.ts +2 -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 +17 -0
- package/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -23225,6 +23225,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
23225
23225
|
sigTermHandler;
|
|
23226
23226
|
sigHupHandler;
|
|
23227
23227
|
serverInstructions;
|
|
23228
|
+
serverImplementation;
|
|
23228
23229
|
/** The verdict of the last successful probe, reused so reconnects skip it. */
|
|
23229
23230
|
priorDiscovery;
|
|
23230
23231
|
requireToolApproval;
|
|
@@ -23514,6 +23515,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
23514
23515
|
else if (url) await this.connectHttp(url);
|
|
23515
23516
|
else throw new Error("Server configuration must include either a command or a url.");
|
|
23516
23517
|
this.serverInstructions = this.client.getInstructions();
|
|
23518
|
+
this.serverImplementation = this.client.getServerVersion();
|
|
23517
23519
|
this.rememberNegotiation();
|
|
23518
23520
|
if (this.hasSubscriptionInterest()) try {
|
|
23519
23521
|
await this.enqueueSubscriptionUpdate(() => this.replaceSubscriptionStream());
|
|
@@ -23531,6 +23533,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
23531
23533
|
this.transport = void 0;
|
|
23532
23534
|
if (this.isConnected === connectionPromise) this.isConnected = null;
|
|
23533
23535
|
this.serverInstructions = void 0;
|
|
23536
|
+
this.serverImplementation = void 0;
|
|
23534
23537
|
this.subscriptionStream = void 0;
|
|
23535
23538
|
if (staleTransport) {
|
|
23536
23539
|
this.severClientTransportLink(staleTransport);
|
|
@@ -23600,6 +23603,10 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
23600
23603
|
get instructions() {
|
|
23601
23604
|
return this.serverInstructions;
|
|
23602
23605
|
}
|
|
23606
|
+
/** The identity (`serverInfo`) the server announced on connect; `undefined` until connected or if the server announced none. */
|
|
23607
|
+
get serverInfo() {
|
|
23608
|
+
return this.serverImplementation;
|
|
23609
|
+
}
|
|
23603
23610
|
/** The protocol revision negotiated with the server; `undefined` until connected. */
|
|
23604
23611
|
get negotiatedProtocolVersion() {
|
|
23605
23612
|
return this.client.getNegotiatedProtocolVersion();
|
|
@@ -23649,6 +23656,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
23649
23656
|
this.transport = void 0;
|
|
23650
23657
|
this.isConnected = null;
|
|
23651
23658
|
this.serverInstructions = void 0;
|
|
23659
|
+
this.serverImplementation = void 0;
|
|
23652
23660
|
this.unregisterProcessHooks();
|
|
23653
23661
|
}
|
|
23654
23662
|
}
|
|
@@ -23677,6 +23685,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
23677
23685
|
this.transport = void 0;
|
|
23678
23686
|
this.isConnected = null;
|
|
23679
23687
|
this.serverInstructions = void 0;
|
|
23688
|
+
this.serverImplementation = void 0;
|
|
23680
23689
|
}
|
|
23681
23690
|
await this.connect();
|
|
23682
23691
|
this.log("debug", "Successfully reconnected to MCP server");
|
|
@@ -25525,6 +25534,21 @@ onListChanged: async (serverName, handler) => {
|
|
|
25525
25534
|
return instructions;
|
|
25526
25535
|
}
|
|
25527
25536
|
/**
|
|
25537
|
+
* Returns the identity each connected MCP server announced when the
|
|
25538
|
+
* connection was established (`serverInfo`: name, version, and optionally
|
|
25539
|
+
* title, description, websiteUrl, and icons), keyed by server name.
|
|
25540
|
+
*
|
|
25541
|
+
* A server's entry is `undefined` if it has not connected yet, or if it
|
|
25542
|
+
* connected over the 2026-07-28 revision without announcing an identity, so
|
|
25543
|
+
* don't use this to check connection state. Icon and website URLs come from
|
|
25544
|
+
* the remote server and are not validated.
|
|
25545
|
+
*/
|
|
25546
|
+
getServerInfo() {
|
|
25547
|
+
const info = {};
|
|
25548
|
+
for (const serverName of Object.keys(this.serverConfigs)) info[serverName] = this.mcpClientsById.get(serverName)?.serverInfo;
|
|
25549
|
+
return info;
|
|
25550
|
+
}
|
|
25551
|
+
/**
|
|
25528
25552
|
* The protocol revision negotiated with each configured server, keyed by
|
|
25529
25553
|
* server name. Servers that have not connected yet return `undefined`.
|
|
25530
25554
|
*/
|