mcp-remote 0.0.5 → 0.0.6
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/README.md +1 -5
- package/dist/react/index.js +32 -19
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -11,10 +11,7 @@ E.g: Claude Desktop or Windsurf
|
|
|
11
11
|
"mcpServers": {
|
|
12
12
|
"remote-example": {
|
|
13
13
|
"command": "npx",
|
|
14
|
-
"args": [
|
|
15
|
-
"mcp-remote",
|
|
16
|
-
"https://remote.mcp.server/sse"
|
|
17
|
-
]
|
|
14
|
+
"args": ["mcp-remote", "https://remote.mcp.server/sse"]
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
}
|
|
@@ -23,4 +20,3 @@ E.g: Claude Desktop or Windsurf
|
|
|
23
20
|
Cursor:
|
|
24
21
|
|
|
25
22
|

|
|
26
|
-
|
package/dist/react/index.js
CHANGED
|
@@ -300,11 +300,6 @@ function useMcp(options) {
|
|
|
300
300
|
callbackUrl
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
-
if (!metadataRef.current) {
|
|
304
|
-
addLog("info", "Discovering OAuth metadata...");
|
|
305
|
-
metadataRef.current = await discoverOAuthMetadata(url);
|
|
306
|
-
addLog("debug", `OAuth metadata: ${metadataRef.current ? "Found" : "Not available"}`);
|
|
307
|
-
}
|
|
308
303
|
clientRef.current = new Client(
|
|
309
304
|
{
|
|
310
305
|
name: clientConfig.name || "mcp-react-client",
|
|
@@ -316,7 +311,6 @@ function useMcp(options) {
|
|
|
316
311
|
}
|
|
317
312
|
}
|
|
318
313
|
);
|
|
319
|
-
const tokens = await authProviderRef.current.tokens();
|
|
320
314
|
setState("connecting");
|
|
321
315
|
addLog("info", "Creating transport...");
|
|
322
316
|
const serverUrl = new URL(url);
|
|
@@ -330,13 +324,7 @@ function useMcp(options) {
|
|
|
330
324
|
transportRef.current.onerror = (err) => {
|
|
331
325
|
addLog("error", `Transport error: ${err.message}`);
|
|
332
326
|
if (err.message.includes("Unauthorized")) {
|
|
333
|
-
|
|
334
|
-
handleAuthentication().catch((authErr) => {
|
|
335
|
-
addLog("error", `Authentication error: ${authErr.message}`);
|
|
336
|
-
setState("failed");
|
|
337
|
-
setError(`Authentication failed: ${authErr.message}`);
|
|
338
|
-
connectingRef.current = false;
|
|
339
|
-
});
|
|
327
|
+
discoverOAuthAndAuthenticate(err);
|
|
340
328
|
} else {
|
|
341
329
|
setState("failed");
|
|
342
330
|
setError(`Connection error: ${err.message}`);
|
|
@@ -353,14 +341,35 @@ function useMcp(options) {
|
|
|
353
341
|
}, delay);
|
|
354
342
|
}
|
|
355
343
|
};
|
|
344
|
+
const discoverOAuthAndAuthenticate = async (error2) => {
|
|
345
|
+
try {
|
|
346
|
+
if (!metadataRef.current) {
|
|
347
|
+
addLog("info", "Discovering OAuth metadata...");
|
|
348
|
+
metadataRef.current = await discoverOAuthMetadata(url);
|
|
349
|
+
addLog("debug", `OAuth metadata: ${metadataRef.current ? "Found" : "Not available"}`);
|
|
350
|
+
}
|
|
351
|
+
if (metadataRef.current) {
|
|
352
|
+
setState("authenticating");
|
|
353
|
+
await handleAuthentication();
|
|
354
|
+
return connect();
|
|
355
|
+
} else {
|
|
356
|
+
setState("failed");
|
|
357
|
+
setError(`Authentication required but no OAuth metadata found: ${error2.message}`);
|
|
358
|
+
connectingRef.current = false;
|
|
359
|
+
}
|
|
360
|
+
} catch (oauthErr) {
|
|
361
|
+
addLog("error", `OAuth discovery error: ${oauthErr instanceof Error ? oauthErr.message : String(oauthErr)}`);
|
|
362
|
+
setState("failed");
|
|
363
|
+
setError(`Authentication setup failed: ${oauthErr instanceof Error ? oauthErr.message : String(oauthErr)}`);
|
|
364
|
+
connectingRef.current = false;
|
|
365
|
+
}
|
|
366
|
+
};
|
|
356
367
|
try {
|
|
357
368
|
addLog("info", "Starting transport...");
|
|
358
369
|
} catch (err) {
|
|
359
370
|
addLog("error", `Transport start error: ${err instanceof Error ? err.message : String(err)}`);
|
|
360
371
|
if (err instanceof Error && err.message.includes("Unauthorized")) {
|
|
361
|
-
|
|
362
|
-
await handleAuthentication();
|
|
363
|
-
return connect();
|
|
372
|
+
await discoverOAuthAndAuthenticate(err);
|
|
364
373
|
} else {
|
|
365
374
|
setState("failed");
|
|
366
375
|
setError(`Connection error: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -387,9 +396,13 @@ function useMcp(options) {
|
|
|
387
396
|
}
|
|
388
397
|
} catch (connectErr) {
|
|
389
398
|
addLog("error", `Client connect error: ${connectErr instanceof Error ? connectErr.message : String(connectErr)}`);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
399
|
+
if (connectErr instanceof Error && connectErr.message.includes("Unauthorized")) {
|
|
400
|
+
await discoverOAuthAndAuthenticate(connectErr);
|
|
401
|
+
} else {
|
|
402
|
+
setState("failed");
|
|
403
|
+
setError(`Connection error: ${connectErr instanceof Error ? connectErr.message : String(connectErr)}`);
|
|
404
|
+
connectingRef.current = false;
|
|
405
|
+
}
|
|
393
406
|
}
|
|
394
407
|
} catch (err) {
|
|
395
408
|
addLog("error", `Unexpected error: ${err instanceof Error ? err.message : String(err)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-remote",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mcp-remote": "dist/cli/proxy.js"
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "tsup"
|
|
21
|
+
"build": "tsup",
|
|
22
|
+
"check": "prettier --check . && tsc"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"express": "^4.21.2",
|