@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/mcp",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -783,6 +783,15 @@ class DefaultMCPClient implements MCPClient {
783
783
 
784
784
  private async onRequestMessage(request: JSONRPCRequest): Promise<void> {
785
785
  try {
786
+ if (request.method === 'ping') {
787
+ await this.transport.send({
788
+ jsonrpc: '2.0',
789
+ id: request.id,
790
+ result: {},
791
+ });
792
+ return;
793
+ }
794
+
786
795
  if (request.method !== 'elicitation/create') {
787
796
  await this.transport.send({
788
797
  jsonrpc: '2.0',
package/src/tool/oauth.ts CHANGED
@@ -668,7 +668,12 @@ export async function exchangeAuthorization(
668
668
  });
669
669
 
670
670
  if (addClientAuthentication) {
671
- addClientAuthentication(headers, params, authorizationServerUrl, metadata);
671
+ await addClientAuthentication(
672
+ headers,
673
+ params,
674
+ authorizationServerUrl,
675
+ metadata,
676
+ );
672
677
  } else {
673
678
  const supportedMethods =
674
679
  metadata?.token_endpoint_auth_methods_supported ?? [];
@@ -755,7 +760,12 @@ export async function refreshAuthorization(
755
760
  });
756
761
 
757
762
  if (addClientAuthentication) {
758
- addClientAuthentication(headers, params, authorizationServerUrl, metadata);
763
+ await addClientAuthentication(
764
+ headers,
765
+ params,
766
+ authorizationServerUrl,
767
+ metadata,
768
+ );
759
769
  } else {
760
770
  const supportedMethods =
761
771
  metadata?.token_endpoint_auth_methods_supported ?? [];