@mcp-use/inspector 0.8.2 → 0.9.0-canary.1
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/cli.js +29 -0
- package/dist/client/assets/{browser-DrFZpsDy.js → browser-D1dhX_Kd.js} +5 -5
- package/dist/client/assets/{chunk-VL2OQCWN-BXe1iwaF.js → chunk-VL2OQCWN-CX6x4kxU.js} +1 -1
- package/dist/client/assets/{display-YIYC6WJE-CgdZXpyl.js → display-YIYC6WJE-DkdhQKHj.js} +1 -1
- package/dist/client/assets/{embeddings-DoYT4G8J.js → embeddings-D88gGGgZ.js} +1 -1
- package/dist/client/assets/{index-BUncxtIr.js → index-B6TgCktd.js} +582 -282
- package/dist/client/assets/{index-D_EM3lCY.js → index-BHQ3xRbt.js} +3 -3
- package/dist/client/assets/{index-CwF__a_n.css → index-Br7cLVs6.css} +29 -0
- package/dist/client/assets/{index-Dh5c60Cf.js → index-C74kq9On.js} +2 -2
- package/dist/client/assets/{index-DaswSx18.js → index-DQq5OBLm.js} +4 -4
- package/dist/client/assets/{index-7yA2hvxa.js → index-DsQI4y0R.js} +4 -4
- package/dist/client/assets/{winston-EZ7J9pWD.js → winston-BlqNOObA.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/server/{chunk-26WTIZ4S.js → chunk-LNMQYGXR.js} +29 -0
- package/dist/server/{chunk-6ZFXPXO4.js → chunk-PBQJCPZX.js} +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/middleware.js +2 -2
- package/dist/server/server.js +1 -1
- package/dist/server/shared-static.d.ts.map +1 -1
- package/dist/server/shared-static.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-BlqNOObA.js","assets/__vite-browser-external-CHS79mP1.js","assets/index-DX0TIfSM.js","assets/path-QsnVvLoj.js","assets/index-DsQI4y0R.js","assets/index-C74kq9On.js","assets/chunk-VL2OQCWN-CX6x4kxU.js","assets/embeddings-D88gGGgZ.js","assets/index-BHQ3xRbt.js","assets/index-DQq5OBLm.js","assets/browser-D1dhX_Kd.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -211,7 +211,7 @@ function loadWinstonSync() {
|
|
|
211
211
|
__name(loadWinstonSync, "loadWinstonSync");
|
|
212
212
|
async function getWinston() {
|
|
213
213
|
if (!winston) {
|
|
214
|
-
winston = await __vitePreload(() => import("./winston-
|
|
214
|
+
winston = await __vitePreload(() => import("./winston-BlqNOObA.js").then((n2) => n2.w), true ? __vite__mapDeps([0,1,2,3]) : void 0);
|
|
215
215
|
}
|
|
216
216
|
return winston;
|
|
217
217
|
}
|
|
@@ -9088,7 +9088,7 @@ function requireCompile() {
|
|
|
9088
9088
|
}
|
|
9089
9089
|
}
|
|
9090
9090
|
compile.compileSchema = compileSchema;
|
|
9091
|
-
function
|
|
9091
|
+
function resolveRef2(root, baseId, ref2) {
|
|
9092
9092
|
var _a2;
|
|
9093
9093
|
ref2 = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref2);
|
|
9094
9094
|
const schOrFunc = root.refs[ref2];
|
|
@@ -9105,7 +9105,7 @@ function requireCompile() {
|
|
|
9105
9105
|
return;
|
|
9106
9106
|
return root.refs[ref2] = inlineOrCompile.call(this, _sch);
|
|
9107
9107
|
}
|
|
9108
|
-
compile.resolveRef =
|
|
9108
|
+
compile.resolveRef = resolveRef2;
|
|
9109
9109
|
function inlineOrCompile(sch) {
|
|
9110
9110
|
if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
|
|
9111
9111
|
return sch.schema;
|
|
@@ -13860,6 +13860,22 @@ async function registerClient(authorizationServerUrl, { metadata: metadata2, cli
|
|
|
13860
13860
|
}
|
|
13861
13861
|
return OAuthClientInformationFullSchema.parse(await response.json());
|
|
13862
13862
|
}
|
|
13863
|
+
const auth$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
13864
|
+
__proto__: null,
|
|
13865
|
+
UnauthorizedError,
|
|
13866
|
+
auth,
|
|
13867
|
+
buildDiscoveryUrls,
|
|
13868
|
+
discoverAuthorizationServerMetadata,
|
|
13869
|
+
discoverOAuthProtectedResourceMetadata,
|
|
13870
|
+
exchangeAuthorization,
|
|
13871
|
+
extractWWWAuthenticateParams,
|
|
13872
|
+
parseErrorResponse,
|
|
13873
|
+
refreshAuthorization,
|
|
13874
|
+
registerClient,
|
|
13875
|
+
selectClientAuthMethod,
|
|
13876
|
+
selectResourceURL,
|
|
13877
|
+
startAuthorization
|
|
13878
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
13863
13879
|
class ParseError extends Error {
|
|
13864
13880
|
constructor(message, options) {
|
|
13865
13881
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
@@ -14831,28 +14847,6 @@ function requireBrowser() {
|
|
|
14831
14847
|
}
|
|
14832
14848
|
var browserExports = requireBrowser();
|
|
14833
14849
|
const WS = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
|
|
14834
|
-
function sanitizeUrl(raw) {
|
|
14835
|
-
const abort = () => {
|
|
14836
|
-
throw new Error(`Invalid url to pass to open(): ${raw}`);
|
|
14837
|
-
};
|
|
14838
|
-
let url;
|
|
14839
|
-
try {
|
|
14840
|
-
url = new URL(raw);
|
|
14841
|
-
} catch (_2) {
|
|
14842
|
-
abort();
|
|
14843
|
-
}
|
|
14844
|
-
if (url.protocol !== "https:" && url.protocol !== "http:") abort();
|
|
14845
|
-
if (url.hostname !== encodeURIComponent(url.hostname)) abort();
|
|
14846
|
-
if (url.username) url.username = encodeURIComponent(url.username);
|
|
14847
|
-
if (url.password) url.password = encodeURIComponent(url.password);
|
|
14848
|
-
url.pathname = url.pathname.slice(0, 1) + encodeURIComponent(url.pathname.slice(1)).replace(/%2f/ig, "/");
|
|
14849
|
-
url.search = url.search.slice(0, 1) + Array.from(url.searchParams.entries()).map(sanitizeParam).join("&");
|
|
14850
|
-
url.hash = url.hash.slice(0, 1) + encodeURIComponent(url.hash.slice(1));
|
|
14851
|
-
return url.href;
|
|
14852
|
-
}
|
|
14853
|
-
function sanitizeParam([k2, v2]) {
|
|
14854
|
-
return `${encodeURIComponent(k2)}${v2.length > 0 ? `=${encodeURIComponent(v2)}` : ""}`;
|
|
14855
|
-
}
|
|
14856
14850
|
var MCPSession = (_d = class {
|
|
14857
14851
|
connector;
|
|
14858
14852
|
autoConnect;
|
|
@@ -15244,6 +15238,7 @@ var HttpConnector = (_g = class extends BaseConnector {
|
|
|
15244
15238
|
stop: /* @__PURE__ */ __name(async () => {
|
|
15245
15239
|
if (this.streamableTransport) {
|
|
15246
15240
|
try {
|
|
15241
|
+
await this.streamableTransport.terminateSession();
|
|
15247
15242
|
await this.streamableTransport.close();
|
|
15248
15243
|
} catch (e) {
|
|
15249
15244
|
logger.warn(`Error closing Streamable HTTP transport: ${e}`);
|
|
@@ -15268,6 +15263,8 @@ var HttpConnector = (_g = class extends BaseConnector {
|
|
|
15268
15263
|
async connectWithSse(baseUrl) {
|
|
15269
15264
|
try {
|
|
15270
15265
|
this.connectionManager = new SseConnectionManager(baseUrl, {
|
|
15266
|
+
authProvider: this.opts.authProvider,
|
|
15267
|
+
// ← Pass OAuth provider to SDK (same as streamable HTTP)
|
|
15271
15268
|
requestInit: {
|
|
15272
15269
|
headers: this.headers
|
|
15273
15270
|
}
|
|
@@ -15581,7 +15578,197 @@ var WebSocketConnector = (_i = class extends BaseConnector {
|
|
|
15581
15578
|
};
|
|
15582
15579
|
}
|
|
15583
15580
|
}, __name(_i, "WebSocketConnector"), _i);
|
|
15584
|
-
var
|
|
15581
|
+
var BaseMCPClient = (_j = class {
|
|
15582
|
+
config = {};
|
|
15583
|
+
sessions = {};
|
|
15584
|
+
activeSessions = [];
|
|
15585
|
+
constructor(config) {
|
|
15586
|
+
if (config) {
|
|
15587
|
+
this.config = config;
|
|
15588
|
+
}
|
|
15589
|
+
}
|
|
15590
|
+
static fromDict(_cfg) {
|
|
15591
|
+
throw new Error("fromDict must be implemented by concrete class");
|
|
15592
|
+
}
|
|
15593
|
+
addServer(name, serverConfig) {
|
|
15594
|
+
this.config.mcpServers = this.config.mcpServers || {};
|
|
15595
|
+
this.config.mcpServers[name] = serverConfig;
|
|
15596
|
+
}
|
|
15597
|
+
removeServer(name) {
|
|
15598
|
+
if (this.config.mcpServers?.[name]) {
|
|
15599
|
+
delete this.config.mcpServers[name];
|
|
15600
|
+
this.activeSessions = this.activeSessions.filter((n2) => n2 !== name);
|
|
15601
|
+
}
|
|
15602
|
+
}
|
|
15603
|
+
getServerNames() {
|
|
15604
|
+
return Object.keys(this.config.mcpServers ?? {});
|
|
15605
|
+
}
|
|
15606
|
+
getServerConfig(name) {
|
|
15607
|
+
return this.config.mcpServers?.[name];
|
|
15608
|
+
}
|
|
15609
|
+
getConfig() {
|
|
15610
|
+
return this.config ?? {};
|
|
15611
|
+
}
|
|
15612
|
+
async createSession(serverName, autoInitialize = true) {
|
|
15613
|
+
const servers = this.config.mcpServers ?? {};
|
|
15614
|
+
if (Object.keys(servers).length === 0) {
|
|
15615
|
+
logger.warn("No MCP servers defined in config");
|
|
15616
|
+
}
|
|
15617
|
+
if (!servers[serverName]) {
|
|
15618
|
+
throw new Error(`Server '${serverName}' not found in config`);
|
|
15619
|
+
}
|
|
15620
|
+
const connector = this.createConnectorFromConfig(servers[serverName]);
|
|
15621
|
+
const session = new MCPSession(connector);
|
|
15622
|
+
if (autoInitialize) {
|
|
15623
|
+
await session.initialize();
|
|
15624
|
+
}
|
|
15625
|
+
this.sessions[serverName] = session;
|
|
15626
|
+
if (!this.activeSessions.includes(serverName)) {
|
|
15627
|
+
this.activeSessions.push(serverName);
|
|
15628
|
+
}
|
|
15629
|
+
return session;
|
|
15630
|
+
}
|
|
15631
|
+
async createAllSessions(autoInitialize = true) {
|
|
15632
|
+
const servers = this.config.mcpServers ?? {};
|
|
15633
|
+
if (Object.keys(servers).length === 0) {
|
|
15634
|
+
logger.warn("No MCP servers defined in config");
|
|
15635
|
+
}
|
|
15636
|
+
for (const name of Object.keys(servers)) {
|
|
15637
|
+
await this.createSession(name, autoInitialize);
|
|
15638
|
+
}
|
|
15639
|
+
return this.sessions;
|
|
15640
|
+
}
|
|
15641
|
+
getSession(serverName) {
|
|
15642
|
+
const session = this.sessions[serverName];
|
|
15643
|
+
if (!session) {
|
|
15644
|
+
return null;
|
|
15645
|
+
}
|
|
15646
|
+
return session;
|
|
15647
|
+
}
|
|
15648
|
+
getAllActiveSessions() {
|
|
15649
|
+
return Object.fromEntries(
|
|
15650
|
+
this.activeSessions.map((n2) => [n2, this.sessions[n2]])
|
|
15651
|
+
);
|
|
15652
|
+
}
|
|
15653
|
+
async closeSession(serverName) {
|
|
15654
|
+
const session = this.sessions[serverName];
|
|
15655
|
+
if (!session) {
|
|
15656
|
+
logger.warn(
|
|
15657
|
+
`No session exists for server ${serverName}, nothing to close`
|
|
15658
|
+
);
|
|
15659
|
+
return;
|
|
15660
|
+
}
|
|
15661
|
+
try {
|
|
15662
|
+
logger.debug(`Closing session for server ${serverName}`);
|
|
15663
|
+
await session.disconnect();
|
|
15664
|
+
} catch (e) {
|
|
15665
|
+
logger.error(`Error closing session for server '${serverName}': ${e}`);
|
|
15666
|
+
} finally {
|
|
15667
|
+
delete this.sessions[serverName];
|
|
15668
|
+
this.activeSessions = this.activeSessions.filter((n2) => n2 !== serverName);
|
|
15669
|
+
}
|
|
15670
|
+
}
|
|
15671
|
+
async closeAllSessions() {
|
|
15672
|
+
const serverNames = Object.keys(this.sessions);
|
|
15673
|
+
const errors2 = [];
|
|
15674
|
+
for (const serverName of serverNames) {
|
|
15675
|
+
try {
|
|
15676
|
+
logger.debug(`Closing session for server ${serverName}`);
|
|
15677
|
+
await this.closeSession(serverName);
|
|
15678
|
+
} catch (e) {
|
|
15679
|
+
const errorMsg = `Failed to close session for server '${serverName}': ${e}`;
|
|
15680
|
+
logger.error(errorMsg);
|
|
15681
|
+
errors2.push(errorMsg);
|
|
15682
|
+
}
|
|
15683
|
+
}
|
|
15684
|
+
if (errors2.length) {
|
|
15685
|
+
logger.error(
|
|
15686
|
+
`Encountered ${errors2.length} errors while closing sessions`
|
|
15687
|
+
);
|
|
15688
|
+
} else {
|
|
15689
|
+
logger.debug("All sessions closed successfully");
|
|
15690
|
+
}
|
|
15691
|
+
}
|
|
15692
|
+
}, __name(_j, "BaseMCPClient"), _j);
|
|
15693
|
+
var BrowserMCPClient = (_k = class extends BaseMCPClient {
|
|
15694
|
+
constructor(config) {
|
|
15695
|
+
super(config);
|
|
15696
|
+
}
|
|
15697
|
+
static fromDict(cfg) {
|
|
15698
|
+
return new _k(cfg);
|
|
15699
|
+
}
|
|
15700
|
+
/**
|
|
15701
|
+
* Create a connector from server configuration (Browser version)
|
|
15702
|
+
* Supports HTTP and WebSocket connectors only
|
|
15703
|
+
*/
|
|
15704
|
+
createConnectorFromConfig(serverConfig) {
|
|
15705
|
+
const {
|
|
15706
|
+
url,
|
|
15707
|
+
transport,
|
|
15708
|
+
headers,
|
|
15709
|
+
authToken,
|
|
15710
|
+
authProvider,
|
|
15711
|
+
wrapTransport,
|
|
15712
|
+
clientOptions,
|
|
15713
|
+
samplingCallback
|
|
15714
|
+
} = serverConfig;
|
|
15715
|
+
if (!url) {
|
|
15716
|
+
throw new Error("Server URL is required");
|
|
15717
|
+
}
|
|
15718
|
+
const connectorOptions = {
|
|
15719
|
+
headers,
|
|
15720
|
+
authToken,
|
|
15721
|
+
authProvider,
|
|
15722
|
+
// ← Pass OAuth provider to connector
|
|
15723
|
+
wrapTransport,
|
|
15724
|
+
// ← Pass transport wrapper if provided
|
|
15725
|
+
clientOptions,
|
|
15726
|
+
// ← Pass client options (capabilities, etc.) to connector
|
|
15727
|
+
samplingCallback
|
|
15728
|
+
// ← Pass sampling callback to connector
|
|
15729
|
+
};
|
|
15730
|
+
if (clientOptions) {
|
|
15731
|
+
console.log(
|
|
15732
|
+
"[BrowserMCPClient] Passing clientOptions to connector:",
|
|
15733
|
+
JSON.stringify(clientOptions, null, 2)
|
|
15734
|
+
);
|
|
15735
|
+
} else {
|
|
15736
|
+
console.warn(
|
|
15737
|
+
"[BrowserMCPClient] No clientOptions provided to connector!"
|
|
15738
|
+
);
|
|
15739
|
+
}
|
|
15740
|
+
if (transport === "websocket" || url.startsWith("ws://") || url.startsWith("wss://")) {
|
|
15741
|
+
return new WebSocketConnector(url, connectorOptions);
|
|
15742
|
+
} else if (transport === "http" || url.startsWith("http://") || url.startsWith("https://")) {
|
|
15743
|
+
return new HttpConnector(url, connectorOptions);
|
|
15744
|
+
} else {
|
|
15745
|
+
return new HttpConnector(url, connectorOptions);
|
|
15746
|
+
}
|
|
15747
|
+
}
|
|
15748
|
+
}, __name(_k, "BrowserMCPClient"), _k);
|
|
15749
|
+
function sanitizeUrl(raw) {
|
|
15750
|
+
const abort = () => {
|
|
15751
|
+
throw new Error(`Invalid url to pass to open(): ${raw}`);
|
|
15752
|
+
};
|
|
15753
|
+
let url;
|
|
15754
|
+
try {
|
|
15755
|
+
url = new URL(raw);
|
|
15756
|
+
} catch (_2) {
|
|
15757
|
+
abort();
|
|
15758
|
+
}
|
|
15759
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") abort();
|
|
15760
|
+
if (url.hostname !== encodeURIComponent(url.hostname)) abort();
|
|
15761
|
+
if (url.username) url.username = encodeURIComponent(url.username);
|
|
15762
|
+
if (url.password) url.password = encodeURIComponent(url.password);
|
|
15763
|
+
url.pathname = url.pathname.slice(0, 1) + encodeURIComponent(url.pathname.slice(1)).replace(/%2f/ig, "/");
|
|
15764
|
+
url.search = url.search.slice(0, 1) + Array.from(url.searchParams.entries()).map(sanitizeParam).join("&");
|
|
15765
|
+
url.hash = url.hash.slice(0, 1) + encodeURIComponent(url.hash.slice(1));
|
|
15766
|
+
return url.href;
|
|
15767
|
+
}
|
|
15768
|
+
function sanitizeParam([k2, v2]) {
|
|
15769
|
+
return `${encodeURIComponent(k2)}${v2.length > 0 ? `=${encodeURIComponent(v2)}` : ""}`;
|
|
15770
|
+
}
|
|
15771
|
+
var BrowserOAuthClientProvider = (_l = class {
|
|
15585
15772
|
serverUrl;
|
|
15586
15773
|
storageKeyPrefix;
|
|
15587
15774
|
serverUrlHash;
|
|
@@ -15589,6 +15776,7 @@ var BrowserOAuthClientProvider = (_j = class {
|
|
|
15589
15776
|
clientUri;
|
|
15590
15777
|
callbackUrl;
|
|
15591
15778
|
preventAutoAuth;
|
|
15779
|
+
useRedirectFlow;
|
|
15592
15780
|
onPopupWindow;
|
|
15593
15781
|
constructor(serverUrl, options = {}) {
|
|
15594
15782
|
this.serverUrl = serverUrl;
|
|
@@ -15600,6 +15788,7 @@ var BrowserOAuthClientProvider = (_j = class {
|
|
|
15600
15788
|
options.callbackUrl || (typeof window !== "undefined" ? new URL("/oauth/callback", window.location.origin).toString() : "/oauth/callback")
|
|
15601
15789
|
);
|
|
15602
15790
|
this.preventAutoAuth = options.preventAutoAuth;
|
|
15791
|
+
this.useRedirectFlow = options.useRedirectFlow;
|
|
15603
15792
|
this.onPopupWindow = options.onPopupWindow;
|
|
15604
15793
|
}
|
|
15605
15794
|
// --- SDK Interface Methods ---
|
|
@@ -15691,7 +15880,11 @@ var BrowserOAuthClientProvider = (_j = class {
|
|
|
15691
15880
|
clientName: this.clientName,
|
|
15692
15881
|
clientUri: this.clientUri,
|
|
15693
15882
|
callbackUrl: this.callbackUrl
|
|
15694
|
-
}
|
|
15883
|
+
},
|
|
15884
|
+
// Store flow type so callback knows how to handle the response
|
|
15885
|
+
flowType: this.useRedirectFlow ? "redirect" : "popup",
|
|
15886
|
+
// Store current URL for redirect flow so we can return to it
|
|
15887
|
+
returnUrl: this.useRedirectFlow && typeof window !== "undefined" ? window.location.href : void 0
|
|
15695
15888
|
};
|
|
15696
15889
|
localStorage.setItem(stateKey, JSON.stringify(stateData));
|
|
15697
15890
|
authorizationUrl.searchParams.set("state", state);
|
|
@@ -15706,8 +15899,20 @@ var BrowserOAuthClientProvider = (_j = class {
|
|
|
15706
15899
|
* @param authorizationUrl The fully constructed authorization URL from the SDK.
|
|
15707
15900
|
*/
|
|
15708
15901
|
async redirectToAuthorization(authorizationUrl) {
|
|
15709
|
-
if (this.preventAutoAuth) return;
|
|
15710
15902
|
const sanitizedAuthUrl = await this.prepareAuthorizationUrl(authorizationUrl);
|
|
15903
|
+
if (this.preventAutoAuth) {
|
|
15904
|
+
console.info(
|
|
15905
|
+
`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`
|
|
15906
|
+
);
|
|
15907
|
+
return;
|
|
15908
|
+
}
|
|
15909
|
+
if (this.useRedirectFlow) {
|
|
15910
|
+
console.info(
|
|
15911
|
+
`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`
|
|
15912
|
+
);
|
|
15913
|
+
window.location.href = sanitizedAuthUrl;
|
|
15914
|
+
return;
|
|
15915
|
+
}
|
|
15711
15916
|
const popupFeatures = "width=600,height=700,resizable=yes,scrollbars=yes,status=yes";
|
|
15712
15917
|
try {
|
|
15713
15918
|
const popup = window.open(
|
|
@@ -15789,7 +15994,7 @@ var BrowserOAuthClientProvider = (_j = class {
|
|
|
15789
15994
|
getKey(keySuffix) {
|
|
15790
15995
|
return `${this.storageKeyPrefix}_${this.serverUrlHash}_${keySuffix}`;
|
|
15791
15996
|
}
|
|
15792
|
-
}, __name(
|
|
15997
|
+
}, __name(_l, "BrowserOAuthClientProvider"), _l);
|
|
15793
15998
|
async function onMcpAuthorization() {
|
|
15794
15999
|
const queryParams = new URLSearchParams(window.location.search);
|
|
15795
16000
|
const code2 = queryParams.get("code");
|
|
@@ -15854,24 +16059,31 @@ async function onMcpAuthorization() {
|
|
|
15854
16059
|
authorizationCode: code2
|
|
15855
16060
|
});
|
|
15856
16061
|
if (authResult === "AUTHORIZED") {
|
|
15857
|
-
console.log(
|
|
15858
|
-
|
|
15859
|
-
)
|
|
15860
|
-
|
|
16062
|
+
console.log(`${logPrefix} Authorization successful via SDK auth().`);
|
|
16063
|
+
const isRedirectFlow = storedStateData.flowType === "redirect";
|
|
16064
|
+
if (isRedirectFlow && storedStateData.returnUrl) {
|
|
16065
|
+
console.log(
|
|
16066
|
+
`${logPrefix} Redirect flow complete. Returning to: ${storedStateData.returnUrl}`
|
|
16067
|
+
);
|
|
16068
|
+
localStorage.removeItem(stateKey);
|
|
16069
|
+
window.location.href = storedStateData.returnUrl;
|
|
16070
|
+
} else if (window.opener && !window.opener.closed) {
|
|
16071
|
+
console.log(`${logPrefix} Popup flow complete. Notifying opener...`);
|
|
15861
16072
|
window.opener.postMessage(
|
|
15862
16073
|
{ type: "mcp_auth_callback", success: true },
|
|
15863
16074
|
window.location.origin
|
|
15864
16075
|
);
|
|
16076
|
+
localStorage.removeItem(stateKey);
|
|
15865
16077
|
window.close();
|
|
15866
16078
|
} else {
|
|
15867
16079
|
console.warn(
|
|
15868
|
-
`${logPrefix} No opener window detected. Redirecting to root.`
|
|
16080
|
+
`${logPrefix} No opener window or return URL detected. Redirecting to root.`
|
|
15869
16081
|
);
|
|
16082
|
+
localStorage.removeItem(stateKey);
|
|
15870
16083
|
const pathParts = window.location.pathname.split("/").filter(Boolean);
|
|
15871
16084
|
const basePath = pathParts.length > 0 && pathParts[pathParts.length - 1] === "callback" ? "/" + pathParts.slice(0, -2).join("/") : "/";
|
|
15872
16085
|
window.location.href = basePath || "/";
|
|
15873
16086
|
}
|
|
15874
|
-
localStorage.removeItem(stateKey);
|
|
15875
16087
|
} else {
|
|
15876
16088
|
console.warn(
|
|
15877
16089
|
`${logPrefix} SDK auth() returned unexpected status: ${authResult}`
|
|
@@ -15916,174 +16128,6 @@ async function onMcpAuthorization() {
|
|
|
15916
16128
|
}
|
|
15917
16129
|
}
|
|
15918
16130
|
__name(onMcpAuthorization, "onMcpAuthorization");
|
|
15919
|
-
var BaseMCPClient = (_k = class {
|
|
15920
|
-
config = {};
|
|
15921
|
-
sessions = {};
|
|
15922
|
-
activeSessions = [];
|
|
15923
|
-
constructor(config) {
|
|
15924
|
-
if (config) {
|
|
15925
|
-
this.config = config;
|
|
15926
|
-
}
|
|
15927
|
-
}
|
|
15928
|
-
static fromDict(_cfg) {
|
|
15929
|
-
throw new Error("fromDict must be implemented by concrete class");
|
|
15930
|
-
}
|
|
15931
|
-
addServer(name, serverConfig) {
|
|
15932
|
-
this.config.mcpServers = this.config.mcpServers || {};
|
|
15933
|
-
this.config.mcpServers[name] = serverConfig;
|
|
15934
|
-
}
|
|
15935
|
-
removeServer(name) {
|
|
15936
|
-
if (this.config.mcpServers?.[name]) {
|
|
15937
|
-
delete this.config.mcpServers[name];
|
|
15938
|
-
this.activeSessions = this.activeSessions.filter((n2) => n2 !== name);
|
|
15939
|
-
}
|
|
15940
|
-
}
|
|
15941
|
-
getServerNames() {
|
|
15942
|
-
return Object.keys(this.config.mcpServers ?? {});
|
|
15943
|
-
}
|
|
15944
|
-
getServerConfig(name) {
|
|
15945
|
-
return this.config.mcpServers?.[name];
|
|
15946
|
-
}
|
|
15947
|
-
getConfig() {
|
|
15948
|
-
return this.config ?? {};
|
|
15949
|
-
}
|
|
15950
|
-
async createSession(serverName, autoInitialize = true) {
|
|
15951
|
-
const servers = this.config.mcpServers ?? {};
|
|
15952
|
-
if (Object.keys(servers).length === 0) {
|
|
15953
|
-
logger.warn("No MCP servers defined in config");
|
|
15954
|
-
}
|
|
15955
|
-
if (!servers[serverName]) {
|
|
15956
|
-
throw new Error(`Server '${serverName}' not found in config`);
|
|
15957
|
-
}
|
|
15958
|
-
const connector = this.createConnectorFromConfig(servers[serverName]);
|
|
15959
|
-
const session = new MCPSession(connector);
|
|
15960
|
-
if (autoInitialize) {
|
|
15961
|
-
await session.initialize();
|
|
15962
|
-
}
|
|
15963
|
-
this.sessions[serverName] = session;
|
|
15964
|
-
if (!this.activeSessions.includes(serverName)) {
|
|
15965
|
-
this.activeSessions.push(serverName);
|
|
15966
|
-
}
|
|
15967
|
-
return session;
|
|
15968
|
-
}
|
|
15969
|
-
async createAllSessions(autoInitialize = true) {
|
|
15970
|
-
const servers = this.config.mcpServers ?? {};
|
|
15971
|
-
if (Object.keys(servers).length === 0) {
|
|
15972
|
-
logger.warn("No MCP servers defined in config");
|
|
15973
|
-
}
|
|
15974
|
-
for (const name of Object.keys(servers)) {
|
|
15975
|
-
await this.createSession(name, autoInitialize);
|
|
15976
|
-
}
|
|
15977
|
-
return this.sessions;
|
|
15978
|
-
}
|
|
15979
|
-
getSession(serverName) {
|
|
15980
|
-
const session = this.sessions[serverName];
|
|
15981
|
-
if (!session) {
|
|
15982
|
-
return null;
|
|
15983
|
-
}
|
|
15984
|
-
return session;
|
|
15985
|
-
}
|
|
15986
|
-
getAllActiveSessions() {
|
|
15987
|
-
return Object.fromEntries(
|
|
15988
|
-
this.activeSessions.map((n2) => [n2, this.sessions[n2]])
|
|
15989
|
-
);
|
|
15990
|
-
}
|
|
15991
|
-
async closeSession(serverName) {
|
|
15992
|
-
const session = this.sessions[serverName];
|
|
15993
|
-
if (!session) {
|
|
15994
|
-
logger.warn(
|
|
15995
|
-
`No session exists for server ${serverName}, nothing to close`
|
|
15996
|
-
);
|
|
15997
|
-
return;
|
|
15998
|
-
}
|
|
15999
|
-
try {
|
|
16000
|
-
logger.debug(`Closing session for server ${serverName}`);
|
|
16001
|
-
await session.disconnect();
|
|
16002
|
-
} catch (e) {
|
|
16003
|
-
logger.error(`Error closing session for server '${serverName}': ${e}`);
|
|
16004
|
-
} finally {
|
|
16005
|
-
delete this.sessions[serverName];
|
|
16006
|
-
this.activeSessions = this.activeSessions.filter((n2) => n2 !== serverName);
|
|
16007
|
-
}
|
|
16008
|
-
}
|
|
16009
|
-
async closeAllSessions() {
|
|
16010
|
-
const serverNames = Object.keys(this.sessions);
|
|
16011
|
-
const errors2 = [];
|
|
16012
|
-
for (const serverName of serverNames) {
|
|
16013
|
-
try {
|
|
16014
|
-
logger.debug(`Closing session for server ${serverName}`);
|
|
16015
|
-
await this.closeSession(serverName);
|
|
16016
|
-
} catch (e) {
|
|
16017
|
-
const errorMsg = `Failed to close session for server '${serverName}': ${e}`;
|
|
16018
|
-
logger.error(errorMsg);
|
|
16019
|
-
errors2.push(errorMsg);
|
|
16020
|
-
}
|
|
16021
|
-
}
|
|
16022
|
-
if (errors2.length) {
|
|
16023
|
-
logger.error(
|
|
16024
|
-
`Encountered ${errors2.length} errors while closing sessions`
|
|
16025
|
-
);
|
|
16026
|
-
} else {
|
|
16027
|
-
logger.debug("All sessions closed successfully");
|
|
16028
|
-
}
|
|
16029
|
-
}
|
|
16030
|
-
}, __name(_k, "BaseMCPClient"), _k);
|
|
16031
|
-
var BrowserMCPClient = (_l = class extends BaseMCPClient {
|
|
16032
|
-
constructor(config) {
|
|
16033
|
-
super(config);
|
|
16034
|
-
}
|
|
16035
|
-
static fromDict(cfg) {
|
|
16036
|
-
return new _l(cfg);
|
|
16037
|
-
}
|
|
16038
|
-
/**
|
|
16039
|
-
* Create a connector from server configuration (Browser version)
|
|
16040
|
-
* Supports HTTP and WebSocket connectors only
|
|
16041
|
-
*/
|
|
16042
|
-
createConnectorFromConfig(serverConfig) {
|
|
16043
|
-
const {
|
|
16044
|
-
url,
|
|
16045
|
-
transport,
|
|
16046
|
-
headers,
|
|
16047
|
-
authToken,
|
|
16048
|
-
authProvider,
|
|
16049
|
-
wrapTransport,
|
|
16050
|
-
clientOptions,
|
|
16051
|
-
samplingCallback
|
|
16052
|
-
} = serverConfig;
|
|
16053
|
-
if (!url) {
|
|
16054
|
-
throw new Error("Server URL is required");
|
|
16055
|
-
}
|
|
16056
|
-
const connectorOptions = {
|
|
16057
|
-
headers,
|
|
16058
|
-
authToken,
|
|
16059
|
-
authProvider,
|
|
16060
|
-
// ← Pass OAuth provider to connector
|
|
16061
|
-
wrapTransport,
|
|
16062
|
-
// ← Pass transport wrapper if provided
|
|
16063
|
-
clientOptions,
|
|
16064
|
-
// ← Pass client options (capabilities, etc.) to connector
|
|
16065
|
-
samplingCallback
|
|
16066
|
-
// ← Pass sampling callback to connector
|
|
16067
|
-
};
|
|
16068
|
-
if (clientOptions) {
|
|
16069
|
-
console.log(
|
|
16070
|
-
"[BrowserMCPClient] Passing clientOptions to connector:",
|
|
16071
|
-
JSON.stringify(clientOptions, null, 2)
|
|
16072
|
-
);
|
|
16073
|
-
} else {
|
|
16074
|
-
console.warn(
|
|
16075
|
-
"[BrowserMCPClient] No clientOptions provided to connector!"
|
|
16076
|
-
);
|
|
16077
|
-
}
|
|
16078
|
-
if (transport === "websocket" || url.startsWith("ws://") || url.startsWith("wss://")) {
|
|
16079
|
-
return new WebSocketConnector(url, connectorOptions);
|
|
16080
|
-
} else if (transport === "http" || url.startsWith("http://") || url.startsWith("https://")) {
|
|
16081
|
-
return new HttpConnector(url, connectorOptions);
|
|
16082
|
-
} else {
|
|
16083
|
-
return new HttpConnector(url, connectorOptions);
|
|
16084
|
-
}
|
|
16085
|
-
}
|
|
16086
|
-
}, __name(_l, "BrowserMCPClient"), _l);
|
|
16087
16131
|
var react = { exports: {} };
|
|
16088
16132
|
var react_production = {};
|
|
16089
16133
|
var hasRequiredReact_production;
|
|
@@ -18775,7 +18819,6 @@ function assert$1(condition, message) {
|
|
|
18775
18819
|
__name(assert$1, "assert");
|
|
18776
18820
|
var DEFAULT_RECONNECT_DELAY = 3e3;
|
|
18777
18821
|
var DEFAULT_RETRY_DELAY = 5e3;
|
|
18778
|
-
var AUTH_TIMEOUT = 5 * 60 * 1e3;
|
|
18779
18822
|
function useMcp(options) {
|
|
18780
18823
|
const {
|
|
18781
18824
|
url,
|
|
@@ -18793,6 +18836,9 @@ function useMcp(options) {
|
|
|
18793
18836
|
autoReconnect = DEFAULT_RECONNECT_DELAY,
|
|
18794
18837
|
transportType = "auto",
|
|
18795
18838
|
preventAutoAuth = false,
|
|
18839
|
+
// Default to false for backward compatibility (auto-trigger OAuth)
|
|
18840
|
+
useRedirectFlow = false,
|
|
18841
|
+
// Default to false for backward compatibility (use popup)
|
|
18796
18842
|
onPopupWindow,
|
|
18797
18843
|
timeout = 3e4,
|
|
18798
18844
|
// 30 seconds default for connection timeout
|
|
@@ -18918,6 +18964,7 @@ function useMcp(options) {
|
|
|
18918
18964
|
clientUri,
|
|
18919
18965
|
callbackUrl,
|
|
18920
18966
|
preventAutoAuth,
|
|
18967
|
+
useRedirectFlow,
|
|
18921
18968
|
onPopupWindow
|
|
18922
18969
|
});
|
|
18923
18970
|
addLog("debug", "BrowserOAuthClientProvider initialized in connect.");
|
|
@@ -19008,6 +19055,45 @@ function useMcp(options) {
|
|
|
19008
19055
|
} catch (err) {
|
|
19009
19056
|
const errorMessage = err?.message || String(err);
|
|
19010
19057
|
if (err.code === 401 || errorMessage.includes("401") || errorMessage.includes("Unauthorized")) {
|
|
19058
|
+
if (authProviderRef.current) {
|
|
19059
|
+
addLog(
|
|
19060
|
+
"info",
|
|
19061
|
+
"Authentication required. OAuth provider available."
|
|
19062
|
+
);
|
|
19063
|
+
try {
|
|
19064
|
+
const { auth: auth2 } = await __vitePreload(async () => {
|
|
19065
|
+
const { auth: auth3 } = await Promise.resolve().then(() => auth$1);
|
|
19066
|
+
return { auth: auth3 };
|
|
19067
|
+
}, true ? [] : void 0);
|
|
19068
|
+
const baseUrl = new URL(url).origin;
|
|
19069
|
+
auth2(authProviderRef.current, { serverUrl: baseUrl }).catch(
|
|
19070
|
+
() => {
|
|
19071
|
+
}
|
|
19072
|
+
);
|
|
19073
|
+
setTimeout(() => {
|
|
19074
|
+
if (isMountedRef.current) {
|
|
19075
|
+
const manualUrl = authProviderRef.current?.getLastAttemptedAuthUrl();
|
|
19076
|
+
if (manualUrl) {
|
|
19077
|
+
setAuthUrl(manualUrl);
|
|
19078
|
+
addLog(
|
|
19079
|
+
"info",
|
|
19080
|
+
"Manual authentication URL available:",
|
|
19081
|
+
manualUrl
|
|
19082
|
+
);
|
|
19083
|
+
} else {
|
|
19084
|
+
addLog("warn", "Could not generate authentication URL");
|
|
19085
|
+
}
|
|
19086
|
+
}
|
|
19087
|
+
}, 100);
|
|
19088
|
+
} catch (authGenError) {
|
|
19089
|
+
addLog("warn", "Error generating auth URL:", authGenError);
|
|
19090
|
+
}
|
|
19091
|
+
if (isMountedRef.current) {
|
|
19092
|
+
setState("pending_auth");
|
|
19093
|
+
}
|
|
19094
|
+
connectingRef.current = false;
|
|
19095
|
+
return "auth_redirect";
|
|
19096
|
+
}
|
|
19011
19097
|
if (customHeaders && Object.keys(customHeaders).length > 0) {
|
|
19012
19098
|
failConnection(
|
|
19013
19099
|
"Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."
|
|
@@ -19059,6 +19145,7 @@ function useMcp(options) {
|
|
|
19059
19145
|
customHeaders,
|
|
19060
19146
|
transportType,
|
|
19061
19147
|
preventAutoAuth,
|
|
19148
|
+
useRedirectFlow,
|
|
19062
19149
|
onPopupWindow,
|
|
19063
19150
|
enabled,
|
|
19064
19151
|
timeout,
|
|
@@ -19111,32 +19198,57 @@ function useMcp(options) {
|
|
|
19111
19198
|
retry();
|
|
19112
19199
|
} else if (currentState === "pending_auth") {
|
|
19113
19200
|
addLog("info", "Proceeding with authentication from pending state...");
|
|
19114
|
-
setState("authenticating");
|
|
19115
|
-
if (authTimeoutRef.current) clearTimeout(authTimeoutRef.current);
|
|
19116
|
-
authTimeoutRef.current = setTimeout(() => {
|
|
19117
|
-
if (isMountedRef.current) {
|
|
19118
|
-
const currentStateValue = stateRef.current;
|
|
19119
|
-
if (currentStateValue === "authenticating") {
|
|
19120
|
-
failConnection("Authentication timed out. Please try again.");
|
|
19121
|
-
}
|
|
19122
|
-
}
|
|
19123
|
-
}, AUTH_TIMEOUT);
|
|
19124
19201
|
try {
|
|
19125
19202
|
assert$1(
|
|
19126
19203
|
authProviderRef.current,
|
|
19127
19204
|
"Auth Provider not available for manual auth"
|
|
19128
19205
|
);
|
|
19129
19206
|
assert$1(url, "Server URL is required for authentication");
|
|
19130
|
-
addLog(
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19207
|
+
addLog("info", "Clearing all OAuth state and initiating fresh flow...");
|
|
19208
|
+
const hashPrefix = `${storageKeyPrefix}:${authProviderRef.current.serverUrlHash}`;
|
|
19209
|
+
Object.keys(localStorage).forEach((key) => {
|
|
19210
|
+
if (key.startsWith(hashPrefix)) {
|
|
19211
|
+
addLog("debug", `Removing stale OAuth key: ${key}`);
|
|
19212
|
+
localStorage.removeItem(key);
|
|
19213
|
+
}
|
|
19214
|
+
if (key.startsWith(`${storageKeyPrefix}:state_`)) {
|
|
19215
|
+
addLog("debug", `Removing orphaned state: ${key}`);
|
|
19216
|
+
localStorage.removeItem(key);
|
|
19217
|
+
}
|
|
19218
|
+
});
|
|
19219
|
+
setState("authenticating");
|
|
19220
|
+
const freshAuthProvider = new BrowserOAuthClientProvider(url, {
|
|
19221
|
+
storageKeyPrefix,
|
|
19222
|
+
clientName,
|
|
19223
|
+
clientUri,
|
|
19224
|
+
callbackUrl,
|
|
19225
|
+
preventAutoAuth: false,
|
|
19226
|
+
// ← Allow OAuth to proceed
|
|
19227
|
+
useRedirectFlow,
|
|
19228
|
+
onPopupWindow
|
|
19229
|
+
});
|
|
19230
|
+
authProviderRef.current = freshAuthProvider;
|
|
19231
|
+
addLog("info", "Triggering fresh OAuth authorization...");
|
|
19232
|
+
const { auth: auth2 } = await __vitePreload(async () => {
|
|
19233
|
+
const { auth: auth3 } = await Promise.resolve().then(() => auth$1);
|
|
19234
|
+
return { auth: auth3 };
|
|
19235
|
+
}, true ? void 0 : void 0);
|
|
19236
|
+
const baseUrl = new URL(url).origin;
|
|
19237
|
+
auth2(freshAuthProvider, {
|
|
19238
|
+
serverUrl: baseUrl
|
|
19239
|
+
}).catch((err) => {
|
|
19240
|
+
addLog(
|
|
19241
|
+
"info",
|
|
19242
|
+
"OAuth flow initiated:",
|
|
19243
|
+
err?.message || "Redirecting..."
|
|
19244
|
+
);
|
|
19245
|
+
});
|
|
19134
19246
|
} catch (authError) {
|
|
19135
19247
|
if (!isMountedRef.current) return;
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
authError instanceof Error ? authError :
|
|
19248
|
+
setState("pending_auth");
|
|
19249
|
+
addLog(
|
|
19250
|
+
"error",
|
|
19251
|
+
`Manual authentication failed: ${authError instanceof Error ? authError.message : String(authError)}`
|
|
19140
19252
|
);
|
|
19141
19253
|
}
|
|
19142
19254
|
} else if (currentState === "authenticating") {
|
|
@@ -19155,7 +19267,18 @@ function useMcp(options) {
|
|
|
19155
19267
|
`Client not in a state requiring manual authentication trigger (state: ${currentState}). If needed, try disconnecting and reconnecting.`
|
|
19156
19268
|
);
|
|
19157
19269
|
}
|
|
19158
|
-
}, [
|
|
19270
|
+
}, [
|
|
19271
|
+
addLog,
|
|
19272
|
+
retry,
|
|
19273
|
+
authUrl,
|
|
19274
|
+
url,
|
|
19275
|
+
useRedirectFlow,
|
|
19276
|
+
onPopupWindow,
|
|
19277
|
+
storageKeyPrefix,
|
|
19278
|
+
clientName,
|
|
19279
|
+
clientUri,
|
|
19280
|
+
callbackUrl
|
|
19281
|
+
]);
|
|
19159
19282
|
const clearStorage = reactExports.useCallback(() => {
|
|
19160
19283
|
if (authProviderRef.current) {
|
|
19161
19284
|
const count2 = authProviderRef.current.clearStorage();
|
|
@@ -19326,6 +19449,7 @@ function useMcp(options) {
|
|
|
19326
19449
|
clientUri,
|
|
19327
19450
|
callbackUrl,
|
|
19328
19451
|
preventAutoAuth,
|
|
19452
|
+
useRedirectFlow,
|
|
19329
19453
|
onPopupWindow
|
|
19330
19454
|
});
|
|
19331
19455
|
addLog(
|
|
@@ -19347,7 +19471,8 @@ function useMcp(options) {
|
|
|
19347
19471
|
clientName,
|
|
19348
19472
|
clientUri,
|
|
19349
19473
|
clientConfig.name,
|
|
19350
|
-
clientConfig.version
|
|
19474
|
+
clientConfig.version,
|
|
19475
|
+
useRedirectFlow
|
|
19351
19476
|
]);
|
|
19352
19477
|
reactExports.useEffect(() => {
|
|
19353
19478
|
let retryTimeoutId = null;
|
|
@@ -41515,7 +41640,7 @@ class MCPToolSavedEvent {
|
|
|
41515
41640
|
function getPackageVersion() {
|
|
41516
41641
|
try {
|
|
41517
41642
|
if (true) {
|
|
41518
|
-
return "0.
|
|
41643
|
+
return "0.9.0-canary.1";
|
|
41519
41644
|
}
|
|
41520
41645
|
return "0.0.0";
|
|
41521
41646
|
} catch {
|
|
@@ -41862,6 +41987,10 @@ function McpConnectionWrapper({
|
|
|
41862
41987
|
customHeaders: Object.keys(customHeaders).length > 0 ? customHeaders : void 0,
|
|
41863
41988
|
transportType: transportType || "http",
|
|
41864
41989
|
// Default to 'http' for Streamable HTTP
|
|
41990
|
+
preventAutoAuth: true,
|
|
41991
|
+
// Show auth button instead of auto-triggering OAuth
|
|
41992
|
+
useRedirectFlow: true,
|
|
41993
|
+
// Use redirect instead of popup for better UX
|
|
41865
41994
|
enabled: wrapTransportReady,
|
|
41866
41995
|
// Only connect when wrapper is ready
|
|
41867
41996
|
wrapTransport: wrapTransportFn,
|
|
@@ -41918,6 +42047,7 @@ function McpConnectionWrapper({
|
|
|
41918
42047
|
authenticate: mcpHook.authenticate,
|
|
41919
42048
|
retry: mcpHook.retry,
|
|
41920
42049
|
clearStorage: mcpHook.clearStorage,
|
|
42050
|
+
disconnect: mcpHook.disconnect,
|
|
41921
42051
|
client: mcpHook.client
|
|
41922
42052
|
};
|
|
41923
42053
|
const prev = prevConnectionRef.current;
|
|
@@ -41956,6 +42086,7 @@ function McpConnectionWrapper({
|
|
|
41956
42086
|
authenticate: mcpHook.authenticate,
|
|
41957
42087
|
retry: mcpHook.retry,
|
|
41958
42088
|
clearStorage: mcpHook.clearStorage,
|
|
42089
|
+
disconnect: mcpHook.disconnect,
|
|
41959
42090
|
client: mcpHook.client
|
|
41960
42091
|
};
|
|
41961
42092
|
const prev = prevConnectionRef.current;
|
|
@@ -42044,6 +42175,8 @@ function McpProvider({ children }) {
|
|
|
42044
42175
|
},
|
|
42045
42176
|
clearStorage: () => {
|
|
42046
42177
|
},
|
|
42178
|
+
disconnect: () => {
|
|
42179
|
+
},
|
|
42047
42180
|
client: null
|
|
42048
42181
|
}))
|
|
42049
42182
|
);
|
|
@@ -42127,6 +42260,8 @@ function McpProvider({ children }) {
|
|
|
42127
42260
|
},
|
|
42128
42261
|
clearStorage: () => {
|
|
42129
42262
|
},
|
|
42263
|
+
disconnect: () => {
|
|
42264
|
+
},
|
|
42130
42265
|
client: null
|
|
42131
42266
|
}
|
|
42132
42267
|
]);
|
|
@@ -42185,6 +42320,8 @@ function McpProvider({ children }) {
|
|
|
42185
42320
|
},
|
|
42186
42321
|
clearStorage: () => {
|
|
42187
42322
|
},
|
|
42323
|
+
disconnect: () => {
|
|
42324
|
+
},
|
|
42188
42325
|
client: null
|
|
42189
42326
|
}
|
|
42190
42327
|
]);
|
|
@@ -42235,32 +42372,51 @@ function McpProvider({ children }) {
|
|
|
42235
42372
|
},
|
|
42236
42373
|
clearStorage: () => {
|
|
42237
42374
|
},
|
|
42375
|
+
disconnect: () => {
|
|
42376
|
+
},
|
|
42238
42377
|
client: null
|
|
42239
42378
|
}
|
|
42240
42379
|
]);
|
|
42241
42380
|
},
|
|
42242
42381
|
[connectionConfigs, connections]
|
|
42243
42382
|
);
|
|
42244
|
-
const removeConnection = reactExports.useCallback(
|
|
42245
|
-
|
|
42246
|
-
|
|
42247
|
-
|
|
42248
|
-
|
|
42249
|
-
|
|
42250
|
-
|
|
42251
|
-
|
|
42252
|
-
|
|
42253
|
-
|
|
42254
|
-
|
|
42255
|
-
|
|
42256
|
-
|
|
42257
|
-
|
|
42383
|
+
const removeConnection = reactExports.useCallback(
|
|
42384
|
+
(id2) => {
|
|
42385
|
+
const connection = connections.find((c2) => c2.id === id2);
|
|
42386
|
+
if (connection) {
|
|
42387
|
+
console.log(`[McpContext] Cleaning up connection: ${id2}`);
|
|
42388
|
+
if (connection.disconnect) {
|
|
42389
|
+
console.log(`[McpContext] Disconnecting from server: ${id2}`);
|
|
42390
|
+
connection.disconnect();
|
|
42391
|
+
}
|
|
42392
|
+
if (connection.clearStorage) {
|
|
42393
|
+
console.log(
|
|
42394
|
+
`[McpContext] Clearing OAuth storage for connection: ${id2}`
|
|
42395
|
+
);
|
|
42396
|
+
connection.clearStorage();
|
|
42397
|
+
}
|
|
42258
42398
|
}
|
|
42259
|
-
|
|
42260
|
-
|
|
42261
|
-
|
|
42262
|
-
|
|
42263
|
-
|
|
42399
|
+
setConnectionConfigs((prev) => prev.filter((c2) => c2.id !== id2));
|
|
42400
|
+
setConnections((prev) => prev.filter((c2) => c2.id !== id2));
|
|
42401
|
+
const currentConfigs = localStorage.getItem("mcp-inspector-connections");
|
|
42402
|
+
if (currentConfigs) {
|
|
42403
|
+
try {
|
|
42404
|
+
const parsed = JSON.parse(currentConfigs);
|
|
42405
|
+
const filtered = parsed.filter((c2) => (c2.id || c2.url) !== id2);
|
|
42406
|
+
localStorage.setItem(
|
|
42407
|
+
"mcp-inspector-connections",
|
|
42408
|
+
JSON.stringify(filtered)
|
|
42409
|
+
);
|
|
42410
|
+
} catch (e) {
|
|
42411
|
+
console.error("Failed to update localStorage on remove:", e);
|
|
42412
|
+
}
|
|
42413
|
+
}
|
|
42414
|
+
Telemetry.getInstance().capture(
|
|
42415
|
+
new MCPServerRemovedEvent({ serverId: id2 })
|
|
42416
|
+
);
|
|
42417
|
+
},
|
|
42418
|
+
[connections]
|
|
42419
|
+
);
|
|
42264
42420
|
const updateConnectionConfig = reactExports.useCallback(
|
|
42265
42421
|
(id2, config) => {
|
|
42266
42422
|
setConnectionConfigs(
|
|
@@ -54051,20 +54207,36 @@ function ConnectionTester({
|
|
|
54051
54207
|
const callbackUrl = typeof window !== "undefined" ? new URL("/inspector/oauth/callback", window.location.origin).toString() : "/inspector/oauth/callback";
|
|
54052
54208
|
let finalUrl = config.url;
|
|
54053
54209
|
let customHeaders = {};
|
|
54054
|
-
|
|
54055
|
-
|
|
54056
|
-
|
|
54057
|
-
|
|
54058
|
-
|
|
54210
|
+
let urlError = null;
|
|
54211
|
+
try {
|
|
54212
|
+
if (config.proxyConfig?.proxyAddress) {
|
|
54213
|
+
const proxyUrl = new URL(config.proxyConfig.proxyAddress);
|
|
54214
|
+
const originalUrl = new URL(config.url);
|
|
54215
|
+
finalUrl = `${proxyUrl.origin}${proxyUrl.pathname}${originalUrl.pathname}${originalUrl.search}`;
|
|
54216
|
+
customHeaders["X-Target-URL"] = config.url;
|
|
54217
|
+
} else {
|
|
54218
|
+
new URL(config.url);
|
|
54219
|
+
}
|
|
54220
|
+
} catch (err) {
|
|
54221
|
+
urlError = `Invalid URL format. Please include the protocol (http:// or https://).
|
|
54222
|
+
Example: https://${config.url}`;
|
|
54059
54223
|
}
|
|
54060
54224
|
if (config.proxyConfig?.customHeaders) {
|
|
54061
54225
|
customHeaders = { ...customHeaders, ...config.proxyConfig.customHeaders };
|
|
54062
54226
|
}
|
|
54227
|
+
reactExports.useEffect(() => {
|
|
54228
|
+
if (urlError) {
|
|
54229
|
+
onFailure(urlError);
|
|
54230
|
+
}
|
|
54231
|
+
}, [urlError, onFailure]);
|
|
54063
54232
|
const mcpHook = useMcp({
|
|
54064
|
-
url: finalUrl,
|
|
54233
|
+
url: urlError ? void 0 : finalUrl,
|
|
54234
|
+
// Don't connect if URL is invalid
|
|
54065
54235
|
callbackUrl,
|
|
54066
54236
|
customHeaders: Object.keys(customHeaders).length > 0 ? customHeaders : void 0,
|
|
54067
|
-
transportType: config.transportType || "http"
|
|
54237
|
+
transportType: config.transportType || "http",
|
|
54238
|
+
enabled: !urlError
|
|
54239
|
+
// Disable connection if URL is invalid
|
|
54068
54240
|
});
|
|
54069
54241
|
const hasCalledRef = reactExports.useRef(false);
|
|
54070
54242
|
reactExports.useEffect(() => {
|
|
@@ -54625,29 +54797,37 @@ function InspectorDashboard() {
|
|
|
54625
54797
|
] })
|
|
54626
54798
|
] }) })
|
|
54627
54799
|
] }),
|
|
54628
|
-
connection.state === "pending_auth"
|
|
54800
|
+
(connection.state === "pending_auth" || connection.state === "authenticating") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-yellow-600 dark:text-yellow-400 mt-2", children: [
|
|
54629
54801
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
54630
54802
|
Button,
|
|
54631
54803
|
{
|
|
54632
54804
|
size: "sm",
|
|
54805
|
+
className: "bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500",
|
|
54633
54806
|
variant: "outline",
|
|
54634
|
-
onClick: connection.authenticate,
|
|
54635
|
-
|
|
54807
|
+
onClick: (e) => handleActionClick(e, connection.authenticate),
|
|
54808
|
+
disabled: connection.state === "authenticating",
|
|
54809
|
+
children: connection.state === "authenticating" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
54810
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
54811
|
+
"Authenticating..."
|
|
54812
|
+
] }) : "Authenticate"
|
|
54636
54813
|
}
|
|
54637
54814
|
),
|
|
54638
|
-
"
|
|
54639
|
-
|
|
54640
|
-
|
|
54641
|
-
|
|
54642
|
-
|
|
54643
|
-
|
|
54644
|
-
|
|
54645
|
-
|
|
54646
|
-
|
|
54647
|
-
|
|
54648
|
-
|
|
54649
|
-
|
|
54650
|
-
|
|
54815
|
+
connection.authUrl && connection.state === "pending_auth" && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
54816
|
+
" ",
|
|
54817
|
+
"or",
|
|
54818
|
+
" ",
|
|
54819
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
54820
|
+
"a",
|
|
54821
|
+
{
|
|
54822
|
+
href: connection.authUrl,
|
|
54823
|
+
target: "_blank",
|
|
54824
|
+
rel: "noopener noreferrer",
|
|
54825
|
+
className: "underline",
|
|
54826
|
+
onClick: (e) => e.stopPropagation(),
|
|
54827
|
+
children: "open auth page"
|
|
54828
|
+
}
|
|
54829
|
+
)
|
|
54830
|
+
] })
|
|
54651
54831
|
] })
|
|
54652
54832
|
]
|
|
54653
54833
|
},
|
|
@@ -54929,6 +55109,15 @@ function useAutoConnect({
|
|
|
54929
55109
|
}, 100);
|
|
54930
55110
|
return;
|
|
54931
55111
|
}
|
|
55112
|
+
if (connection?.state === "pending_auth" || connection?.state === "authenticating") {
|
|
55113
|
+
console.warn(
|
|
55114
|
+
"[useAutoConnect] Connection requires authentication, clearing loading overlay"
|
|
55115
|
+
);
|
|
55116
|
+
setTimeout(() => {
|
|
55117
|
+
setIsAutoConnecting(false);
|
|
55118
|
+
}, 100);
|
|
55119
|
+
return;
|
|
55120
|
+
}
|
|
54932
55121
|
if (hasTriedBothModes) {
|
|
54933
55122
|
return;
|
|
54934
55123
|
}
|
|
@@ -87850,7 +88039,7 @@ function useChatMessagesClientSide({
|
|
|
87850
88039
|
let llm;
|
|
87851
88040
|
if (llmConfig.provider === "openai") {
|
|
87852
88041
|
const { ChatOpenAI } = await __vitePreload(async () => {
|
|
87853
|
-
const { ChatOpenAI: ChatOpenAI2 } = await import("./index-
|
|
88042
|
+
const { ChatOpenAI: ChatOpenAI2 } = await import("./index-DsQI4y0R.js");
|
|
87854
88043
|
return { ChatOpenAI: ChatOpenAI2 };
|
|
87855
88044
|
}, true ? __vite__mapDeps([4,5,6,2,7]) : void 0);
|
|
87856
88045
|
llm = new ChatOpenAI({
|
|
@@ -87859,7 +88048,7 @@ function useChatMessagesClientSide({
|
|
|
87859
88048
|
});
|
|
87860
88049
|
} else if (llmConfig.provider === "anthropic") {
|
|
87861
88050
|
const { ChatAnthropic } = await __vitePreload(async () => {
|
|
87862
|
-
const { ChatAnthropic: ChatAnthropic2 } = await import("./index-
|
|
88051
|
+
const { ChatAnthropic: ChatAnthropic2 } = await import("./index-BHQ3xRbt.js");
|
|
87863
88052
|
return { ChatAnthropic: ChatAnthropic2 };
|
|
87864
88053
|
}, true ? __vite__mapDeps([8,5,6,2]) : void 0);
|
|
87865
88054
|
llm = new ChatAnthropic({
|
|
@@ -87868,7 +88057,7 @@ function useChatMessagesClientSide({
|
|
|
87868
88057
|
});
|
|
87869
88058
|
} else if (llmConfig.provider === "google") {
|
|
87870
88059
|
const { ChatGoogleGenerativeAI } = await __vitePreload(async () => {
|
|
87871
|
-
const { ChatGoogleGenerativeAI: ChatGoogleGenerativeAI2 } = await import("./index-
|
|
88060
|
+
const { ChatGoogleGenerativeAI: ChatGoogleGenerativeAI2 } = await import("./index-DQq5OBLm.js");
|
|
87872
88061
|
return { ChatGoogleGenerativeAI: ChatGoogleGenerativeAI2 };
|
|
87873
88062
|
}, true ? __vite__mapDeps([9,5,6,2,7]) : void 0);
|
|
87874
88063
|
llm = new ChatGoogleGenerativeAI({
|
|
@@ -87887,7 +88076,7 @@ function useChatMessagesClientSide({
|
|
|
87887
88076
|
}
|
|
87888
88077
|
if (!agentRef.current || agentRef.current.llm !== llmRef.current.instance) {
|
|
87889
88078
|
const { MCPAgent } = await __vitePreload(async () => {
|
|
87890
|
-
const { MCPAgent: MCPAgent2 } = await import("./browser-
|
|
88079
|
+
const { MCPAgent: MCPAgent2 } = await import("./browser-D1dhX_Kd.js");
|
|
87891
88080
|
return { MCPAgent: MCPAgent2 };
|
|
87892
88081
|
}, true ? __vite__mapDeps([10,6,2,1,3]) : void 0);
|
|
87893
88082
|
agentRef.current = new MCPAgent({
|
|
@@ -92120,7 +92309,7 @@ function PromptsTab({
|
|
|
92120
92309
|
direction: "vertical",
|
|
92121
92310
|
className: "h-full border-r dark:border-zinc-700",
|
|
92122
92311
|
children: [
|
|
92123
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
92312
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ResizablePanel, { defaultSize: 75, minSize: 30, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
|
|
92124
92313
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92125
92314
|
PromptsTabHeader,
|
|
92126
92315
|
{
|
|
@@ -92154,7 +92343,7 @@ function PromptsTab({
|
|
|
92154
92343
|
focusedIndex
|
|
92155
92344
|
}
|
|
92156
92345
|
)
|
|
92157
|
-
] }),
|
|
92346
|
+
] }) }),
|
|
92158
92347
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ResizableHandle, { withHandle: true }),
|
|
92159
92348
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
92160
92349
|
ResizablePanel,
|
|
@@ -92945,7 +93134,7 @@ function ResourcesTab({
|
|
|
92945
93134
|
direction: "vertical",
|
|
92946
93135
|
className: "h-full border-r dark:border-zinc-700",
|
|
92947
93136
|
children: [
|
|
92948
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
93137
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ResizablePanel, { defaultSize: 75, minSize: 30, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
|
|
92949
93138
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92950
93139
|
ResourcesTabHeader,
|
|
92951
93140
|
{
|
|
@@ -92961,7 +93150,7 @@ function ResourcesTab({
|
|
|
92961
93150
|
searchInputRef
|
|
92962
93151
|
}
|
|
92963
93152
|
),
|
|
92964
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
93153
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92965
93154
|
ResourcesList,
|
|
92966
93155
|
{
|
|
92967
93156
|
resources: filteredResources,
|
|
@@ -92969,8 +93158,8 @@ function ResourcesTab({
|
|
|
92969
93158
|
onResourceSelect: handleResourceSelect,
|
|
92970
93159
|
focusedIndex
|
|
92971
93160
|
}
|
|
92972
|
-
)
|
|
92973
|
-
] }),
|
|
93161
|
+
)
|
|
93162
|
+
] }) }),
|
|
92974
93163
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ResizableHandle, { withHandle: true }),
|
|
92975
93164
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
92976
93165
|
ResizablePanel,
|
|
@@ -93177,6 +93366,43 @@ function SaveRequestDialog({
|
|
|
93177
93366
|
}
|
|
93178
93367
|
);
|
|
93179
93368
|
}
|
|
93369
|
+
function resolveRef(schema2, rootSchema) {
|
|
93370
|
+
if (!schema2?.$ref) return schema2;
|
|
93371
|
+
const ref2 = schema2.$ref;
|
|
93372
|
+
if (ref2.startsWith("#/")) {
|
|
93373
|
+
const path = ref2.substring(2).split("/");
|
|
93374
|
+
let current = rootSchema;
|
|
93375
|
+
for (const segment of path) {
|
|
93376
|
+
if (current && typeof current === "object" && segment in current) {
|
|
93377
|
+
current = current[segment];
|
|
93378
|
+
} else {
|
|
93379
|
+
console.warn(`Could not resolve $ref: ${ref2}`);
|
|
93380
|
+
return schema2;
|
|
93381
|
+
}
|
|
93382
|
+
}
|
|
93383
|
+
return current;
|
|
93384
|
+
}
|
|
93385
|
+
return schema2;
|
|
93386
|
+
}
|
|
93387
|
+
function normalizeUnionType(schema2, rootSchema) {
|
|
93388
|
+
if (schema2.anyOf && Array.isArray(schema2.anyOf)) {
|
|
93389
|
+
const nonNullOption = schema2.anyOf.find((opt) => {
|
|
93390
|
+
if (opt.type === "null") return false;
|
|
93391
|
+
return true;
|
|
93392
|
+
});
|
|
93393
|
+
if (nonNullOption) {
|
|
93394
|
+
const resolved = resolveRef(nonNullOption, rootSchema);
|
|
93395
|
+
return { ...resolved, nullable: true };
|
|
93396
|
+
}
|
|
93397
|
+
}
|
|
93398
|
+
return schema2;
|
|
93399
|
+
}
|
|
93400
|
+
function extractEnum(schema2) {
|
|
93401
|
+
if (Array.isArray(schema2.enum)) {
|
|
93402
|
+
return schema2.enum;
|
|
93403
|
+
}
|
|
93404
|
+
return null;
|
|
93405
|
+
}
|
|
93180
93406
|
function ToolInputForm({
|
|
93181
93407
|
selectedTool,
|
|
93182
93408
|
toolArgs,
|
|
@@ -93189,7 +93415,12 @@ function ToolInputForm({
|
|
|
93189
93415
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm", children: "No parameters required" });
|
|
93190
93416
|
}
|
|
93191
93417
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-4", children: Object.entries(properties2).map(([key, prop]) => {
|
|
93192
|
-
const
|
|
93418
|
+
const inputSchema = selectedTool?.inputSchema || {};
|
|
93419
|
+
let resolvedProp = normalizeUnionType(prop, inputSchema);
|
|
93420
|
+
resolvedProp = resolveRef(resolvedProp, inputSchema);
|
|
93421
|
+
const enumValues = extractEnum(resolvedProp);
|
|
93422
|
+
const isEnum = resolvedProp.type === "string" && enumValues !== null;
|
|
93423
|
+
const typedProp = resolvedProp;
|
|
93193
93424
|
typedProp.required = requiredFields.includes(key);
|
|
93194
93425
|
const currentValue = toolArgs[key];
|
|
93195
93426
|
let stringValue = "";
|
|
@@ -93222,6 +93453,31 @@ function ToolInputForm({
|
|
|
93222
93453
|
typedProp?.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: typedProp.description })
|
|
93223
93454
|
] }, key);
|
|
93224
93455
|
}
|
|
93456
|
+
if (isEnum && enumValues) {
|
|
93457
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
93458
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { htmlFor: key, className: "text-sm font-medium", children: [
|
|
93459
|
+
key,
|
|
93460
|
+
typedProp.required && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" })
|
|
93461
|
+
] }),
|
|
93462
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
93463
|
+
Select,
|
|
93464
|
+
{
|
|
93465
|
+
value: String(toolArgs[key] || ""),
|
|
93466
|
+
onValueChange: (value) => onArgChange(key, value),
|
|
93467
|
+
children: [
|
|
93468
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id: key, className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
93469
|
+
SelectValue,
|
|
93470
|
+
{
|
|
93471
|
+
placeholder: typedProp.description || "Select an option"
|
|
93472
|
+
}
|
|
93473
|
+
) }),
|
|
93474
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: enumValues.map((option, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: option, children: typedProp.enumNames?.[index2] || option }, option)) })
|
|
93475
|
+
]
|
|
93476
|
+
}
|
|
93477
|
+
),
|
|
93478
|
+
typedProp.description && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: typedProp.description })
|
|
93479
|
+
] }, key);
|
|
93480
|
+
}
|
|
93225
93481
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
93226
93482
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { htmlFor: key, className: "text-sm font-medium", children: [
|
|
93227
93483
|
key,
|
|
@@ -94519,7 +94775,7 @@ function ToolsTab({
|
|
|
94519
94775
|
direction: "vertical",
|
|
94520
94776
|
className: "h-full border-r dark:border-zinc-700",
|
|
94521
94777
|
children: [
|
|
94522
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
94778
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ResizablePanel, { defaultSize: 75, minSize: 30, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
|
|
94523
94779
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
94524
94780
|
ToolsTabHeader,
|
|
94525
94781
|
{
|
|
@@ -94553,7 +94809,7 @@ function ToolsTab({
|
|
|
94553
94809
|
focusedIndex
|
|
94554
94810
|
}
|
|
94555
94811
|
)
|
|
94556
|
-
] }),
|
|
94812
|
+
] }) }),
|
|
94557
94813
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ResizableHandle, { withHandle: true }),
|
|
94558
94814
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
94559
94815
|
ResizablePanel,
|
|
@@ -96402,6 +96658,41 @@ function Layout({ children }) {
|
|
|
96402
96658
|
)
|
|
96403
96659
|
] }) });
|
|
96404
96660
|
}
|
|
96661
|
+
function OAuthCallback() {
|
|
96662
|
+
const [status, setStatus] = reactExports.useState(
|
|
96663
|
+
"processing"
|
|
96664
|
+
);
|
|
96665
|
+
const [errorMessage, setErrorMessage] = reactExports.useState("");
|
|
96666
|
+
reactExports.useEffect(() => {
|
|
96667
|
+
console.log("[OAuthCallback] Component mounted, handling authorization...");
|
|
96668
|
+
console.log("[OAuthCallback] Current URL:", window.location.href);
|
|
96669
|
+
onMcpAuthorization().then(() => {
|
|
96670
|
+
console.log("[OAuthCallback] Authorization successful");
|
|
96671
|
+
setStatus("success");
|
|
96672
|
+
}).catch((err) => {
|
|
96673
|
+
console.error("[OAuthCallback] Authorization failed:", err);
|
|
96674
|
+
setStatus("error");
|
|
96675
|
+
setErrorMessage(err instanceof Error ? err.message : String(err));
|
|
96676
|
+
});
|
|
96677
|
+
}, []);
|
|
96678
|
+
if (status === "processing") {
|
|
96679
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
96680
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400" }),
|
|
96681
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-zinc-600 dark:text-zinc-400", children: "Completing authentication..." })
|
|
96682
|
+
] }) });
|
|
96683
|
+
}
|
|
96684
|
+
if (status === "error") {
|
|
96685
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-md p-6", children: [
|
|
96686
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-semibold text-red-600 dark:text-red-400 mb-2", children: "Authentication Error" }),
|
|
96687
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-zinc-600 dark:text-zinc-400 mb-4", children: errorMessage }),
|
|
96688
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-zinc-500 dark:text-zinc-500", children: "You can close this window and try again." })
|
|
96689
|
+
] }) });
|
|
96690
|
+
}
|
|
96691
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-md p-6", children: [
|
|
96692
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-semibold text-green-600 dark:text-green-400 mb-2", children: "Authentication Successful!" }),
|
|
96693
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-zinc-600 dark:text-zinc-400", children: "Redirecting you back..." })
|
|
96694
|
+
] }) });
|
|
96695
|
+
}
|
|
96405
96696
|
var M = (e, i2, s2, u2, m2, a2, l2, h2) => {
|
|
96406
96697
|
let d2 = document.documentElement, w2 = ["light", "dark"];
|
|
96407
96698
|
function p2(n2) {
|
|
@@ -96450,7 +96741,16 @@ function Toaster2({ ...props2 }) {
|
|
|
96450
96741
|
}
|
|
96451
96742
|
function App() {
|
|
96452
96743
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(McpProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(InspectorProvider, { children: [
|
|
96453
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BrowserRouter, { basename: "/inspector", children: /* @__PURE__ */ jsxRuntimeExports.
|
|
96744
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BrowserRouter, { basename: "/inspector", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Routes, { children: [
|
|
96745
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: "/oauth/callback", element: /* @__PURE__ */ jsxRuntimeExports.jsx(OAuthCallback, {}) }),
|
|
96746
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
96747
|
+
Route,
|
|
96748
|
+
{
|
|
96749
|
+
path: "/",
|
|
96750
|
+
element: /* @__PURE__ */ jsxRuntimeExports.jsx(Layout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(InspectorDashboard, {}) })
|
|
96751
|
+
}
|
|
96752
|
+
)
|
|
96753
|
+
] }) }),
|
|
96454
96754
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Toaster2, { position: "top-center" })
|
|
96455
96755
|
] }) }) });
|
|
96456
96756
|
}
|