@ai-sdk/mcp 1.0.44 → 1.0.46

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,17 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 1.0.46
4
+
5
+ ### Patch Changes
6
+
7
+ - 1f817db: fix(mcp): await addClientAuthentication in token exchange and refresh
8
+
9
+ ## 1.0.45
10
+
11
+ ### Patch Changes
12
+
13
+ - ec5fceb: fix(mcp): respond to ping requests with an empty result per JSON-RPC spec (closes #6282)
14
+
3
15
  ## 1.0.44
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -842,7 +842,12 @@ async function exchangeAuthorization(authorizationServerUrl, {
842
842
  redirect_uri: String(redirectUri)
843
843
  });
844
844
  if (addClientAuthentication) {
845
- addClientAuthentication(headers, params, authorizationServerUrl, metadata);
845
+ await addClientAuthentication(
846
+ headers,
847
+ params,
848
+ authorizationServerUrl,
849
+ metadata
850
+ );
846
851
  } else {
847
852
  const supportedMethods = (_a3 = metadata == null ? void 0 : metadata.token_endpoint_auth_methods_supported) != null ? _a3 : [];
848
853
  const authMethod = selectClientAuthMethod(
@@ -894,7 +899,12 @@ async function refreshAuthorization(authorizationServerUrl, {
894
899
  refresh_token: refreshToken
895
900
  });
896
901
  if (addClientAuthentication) {
897
- addClientAuthentication(headers, params, authorizationServerUrl, metadata);
902
+ await addClientAuthentication(
903
+ headers,
904
+ params,
905
+ authorizationServerUrl,
906
+ metadata
907
+ );
898
908
  } else {
899
909
  const supportedMethods = (_a3 = metadata == null ? void 0 : metadata.token_endpoint_auth_methods_supported) != null ? _a3 : [];
900
910
  const authMethod = selectClientAuthMethod(
@@ -2138,6 +2148,14 @@ var DefaultMCPClient = class {
2138
2148
  }
2139
2149
  async onRequestMessage(request) {
2140
2150
  try {
2151
+ if (request.method === "ping") {
2152
+ await this.transport.send({
2153
+ jsonrpc: "2.0",
2154
+ id: request.id,
2155
+ result: {}
2156
+ });
2157
+ return;
2158
+ }
2141
2159
  if (request.method !== "elicitation/create") {
2142
2160
  await this.transport.send({
2143
2161
  jsonrpc: "2.0",