@mcp-use/inspector 2.0.0-canary.6 → 2.0.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/cdn/inspector.css +1 -1
- package/dist/cdn/inspector.js +25419 -25705
- package/dist/cli.js +1 -12
- package/dist/client/components/AddToClientDropdown.d.ts.map +1 -1
- package/dist/client/components/ToolsTab.d.ts.map +1 -1
- package/dist/client/components/chat/useConfig.d.ts.map +1 -1
- package/dist/client/index.js +366 -431
- package/dist/client/telemetry/events.d.ts +0 -54
- package/dist/client/telemetry/events.d.ts.map +1 -1
- package/dist/client/telemetry/telemetry.d.ts +0 -7
- package/dist/client/telemetry/telemetry.d.ts.map +1 -1
- package/dist/server/{chunk-VYFEI5EK.js → chunk-LMSWBFF2.js} +2 -3
- package/dist/server/{chunk-CGBTAGR7.js → chunk-TJIMGJEY.js} +0 -10
- package/dist/server/cli.js +2 -3
- package/dist/server/index.js +2 -2
- package/dist/server/middleware.d.ts.map +1 -1
- package/dist/server/middleware.js +2 -2
- package/dist/server/server.js +1 -1
- package/dist/server/shared-static.d.ts +0 -7
- package/dist/server/shared-static.d.ts.map +1 -1
- package/dist/server/shared-static.js +1 -1
- package/dist/web/assets/{browser-DxX7sW4h.js → browser-MRsu2gXI.js} +3 -3
- package/dist/web/assets/{chunk-H5OBR2GN-DXpkJLue.js → chunk-KTNIDGGJ-BhVuC_-M.js} +1 -1
- package/dist/web/assets/{chunk-LG5NSHEL-BI0hJ0cR.js → chunk-LG5NSHEL-xh9zn4kA.js} +1 -1
- package/dist/web/assets/{chunk-EQZEK3KY-CElC4yui.js → chunk-T7VJV5W2-DxZ7xzIS.js} +1 -1
- package/dist/web/assets/{client-DpTioJek.js → client-CB9M8odq.js} +1 -1
- package/dist/web/assets/{client-JZ6UJ4KG-3eOU3LiX.js → client-PK767MHF-B1Fl2lc6.js} +3 -3
- package/dist/web/assets/index-CG1YzZnl.js +720 -0
- package/dist/web/assets/index-CM9P_1sf.css +2 -0
- package/dist/web/assets/react-C2F7FvmN.js +1 -0
- package/dist/web/assets/{stdio-MQ2HH6JI-B_OYhcMv.js → stdio-6UZMVUCN-BkJtimjb.js} +1 -1
- package/dist/web/index.html +6 -6
- package/package.json +3 -3
- package/dist/web/assets/index-D-jT1sqH.css +0 -2
- package/dist/web/assets/index-DfYJOmuR.js +0 -720
- package/dist/web/assets/react-cD7XDkF-.js +0 -1
package/dist/client/index.js
CHANGED
|
@@ -5177,7 +5177,7 @@ var init_module = __esm({
|
|
|
5177
5177
|
}
|
|
5178
5178
|
});
|
|
5179
5179
|
|
|
5180
|
-
// ../mcp-use/dist/chunk-
|
|
5180
|
+
// ../mcp-use/dist/chunk-C4ISR4J4.js
|
|
5181
5181
|
import { RESOURCE_MIME_TYPE } from "@modelcontextprotocol/ext-apps";
|
|
5182
5182
|
import {
|
|
5183
5183
|
CreateMessageRequestSchema,
|
|
@@ -5345,12 +5345,12 @@ function setTelemetrySource(source) {
|
|
|
5345
5345
|
Tel.getInstance().setSource(source);
|
|
5346
5346
|
}
|
|
5347
5347
|
var VERSION, _a3, BaseTelemetryEvent, _a4, MCPAgentExecutionEvent, _a5, ServerRunEvent, _a6, ServerInitializeEvent, _a7, ServerToolCallEvent, _a8, ServerResourceCallEvent, _a9, ServerPromptCallEvent, _a10, ServerContextEvent, _a11, MCPClientInitEvent, _a12, ConnectorInitEvent, _a13, ClientAddServerEvent, _a14, ClientRemoveServerEvent, USER_ID_STORAGE_KEY, cachedEnvironment, _a15, Telemetry2, Tel, _a16, BaseConnector, _a17, ConnectionManager;
|
|
5348
|
-
var
|
|
5349
|
-
"../mcp-use/dist/chunk-
|
|
5348
|
+
var init_chunk_C4ISR4J4 = __esm({
|
|
5349
|
+
"../mcp-use/dist/chunk-C4ISR4J4.js"() {
|
|
5350
5350
|
"use strict";
|
|
5351
5351
|
init_chunk_QWQYAQCK();
|
|
5352
5352
|
init_chunk_3GQAWCBQ();
|
|
5353
|
-
VERSION = "1.24.0
|
|
5353
|
+
VERSION = "1.24.0";
|
|
5354
5354
|
__name(getPackageVersion2, "getPackageVersion");
|
|
5355
5355
|
BaseTelemetryEvent = (_a3 = class {
|
|
5356
5356
|
}, __name(_a3, "BaseTelemetryEvent"), _a3);
|
|
@@ -6620,7 +6620,7 @@ var init_chunk_UXNMDFJ2 = __esm({
|
|
|
6620
6620
|
}
|
|
6621
6621
|
});
|
|
6622
6622
|
|
|
6623
|
-
// ../mcp-use/dist/chunk-
|
|
6623
|
+
// ../mcp-use/dist/chunk-KTNIDGGJ.js
|
|
6624
6624
|
import {
|
|
6625
6625
|
Client
|
|
6626
6626
|
} from "@modelcontextprotocol/sdk/client/index.js";
|
|
@@ -6685,10 +6685,10 @@ function createConnectorFromConfig(serverConfig, connectorOptions) {
|
|
|
6685
6685
|
throw new Error("Cannot determine connector type from config");
|
|
6686
6686
|
}
|
|
6687
6687
|
var _a18, SseConnectionManager, _a19, HttpConnector, _a20, MCPSession, _a21, BaseMCPClient;
|
|
6688
|
-
var
|
|
6689
|
-
"../mcp-use/dist/chunk-
|
|
6688
|
+
var init_chunk_KTNIDGGJ = __esm({
|
|
6689
|
+
"../mcp-use/dist/chunk-KTNIDGGJ.js"() {
|
|
6690
6690
|
"use strict";
|
|
6691
|
-
|
|
6691
|
+
init_chunk_C4ISR4J4();
|
|
6692
6692
|
init_chunk_QWQYAQCK();
|
|
6693
6693
|
init_chunk_3GQAWCBQ();
|
|
6694
6694
|
SseConnectionManager = (_a18 = class extends ConnectionManager {
|
|
@@ -7947,7 +7947,7 @@ var init_chunk_H5OBR2GN = __esm({
|
|
|
7947
7947
|
}
|
|
7948
7948
|
});
|
|
7949
7949
|
|
|
7950
|
-
// ../mcp-use/dist/chunk-
|
|
7950
|
+
// ../mcp-use/dist/chunk-T7VJV5W2.js
|
|
7951
7951
|
import {
|
|
7952
7952
|
discoverOAuthProtectedResourceMetadata,
|
|
7953
7953
|
discoverAuthorizationServerMetadata,
|
|
@@ -8257,11 +8257,11 @@ async function onMcpAuthorization() {
|
|
|
8257
8257
|
}
|
|
8258
8258
|
}
|
|
8259
8259
|
var _a22, BrowserMCPClient, _a23, BrowserOAuthClientProvider;
|
|
8260
|
-
var
|
|
8261
|
-
"../mcp-use/dist/chunk-
|
|
8260
|
+
var init_chunk_T7VJV5W2 = __esm({
|
|
8261
|
+
"../mcp-use/dist/chunk-T7VJV5W2.js"() {
|
|
8262
8262
|
"use strict";
|
|
8263
|
-
|
|
8264
|
-
|
|
8263
|
+
init_chunk_KTNIDGGJ();
|
|
8264
|
+
init_chunk_C4ISR4J4();
|
|
8265
8265
|
init_chunk_QWQYAQCK();
|
|
8266
8266
|
init_chunk_3GQAWCBQ();
|
|
8267
8267
|
__name(trackBrowserClientInit, "trackBrowserClientInit");
|
|
@@ -27978,18 +27978,18 @@ var init_stdio_transport = __esm({
|
|
|
27978
27978
|
}
|
|
27979
27979
|
});
|
|
27980
27980
|
|
|
27981
|
-
// ../mcp-use/dist/stdio-
|
|
27982
|
-
var
|
|
27983
|
-
__export(
|
|
27981
|
+
// ../mcp-use/dist/stdio-6UZMVUCN.js
|
|
27982
|
+
var stdio_6UZMVUCN_exports = {};
|
|
27983
|
+
__export(stdio_6UZMVUCN_exports, {
|
|
27984
27984
|
StdioConnector: () => StdioConnector
|
|
27985
27985
|
});
|
|
27986
27986
|
import { Client as Client2 } from "@modelcontextprotocol/sdk/client/index.js";
|
|
27987
27987
|
import process2 from "process";
|
|
27988
27988
|
var _a38, StdioConnectionManager, _a39, StdioConnector;
|
|
27989
|
-
var
|
|
27990
|
-
"../mcp-use/dist/stdio-
|
|
27989
|
+
var init_stdio_6UZMVUCN = __esm({
|
|
27990
|
+
"../mcp-use/dist/stdio-6UZMVUCN.js"() {
|
|
27991
27991
|
"use strict";
|
|
27992
|
-
|
|
27992
|
+
init_chunk_C4ISR4J4();
|
|
27993
27993
|
init_chunk_QWQYAQCK();
|
|
27994
27994
|
init_chunk_3GQAWCBQ();
|
|
27995
27995
|
init_stdio_transport();
|
|
@@ -28133,9 +28133,9 @@ var init_stdio_MQ2HH6JI = __esm({
|
|
|
28133
28133
|
}
|
|
28134
28134
|
});
|
|
28135
28135
|
|
|
28136
|
-
// ../mcp-use/dist/client-
|
|
28137
|
-
var
|
|
28138
|
-
__export(
|
|
28136
|
+
// ../mcp-use/dist/client-PK767MHF.js
|
|
28137
|
+
var client_PK767MHF_exports = {};
|
|
28138
|
+
__export(client_PK767MHF_exports, {
|
|
28139
28139
|
BaseCodeExecutor: () => BaseCodeExecutor,
|
|
28140
28140
|
E2BCodeExecutor: () => E2BCodeExecutor,
|
|
28141
28141
|
MCPClient: () => MCPClient,
|
|
@@ -28275,12 +28275,12 @@ function trackNodeClientInit(config, codeMode, callbacks) {
|
|
|
28275
28275
|
}).catch((e2) => logger.debug(`Failed to track MCPClient init: ${e2}`));
|
|
28276
28276
|
}
|
|
28277
28277
|
var _a40, BaseCodeExecutor, _a41, E2BCodeExecutor, vm, vmCheckAttempted, _a42, VMCodeExecutor, _a43, CodeModeConnector, _a44, MCPClient;
|
|
28278
|
-
var
|
|
28279
|
-
"../mcp-use/dist/client-
|
|
28278
|
+
var init_client_PK767MHF = __esm({
|
|
28279
|
+
"../mcp-use/dist/client-PK767MHF.js"() {
|
|
28280
28280
|
"use strict";
|
|
28281
28281
|
init_chunk_LG5NSHEL();
|
|
28282
|
-
|
|
28283
|
-
|
|
28282
|
+
init_chunk_KTNIDGGJ();
|
|
28283
|
+
init_chunk_C4ISR4J4();
|
|
28284
28284
|
init_chunk_QWQYAQCK();
|
|
28285
28285
|
init_chunk_3GQAWCBQ();
|
|
28286
28286
|
init_fs();
|
|
@@ -29217,7 +29217,7 @@ ${shim}
|
|
|
29217
29217
|
clientInfo: serverConfig.clientInfo ?? this.config.clientInfo
|
|
29218
29218
|
};
|
|
29219
29219
|
if ("command" in merged && "args" in merged) {
|
|
29220
|
-
const { StdioConnector: StdioConnector2 } = await Promise.resolve().then(() => (
|
|
29220
|
+
const { StdioConnector: StdioConnector2 } = await Promise.resolve().then(() => (init_stdio_6UZMVUCN(), stdio_6UZMVUCN_exports));
|
|
29221
29221
|
const stdioConfig = merged;
|
|
29222
29222
|
return new StdioConnector2({
|
|
29223
29223
|
command: stdioConfig.command,
|
|
@@ -74896,11 +74896,11 @@ var _a45, BaseAdapter, _a46, LangChainAdapter, _a47, MCPServerTool, PresentActiv
|
|
|
74896
74896
|
var init_browser = __esm({
|
|
74897
74897
|
"../mcp-use/dist/src/browser.js"() {
|
|
74898
74898
|
"use strict";
|
|
74899
|
-
|
|
74899
|
+
init_chunk_T7VJV5W2();
|
|
74900
74900
|
init_chunk_UJPHRNQP();
|
|
74901
74901
|
init_chunk_LG5NSHEL();
|
|
74902
|
-
|
|
74903
|
-
|
|
74902
|
+
init_chunk_KTNIDGGJ();
|
|
74903
|
+
init_chunk_C4ISR4J4();
|
|
74904
74904
|
init_chunk_QWQYAQCK();
|
|
74905
74905
|
init_chunk_3GQAWCBQ();
|
|
74906
74906
|
init_dist3();
|
|
@@ -76247,7 +76247,7 @@ Raw error: ${result}`
|
|
|
76247
76247
|
logger.debug(
|
|
76248
76248
|
`Creating MCPClient with ${Object.keys(this.mcpServersConfig).length} server(s)...`
|
|
76249
76249
|
);
|
|
76250
|
-
const { MCPClient: MCPClient2 } = await Promise.resolve().then(() => (
|
|
76250
|
+
const { MCPClient: MCPClient2 } = await Promise.resolve().then(() => (init_client_PK767MHF(), client_PK767MHF_exports));
|
|
76251
76251
|
this.client = new MCPClient2({ mcpServers: this.mcpServersConfig });
|
|
76252
76252
|
logger.debug("\u2705 MCPClient created successfully");
|
|
76253
76253
|
}
|
|
@@ -77615,380 +77615,6 @@ ${formatPrompt}`
|
|
|
77615
77615
|
}
|
|
77616
77616
|
});
|
|
77617
77617
|
|
|
77618
|
-
// src/client/telemetry/events.ts
|
|
77619
|
-
var MCPInspectorOpenEvent = class {
|
|
77620
|
-
constructor(data) {
|
|
77621
|
-
__publicField(this, "name", "mcp_inspector_open");
|
|
77622
|
-
__publicField(this, "properties");
|
|
77623
|
-
this.properties = {
|
|
77624
|
-
server_url: data.serverUrl,
|
|
77625
|
-
connection_count: data.connectionCount
|
|
77626
|
-
};
|
|
77627
|
-
}
|
|
77628
|
-
};
|
|
77629
|
-
var MCPToolExecutionEvent = class {
|
|
77630
|
-
constructor(data) {
|
|
77631
|
-
__publicField(this, "name", "mcp_tool_execution");
|
|
77632
|
-
__publicField(this, "properties");
|
|
77633
|
-
this.properties = {
|
|
77634
|
-
tool_name: data.toolName,
|
|
77635
|
-
server_id: data.serverId,
|
|
77636
|
-
success: data.success,
|
|
77637
|
-
duration: data.duration,
|
|
77638
|
-
error: data.error
|
|
77639
|
-
};
|
|
77640
|
-
}
|
|
77641
|
-
};
|
|
77642
|
-
var MCPResourceReadEvent = class {
|
|
77643
|
-
constructor(data) {
|
|
77644
|
-
__publicField(this, "name", "mcp_resource_read");
|
|
77645
|
-
__publicField(this, "properties");
|
|
77646
|
-
this.properties = {
|
|
77647
|
-
resource_uri: data.resourceUri,
|
|
77648
|
-
server_id: data.serverId,
|
|
77649
|
-
success: data.success,
|
|
77650
|
-
error: data.error
|
|
77651
|
-
};
|
|
77652
|
-
}
|
|
77653
|
-
};
|
|
77654
|
-
var MCPPromptCallEvent = class {
|
|
77655
|
-
constructor(data) {
|
|
77656
|
-
__publicField(this, "name", "mcp_prompt_call");
|
|
77657
|
-
__publicField(this, "properties");
|
|
77658
|
-
this.properties = {
|
|
77659
|
-
prompt_name: data.promptName,
|
|
77660
|
-
server_id: data.serverId,
|
|
77661
|
-
success: data.success,
|
|
77662
|
-
error: data.error
|
|
77663
|
-
};
|
|
77664
|
-
}
|
|
77665
|
-
};
|
|
77666
|
-
var MCPChatMessageEvent = class {
|
|
77667
|
-
constructor(data) {
|
|
77668
|
-
__publicField(this, "name", "mcp_chat_message");
|
|
77669
|
-
__publicField(this, "properties");
|
|
77670
|
-
this.properties = {
|
|
77671
|
-
server_id: data.serverId,
|
|
77672
|
-
provider: data.provider,
|
|
77673
|
-
model: data.model,
|
|
77674
|
-
message_count: data.messageCount,
|
|
77675
|
-
tool_calls_count: data.toolCallsCount,
|
|
77676
|
-
success: data.success,
|
|
77677
|
-
execution_mode: data.executionMode,
|
|
77678
|
-
duration: data.duration,
|
|
77679
|
-
error: data.error
|
|
77680
|
-
};
|
|
77681
|
-
}
|
|
77682
|
-
};
|
|
77683
|
-
var MCPToolSavedEvent = class {
|
|
77684
|
-
constructor(data) {
|
|
77685
|
-
__publicField(this, "name", "mcp_tool_saved");
|
|
77686
|
-
__publicField(this, "properties");
|
|
77687
|
-
this.properties = {
|
|
77688
|
-
tool_name: data.toolName,
|
|
77689
|
-
server_id: data.serverId
|
|
77690
|
-
};
|
|
77691
|
-
}
|
|
77692
|
-
};
|
|
77693
|
-
var MCPChatConfiguredEvent = class {
|
|
77694
|
-
constructor(data) {
|
|
77695
|
-
__publicField(this, "name", "mcp_chat_configured");
|
|
77696
|
-
__publicField(this, "properties");
|
|
77697
|
-
this.properties = {
|
|
77698
|
-
provider: data.provider,
|
|
77699
|
-
model: data.model
|
|
77700
|
-
};
|
|
77701
|
-
}
|
|
77702
|
-
};
|
|
77703
|
-
var MCPAddToClientEvent = class {
|
|
77704
|
-
constructor(data) {
|
|
77705
|
-
__publicField(this, "name", "mcp_add_to_client");
|
|
77706
|
-
__publicField(this, "properties");
|
|
77707
|
-
this.properties = {
|
|
77708
|
-
client: data.client
|
|
77709
|
-
};
|
|
77710
|
-
}
|
|
77711
|
-
};
|
|
77712
|
-
|
|
77713
|
-
// src/client/telemetry/utils.ts
|
|
77714
|
-
function getPackageVersion() {
|
|
77715
|
-
try {
|
|
77716
|
-
if (typeof __INSPECTOR_VERSION__ !== "undefined") {
|
|
77717
|
-
return __INSPECTOR_VERSION__;
|
|
77718
|
-
}
|
|
77719
|
-
return "0.0.0";
|
|
77720
|
-
} catch {
|
|
77721
|
-
return "0.0.0";
|
|
77722
|
-
}
|
|
77723
|
-
}
|
|
77724
|
-
|
|
77725
|
-
// src/client/telemetry/telemetry.ts
|
|
77726
|
-
function isBrowserEnvironment() {
|
|
77727
|
-
try {
|
|
77728
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
77729
|
-
} catch {
|
|
77730
|
-
return false;
|
|
77731
|
-
}
|
|
77732
|
-
}
|
|
77733
|
-
var TelemetryEventLogger = class {
|
|
77734
|
-
constructor(endpoint, timeout = 3e3) {
|
|
77735
|
-
__publicField(this, "endpoint");
|
|
77736
|
-
__publicField(this, "timeout");
|
|
77737
|
-
this.endpoint = endpoint;
|
|
77738
|
-
this.timeout = timeout;
|
|
77739
|
-
}
|
|
77740
|
-
async logEvent(properties) {
|
|
77741
|
-
try {
|
|
77742
|
-
const controller = new AbortController();
|
|
77743
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
77744
|
-
const response = await fetch(this.endpoint, {
|
|
77745
|
-
method: "POST",
|
|
77746
|
-
headers: {
|
|
77747
|
-
"Content-Type": "application/json"
|
|
77748
|
-
},
|
|
77749
|
-
body: JSON.stringify(properties),
|
|
77750
|
-
signal: controller.signal
|
|
77751
|
-
});
|
|
77752
|
-
clearTimeout(timeoutId);
|
|
77753
|
-
if (!response.ok) {
|
|
77754
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
77755
|
-
}
|
|
77756
|
-
} catch {
|
|
77757
|
-
}
|
|
77758
|
-
}
|
|
77759
|
-
};
|
|
77760
|
-
function getCacheKey(key) {
|
|
77761
|
-
return `mcp_inspector_telemetry_${key}`;
|
|
77762
|
-
}
|
|
77763
|
-
function detectInspectorMode() {
|
|
77764
|
-
if (typeof window === "undefined") return "standalone";
|
|
77765
|
-
const injected = window.__MCP_INSPECTOR_MODE__;
|
|
77766
|
-
if (injected === "standalone" || injected === "embedded" || injected === "cloud") {
|
|
77767
|
-
return injected;
|
|
77768
|
-
}
|
|
77769
|
-
return "standalone";
|
|
77770
|
-
}
|
|
77771
|
-
function isLocalStorageFunctional() {
|
|
77772
|
-
return typeof localStorage !== "undefined" && typeof localStorage.getItem === "function" && typeof localStorage.setItem === "function";
|
|
77773
|
-
}
|
|
77774
|
-
var _Telemetry = class _Telemetry {
|
|
77775
|
-
constructor() {
|
|
77776
|
-
__publicField(this, "POSTHOG_PROXY_URL", "/inspector/api/tel/posthog");
|
|
77777
|
-
__publicField(this, "SCARF_PROXY_URL", "/inspector/api/tel/scarf");
|
|
77778
|
-
__publicField(this, "UNKNOWN_USER_ID", "UNKNOWN_USER_ID");
|
|
77779
|
-
__publicField(this, "_currUserId", null);
|
|
77780
|
-
__publicField(this, "_posthogClient", null);
|
|
77781
|
-
__publicField(this, "_scarfClient", null);
|
|
77782
|
-
__publicField(this, "_source", "inspector");
|
|
77783
|
-
__publicField(this, "_mode", "standalone");
|
|
77784
|
-
const isBrowser = isBrowserEnvironment();
|
|
77785
|
-
const telemetryDisabled = this.isTelemetryDisabled();
|
|
77786
|
-
this._source = this.getStoredSource() || "inspector";
|
|
77787
|
-
this._mode = detectInspectorMode();
|
|
77788
|
-
if (telemetryDisabled) {
|
|
77789
|
-
this._posthogClient = null;
|
|
77790
|
-
this._scarfClient = null;
|
|
77791
|
-
} else if (!isBrowser) {
|
|
77792
|
-
this._posthogClient = null;
|
|
77793
|
-
this._scarfClient = null;
|
|
77794
|
-
} else {
|
|
77795
|
-
try {
|
|
77796
|
-
this._posthogClient = new TelemetryEventLogger(
|
|
77797
|
-
this.POSTHOG_PROXY_URL,
|
|
77798
|
-
3e3
|
|
77799
|
-
);
|
|
77800
|
-
} catch {
|
|
77801
|
-
this._posthogClient = null;
|
|
77802
|
-
}
|
|
77803
|
-
try {
|
|
77804
|
-
this._scarfClient = new TelemetryEventLogger(
|
|
77805
|
-
this.SCARF_PROXY_URL,
|
|
77806
|
-
3e3
|
|
77807
|
-
);
|
|
77808
|
-
} catch {
|
|
77809
|
-
this._scarfClient = null;
|
|
77810
|
-
}
|
|
77811
|
-
}
|
|
77812
|
-
}
|
|
77813
|
-
isTelemetryDisabled() {
|
|
77814
|
-
if (isLocalStorageFunctional()) {
|
|
77815
|
-
const stored = localStorage.getItem(getCacheKey("disabled"));
|
|
77816
|
-
if (stored === "true") return true;
|
|
77817
|
-
}
|
|
77818
|
-
if (typeof process !== "undefined" && process.env?.MCP_USE_ANONYMIZED_TELEMETRY === "false") {
|
|
77819
|
-
return true;
|
|
77820
|
-
}
|
|
77821
|
-
return false;
|
|
77822
|
-
}
|
|
77823
|
-
getStoredSource() {
|
|
77824
|
-
if (isLocalStorageFunctional()) {
|
|
77825
|
-
return localStorage.getItem(getCacheKey("source"));
|
|
77826
|
-
}
|
|
77827
|
-
return null;
|
|
77828
|
-
}
|
|
77829
|
-
static getInstance() {
|
|
77830
|
-
if (!_Telemetry.instance) {
|
|
77831
|
-
_Telemetry.instance = new _Telemetry();
|
|
77832
|
-
}
|
|
77833
|
-
return _Telemetry.instance;
|
|
77834
|
-
}
|
|
77835
|
-
/**
|
|
77836
|
-
* Set the source identifier for telemetry events.
|
|
77837
|
-
* This allows tracking usage from different applications.
|
|
77838
|
-
* @param source - The source identifier (e.g., "inspector-web", "inspector-standalone")
|
|
77839
|
-
*/
|
|
77840
|
-
setSource(source) {
|
|
77841
|
-
this._source = source;
|
|
77842
|
-
if (isLocalStorageFunctional()) {
|
|
77843
|
-
localStorage.setItem(getCacheKey("source"), source);
|
|
77844
|
-
}
|
|
77845
|
-
}
|
|
77846
|
-
/**
|
|
77847
|
-
* Get the current source identifier.
|
|
77848
|
-
*/
|
|
77849
|
-
getSource() {
|
|
77850
|
-
return this._source;
|
|
77851
|
-
}
|
|
77852
|
-
/**
|
|
77853
|
-
* Get the inspector's deployment mode (standalone CLI, embedded in mcp-use,
|
|
77854
|
-
* or cloud-hosted). Emitted with every telemetry event.
|
|
77855
|
-
*/
|
|
77856
|
-
getMode() {
|
|
77857
|
-
return this._mode;
|
|
77858
|
-
}
|
|
77859
|
-
get userId() {
|
|
77860
|
-
if (this._currUserId) {
|
|
77861
|
-
return this._currUserId;
|
|
77862
|
-
}
|
|
77863
|
-
if (!isBrowserEnvironment()) {
|
|
77864
|
-
this._currUserId = this.UNKNOWN_USER_ID;
|
|
77865
|
-
return this._currUserId;
|
|
77866
|
-
}
|
|
77867
|
-
try {
|
|
77868
|
-
if (!isLocalStorageFunctional()) {
|
|
77869
|
-
throw new Error("localStorage is not available or not functional");
|
|
77870
|
-
}
|
|
77871
|
-
const storedUserId = localStorage.getItem(getCacheKey("user_id"));
|
|
77872
|
-
if (storedUserId) {
|
|
77873
|
-
this._currUserId = storedUserId;
|
|
77874
|
-
} else {
|
|
77875
|
-
const newUserId = this.generateUserId();
|
|
77876
|
-
localStorage.setItem(getCacheKey("user_id"), newUserId);
|
|
77877
|
-
this._currUserId = newUserId;
|
|
77878
|
-
}
|
|
77879
|
-
this.trackPackageDownload({
|
|
77880
|
-
triggered_by: "user_id_property"
|
|
77881
|
-
}).catch(() => {
|
|
77882
|
-
});
|
|
77883
|
-
} catch {
|
|
77884
|
-
this._currUserId = this.UNKNOWN_USER_ID;
|
|
77885
|
-
}
|
|
77886
|
-
return this._currUserId;
|
|
77887
|
-
}
|
|
77888
|
-
generateUserId() {
|
|
77889
|
-
const cryptoObj = window.crypto;
|
|
77890
|
-
if (cryptoObj) {
|
|
77891
|
-
const buffer = new Uint8Array(16);
|
|
77892
|
-
cryptoObj.getRandomValues(buffer);
|
|
77893
|
-
buffer[6] = buffer[6] & 15 | 64;
|
|
77894
|
-
buffer[8] = buffer[8] & 63 | 128;
|
|
77895
|
-
const hex = Array.from(buffer).map((b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
77896
|
-
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
77897
|
-
} else {
|
|
77898
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
|
|
77899
|
-
const r2 = Math.random() * 16 | 0;
|
|
77900
|
-
const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
|
|
77901
|
-
return v2.toString(16);
|
|
77902
|
-
});
|
|
77903
|
-
}
|
|
77904
|
-
}
|
|
77905
|
-
async capture(event) {
|
|
77906
|
-
if (!this._posthogClient && !this._scarfClient) {
|
|
77907
|
-
return;
|
|
77908
|
-
}
|
|
77909
|
-
if (this._posthogClient) {
|
|
77910
|
-
try {
|
|
77911
|
-
const properties = {
|
|
77912
|
-
event: event.name,
|
|
77913
|
-
user_id: this.userId,
|
|
77914
|
-
// Include user_id for distinct_id
|
|
77915
|
-
properties: {
|
|
77916
|
-
...event.properties,
|
|
77917
|
-
mcp_use_version: getPackageVersion(),
|
|
77918
|
-
language: "typescript",
|
|
77919
|
-
source: this._source,
|
|
77920
|
-
package: "inspector",
|
|
77921
|
-
mode: this._mode
|
|
77922
|
-
}
|
|
77923
|
-
};
|
|
77924
|
-
await this._posthogClient.logEvent(properties);
|
|
77925
|
-
} catch {
|
|
77926
|
-
}
|
|
77927
|
-
}
|
|
77928
|
-
if (this._scarfClient) {
|
|
77929
|
-
try {
|
|
77930
|
-
const properties = {};
|
|
77931
|
-
properties.mcp_use_version = getPackageVersion();
|
|
77932
|
-
properties.user_id = this.userId;
|
|
77933
|
-
properties.event = event.name;
|
|
77934
|
-
properties.language = "typescript";
|
|
77935
|
-
properties.source = this._source;
|
|
77936
|
-
properties.package = "inspector";
|
|
77937
|
-
properties.mode = this._mode;
|
|
77938
|
-
await this._scarfClient.logEvent(properties);
|
|
77939
|
-
} catch {
|
|
77940
|
-
}
|
|
77941
|
-
}
|
|
77942
|
-
}
|
|
77943
|
-
async trackPackageDownload(properties) {
|
|
77944
|
-
if (!this._scarfClient) {
|
|
77945
|
-
return;
|
|
77946
|
-
}
|
|
77947
|
-
if (!isBrowserEnvironment()) {
|
|
77948
|
-
return;
|
|
77949
|
-
}
|
|
77950
|
-
try {
|
|
77951
|
-
if (!isLocalStorageFunctional()) {
|
|
77952
|
-
throw new Error("localStorage is not available or not functional");
|
|
77953
|
-
}
|
|
77954
|
-
const currentVersion = getPackageVersion();
|
|
77955
|
-
let shouldTrack = false;
|
|
77956
|
-
let firstDownload = false;
|
|
77957
|
-
const storedVersion = localStorage.getItem(
|
|
77958
|
-
getCacheKey("download_version")
|
|
77959
|
-
);
|
|
77960
|
-
if (!storedVersion) {
|
|
77961
|
-
shouldTrack = true;
|
|
77962
|
-
firstDownload = true;
|
|
77963
|
-
localStorage.setItem(getCacheKey("download_version"), currentVersion);
|
|
77964
|
-
} else if (currentVersion > storedVersion) {
|
|
77965
|
-
shouldTrack = true;
|
|
77966
|
-
firstDownload = false;
|
|
77967
|
-
localStorage.setItem(getCacheKey("download_version"), currentVersion);
|
|
77968
|
-
}
|
|
77969
|
-
if (shouldTrack) {
|
|
77970
|
-
const eventProperties = { ...properties || {} };
|
|
77971
|
-
eventProperties.mcp_use_version = currentVersion;
|
|
77972
|
-
eventProperties.user_id = this.userId;
|
|
77973
|
-
eventProperties.event = "package_download";
|
|
77974
|
-
eventProperties.first_download = firstDownload;
|
|
77975
|
-
eventProperties.language = "typescript";
|
|
77976
|
-
eventProperties.source = this._source;
|
|
77977
|
-
eventProperties.package = "inspector";
|
|
77978
|
-
eventProperties.mode = this._mode;
|
|
77979
|
-
await this._scarfClient.logEvent(eventProperties);
|
|
77980
|
-
}
|
|
77981
|
-
} catch {
|
|
77982
|
-
}
|
|
77983
|
-
}
|
|
77984
|
-
async trackInspectorOpen(data) {
|
|
77985
|
-
const event = new MCPInspectorOpenEvent(data);
|
|
77986
|
-
await this.capture(event);
|
|
77987
|
-
}
|
|
77988
|
-
};
|
|
77989
|
-
__publicField(_Telemetry, "instance", null);
|
|
77990
|
-
var Telemetry = _Telemetry;
|
|
77991
|
-
|
|
77992
77618
|
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.14_react@19.2.4/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
77993
77619
|
import * as React2 from "react";
|
|
77994
77620
|
|
|
@@ -78802,15 +78428,7 @@ function AddToClientDropdown({
|
|
|
78802
78428
|
const [selectedClient, setSelectedClient] = useState(null);
|
|
78803
78429
|
const [copied, setCopied] = useState(false);
|
|
78804
78430
|
const { url, name, headers } = serverConfig;
|
|
78805
|
-
const trackAddToClient = (client) => {
|
|
78806
|
-
try {
|
|
78807
|
-
Telemetry.getInstance().capture(new MCPAddToClientEvent({ client })).catch(() => {
|
|
78808
|
-
});
|
|
78809
|
-
} catch {
|
|
78810
|
-
}
|
|
78811
|
-
};
|
|
78812
78431
|
const handleCursorClick = () => {
|
|
78813
|
-
trackAddToClient("cursor");
|
|
78814
78432
|
try {
|
|
78815
78433
|
const deepLink = generateCursorDeepLink(url, name, headers);
|
|
78816
78434
|
window.location.href = deepLink;
|
|
@@ -78821,7 +78439,6 @@ function AddToClientDropdown({
|
|
|
78821
78439
|
}
|
|
78822
78440
|
};
|
|
78823
78441
|
const handleVSCodeClick = () => {
|
|
78824
|
-
trackAddToClient("vscode");
|
|
78825
78442
|
try {
|
|
78826
78443
|
const deepLink = generateVSCodeDeepLink(url, name, headers);
|
|
78827
78444
|
window.location.href = deepLink;
|
|
@@ -78832,7 +78449,6 @@ function AddToClientDropdown({
|
|
|
78832
78449
|
}
|
|
78833
78450
|
};
|
|
78834
78451
|
const handleVSCodeInsidersClick = () => {
|
|
78835
|
-
trackAddToClient("vscode-insiders");
|
|
78836
78452
|
try {
|
|
78837
78453
|
const deepLink = generateVSCodeInsidersDeepLink(url, name, headers);
|
|
78838
78454
|
window.location.href = deepLink;
|
|
@@ -78843,7 +78459,6 @@ function AddToClientDropdown({
|
|
|
78843
78459
|
}
|
|
78844
78460
|
};
|
|
78845
78461
|
const handleClaudeDesktopClick = () => {
|
|
78846
|
-
trackAddToClient("claude-desktop");
|
|
78847
78462
|
try {
|
|
78848
78463
|
downloadMcpbFile(url, name, headers);
|
|
78849
78464
|
onSuccess?.("Claude Desktop");
|
|
@@ -78853,17 +78468,14 @@ function AddToClientDropdown({
|
|
|
78853
78468
|
}
|
|
78854
78469
|
};
|
|
78855
78470
|
const handleClaudeCodeClick = () => {
|
|
78856
|
-
trackAddToClient("claude-code");
|
|
78857
78471
|
setSelectedClient("claude-code");
|
|
78858
78472
|
setShowModal(true);
|
|
78859
78473
|
};
|
|
78860
78474
|
const handleGeminiCLIClick = () => {
|
|
78861
|
-
trackAddToClient("gemini-cli");
|
|
78862
78475
|
setSelectedClient("gemini-cli");
|
|
78863
78476
|
setShowModal(true);
|
|
78864
78477
|
};
|
|
78865
78478
|
const handleCodexCLIClick = () => {
|
|
78866
|
-
trackAddToClient("codex-cli");
|
|
78867
78479
|
setSelectedClient("codex-cli");
|
|
78868
78480
|
setShowModal(true);
|
|
78869
78481
|
};
|
|
@@ -86709,6 +86321,341 @@ function ResizableHandle({
|
|
|
86709
86321
|
);
|
|
86710
86322
|
}
|
|
86711
86323
|
|
|
86324
|
+
// src/client/telemetry/events.ts
|
|
86325
|
+
var MCPInspectorOpenEvent = class {
|
|
86326
|
+
constructor(data) {
|
|
86327
|
+
__publicField(this, "name", "mcp_inspector_open");
|
|
86328
|
+
__publicField(this, "properties");
|
|
86329
|
+
this.properties = {
|
|
86330
|
+
server_url: data.serverUrl,
|
|
86331
|
+
connection_count: data.connectionCount
|
|
86332
|
+
};
|
|
86333
|
+
}
|
|
86334
|
+
};
|
|
86335
|
+
var MCPToolExecutionEvent = class {
|
|
86336
|
+
constructor(data) {
|
|
86337
|
+
__publicField(this, "name", "mcp_tool_execution");
|
|
86338
|
+
__publicField(this, "properties");
|
|
86339
|
+
this.properties = {
|
|
86340
|
+
tool_name: data.toolName,
|
|
86341
|
+
server_id: data.serverId,
|
|
86342
|
+
success: data.success,
|
|
86343
|
+
duration: data.duration,
|
|
86344
|
+
error: data.error
|
|
86345
|
+
};
|
|
86346
|
+
}
|
|
86347
|
+
};
|
|
86348
|
+
var MCPResourceReadEvent = class {
|
|
86349
|
+
constructor(data) {
|
|
86350
|
+
__publicField(this, "name", "mcp_resource_read");
|
|
86351
|
+
__publicField(this, "properties");
|
|
86352
|
+
this.properties = {
|
|
86353
|
+
resource_uri: data.resourceUri,
|
|
86354
|
+
server_id: data.serverId,
|
|
86355
|
+
success: data.success,
|
|
86356
|
+
error: data.error
|
|
86357
|
+
};
|
|
86358
|
+
}
|
|
86359
|
+
};
|
|
86360
|
+
var MCPPromptCallEvent = class {
|
|
86361
|
+
constructor(data) {
|
|
86362
|
+
__publicField(this, "name", "mcp_prompt_call");
|
|
86363
|
+
__publicField(this, "properties");
|
|
86364
|
+
this.properties = {
|
|
86365
|
+
prompt_name: data.promptName,
|
|
86366
|
+
server_id: data.serverId,
|
|
86367
|
+
success: data.success,
|
|
86368
|
+
error: data.error
|
|
86369
|
+
};
|
|
86370
|
+
}
|
|
86371
|
+
};
|
|
86372
|
+
var MCPChatMessageEvent = class {
|
|
86373
|
+
constructor(data) {
|
|
86374
|
+
__publicField(this, "name", "mcp_chat_message");
|
|
86375
|
+
__publicField(this, "properties");
|
|
86376
|
+
this.properties = {
|
|
86377
|
+
server_id: data.serverId,
|
|
86378
|
+
provider: data.provider,
|
|
86379
|
+
model: data.model,
|
|
86380
|
+
message_count: data.messageCount,
|
|
86381
|
+
tool_calls_count: data.toolCallsCount,
|
|
86382
|
+
success: data.success,
|
|
86383
|
+
execution_mode: data.executionMode,
|
|
86384
|
+
duration: data.duration,
|
|
86385
|
+
error: data.error
|
|
86386
|
+
};
|
|
86387
|
+
}
|
|
86388
|
+
};
|
|
86389
|
+
var MCPToolSavedEvent = class {
|
|
86390
|
+
constructor(data) {
|
|
86391
|
+
__publicField(this, "name", "mcp_tool_saved");
|
|
86392
|
+
__publicField(this, "properties");
|
|
86393
|
+
this.properties = {
|
|
86394
|
+
tool_name: data.toolName,
|
|
86395
|
+
server_id: data.serverId
|
|
86396
|
+
};
|
|
86397
|
+
}
|
|
86398
|
+
};
|
|
86399
|
+
|
|
86400
|
+
// src/client/telemetry/utils.ts
|
|
86401
|
+
function getPackageVersion() {
|
|
86402
|
+
try {
|
|
86403
|
+
if (typeof __INSPECTOR_VERSION__ !== "undefined") {
|
|
86404
|
+
return __INSPECTOR_VERSION__;
|
|
86405
|
+
}
|
|
86406
|
+
return "0.0.0";
|
|
86407
|
+
} catch {
|
|
86408
|
+
return "0.0.0";
|
|
86409
|
+
}
|
|
86410
|
+
}
|
|
86411
|
+
|
|
86412
|
+
// src/client/telemetry/telemetry.ts
|
|
86413
|
+
function isBrowserEnvironment() {
|
|
86414
|
+
try {
|
|
86415
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
86416
|
+
} catch {
|
|
86417
|
+
return false;
|
|
86418
|
+
}
|
|
86419
|
+
}
|
|
86420
|
+
var TelemetryEventLogger = class {
|
|
86421
|
+
constructor(endpoint, timeout = 3e3) {
|
|
86422
|
+
__publicField(this, "endpoint");
|
|
86423
|
+
__publicField(this, "timeout");
|
|
86424
|
+
this.endpoint = endpoint;
|
|
86425
|
+
this.timeout = timeout;
|
|
86426
|
+
}
|
|
86427
|
+
async logEvent(properties) {
|
|
86428
|
+
try {
|
|
86429
|
+
const controller = new AbortController();
|
|
86430
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
86431
|
+
const response = await fetch(this.endpoint, {
|
|
86432
|
+
method: "POST",
|
|
86433
|
+
headers: {
|
|
86434
|
+
"Content-Type": "application/json"
|
|
86435
|
+
},
|
|
86436
|
+
body: JSON.stringify(properties),
|
|
86437
|
+
signal: controller.signal
|
|
86438
|
+
});
|
|
86439
|
+
clearTimeout(timeoutId);
|
|
86440
|
+
if (!response.ok) {
|
|
86441
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
86442
|
+
}
|
|
86443
|
+
} catch {
|
|
86444
|
+
}
|
|
86445
|
+
}
|
|
86446
|
+
};
|
|
86447
|
+
function getCacheKey(key) {
|
|
86448
|
+
return `mcp_inspector_telemetry_${key}`;
|
|
86449
|
+
}
|
|
86450
|
+
function isLocalStorageFunctional() {
|
|
86451
|
+
return typeof localStorage !== "undefined" && typeof localStorage.getItem === "function" && typeof localStorage.setItem === "function";
|
|
86452
|
+
}
|
|
86453
|
+
var _Telemetry = class _Telemetry {
|
|
86454
|
+
constructor() {
|
|
86455
|
+
__publicField(this, "POSTHOG_PROXY_URL", "/inspector/api/tel/posthog");
|
|
86456
|
+
__publicField(this, "SCARF_PROXY_URL", "/inspector/api/tel/scarf");
|
|
86457
|
+
__publicField(this, "UNKNOWN_USER_ID", "UNKNOWN_USER_ID");
|
|
86458
|
+
__publicField(this, "_currUserId", null);
|
|
86459
|
+
__publicField(this, "_posthogClient", null);
|
|
86460
|
+
__publicField(this, "_scarfClient", null);
|
|
86461
|
+
__publicField(this, "_source", "inspector");
|
|
86462
|
+
const isBrowser = isBrowserEnvironment();
|
|
86463
|
+
const telemetryDisabled = this.isTelemetryDisabled();
|
|
86464
|
+
this._source = this.getStoredSource() || "inspector";
|
|
86465
|
+
if (telemetryDisabled) {
|
|
86466
|
+
this._posthogClient = null;
|
|
86467
|
+
this._scarfClient = null;
|
|
86468
|
+
} else if (!isBrowser) {
|
|
86469
|
+
this._posthogClient = null;
|
|
86470
|
+
this._scarfClient = null;
|
|
86471
|
+
} else {
|
|
86472
|
+
try {
|
|
86473
|
+
this._posthogClient = new TelemetryEventLogger(
|
|
86474
|
+
this.POSTHOG_PROXY_URL,
|
|
86475
|
+
3e3
|
|
86476
|
+
);
|
|
86477
|
+
} catch {
|
|
86478
|
+
this._posthogClient = null;
|
|
86479
|
+
}
|
|
86480
|
+
try {
|
|
86481
|
+
this._scarfClient = new TelemetryEventLogger(
|
|
86482
|
+
this.SCARF_PROXY_URL,
|
|
86483
|
+
3e3
|
|
86484
|
+
);
|
|
86485
|
+
} catch {
|
|
86486
|
+
this._scarfClient = null;
|
|
86487
|
+
}
|
|
86488
|
+
}
|
|
86489
|
+
}
|
|
86490
|
+
isTelemetryDisabled() {
|
|
86491
|
+
if (isLocalStorageFunctional()) {
|
|
86492
|
+
const stored = localStorage.getItem(getCacheKey("disabled"));
|
|
86493
|
+
if (stored === "true") return true;
|
|
86494
|
+
}
|
|
86495
|
+
if (typeof process !== "undefined" && process.env?.MCP_USE_ANONYMIZED_TELEMETRY === "false") {
|
|
86496
|
+
return true;
|
|
86497
|
+
}
|
|
86498
|
+
return false;
|
|
86499
|
+
}
|
|
86500
|
+
getStoredSource() {
|
|
86501
|
+
if (isLocalStorageFunctional()) {
|
|
86502
|
+
return localStorage.getItem(getCacheKey("source"));
|
|
86503
|
+
}
|
|
86504
|
+
return null;
|
|
86505
|
+
}
|
|
86506
|
+
static getInstance() {
|
|
86507
|
+
if (!_Telemetry.instance) {
|
|
86508
|
+
_Telemetry.instance = new _Telemetry();
|
|
86509
|
+
}
|
|
86510
|
+
return _Telemetry.instance;
|
|
86511
|
+
}
|
|
86512
|
+
/**
|
|
86513
|
+
* Set the source identifier for telemetry events.
|
|
86514
|
+
* This allows tracking usage from different applications.
|
|
86515
|
+
* @param source - The source identifier (e.g., "inspector-web", "inspector-standalone")
|
|
86516
|
+
*/
|
|
86517
|
+
setSource(source) {
|
|
86518
|
+
this._source = source;
|
|
86519
|
+
if (isLocalStorageFunctional()) {
|
|
86520
|
+
localStorage.setItem(getCacheKey("source"), source);
|
|
86521
|
+
}
|
|
86522
|
+
}
|
|
86523
|
+
/**
|
|
86524
|
+
* Get the current source identifier.
|
|
86525
|
+
*/
|
|
86526
|
+
getSource() {
|
|
86527
|
+
return this._source;
|
|
86528
|
+
}
|
|
86529
|
+
get userId() {
|
|
86530
|
+
if (this._currUserId) {
|
|
86531
|
+
return this._currUserId;
|
|
86532
|
+
}
|
|
86533
|
+
if (!isBrowserEnvironment()) {
|
|
86534
|
+
this._currUserId = this.UNKNOWN_USER_ID;
|
|
86535
|
+
return this._currUserId;
|
|
86536
|
+
}
|
|
86537
|
+
try {
|
|
86538
|
+
if (!isLocalStorageFunctional()) {
|
|
86539
|
+
throw new Error("localStorage is not available or not functional");
|
|
86540
|
+
}
|
|
86541
|
+
const storedUserId = localStorage.getItem(getCacheKey("user_id"));
|
|
86542
|
+
if (storedUserId) {
|
|
86543
|
+
this._currUserId = storedUserId;
|
|
86544
|
+
} else {
|
|
86545
|
+
const newUserId = this.generateUserId();
|
|
86546
|
+
localStorage.setItem(getCacheKey("user_id"), newUserId);
|
|
86547
|
+
this._currUserId = newUserId;
|
|
86548
|
+
}
|
|
86549
|
+
this.trackPackageDownload({
|
|
86550
|
+
triggered_by: "user_id_property"
|
|
86551
|
+
}).catch(() => {
|
|
86552
|
+
});
|
|
86553
|
+
} catch {
|
|
86554
|
+
this._currUserId = this.UNKNOWN_USER_ID;
|
|
86555
|
+
}
|
|
86556
|
+
return this._currUserId;
|
|
86557
|
+
}
|
|
86558
|
+
generateUserId() {
|
|
86559
|
+
const cryptoObj = window.crypto;
|
|
86560
|
+
if (cryptoObj) {
|
|
86561
|
+
const buffer = new Uint8Array(16);
|
|
86562
|
+
cryptoObj.getRandomValues(buffer);
|
|
86563
|
+
buffer[6] = buffer[6] & 15 | 64;
|
|
86564
|
+
buffer[8] = buffer[8] & 63 | 128;
|
|
86565
|
+
const hex = Array.from(buffer).map((b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
86566
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
86567
|
+
} else {
|
|
86568
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
|
|
86569
|
+
const r2 = Math.random() * 16 | 0;
|
|
86570
|
+
const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
|
|
86571
|
+
return v2.toString(16);
|
|
86572
|
+
});
|
|
86573
|
+
}
|
|
86574
|
+
}
|
|
86575
|
+
async capture(event) {
|
|
86576
|
+
if (!this._posthogClient && !this._scarfClient) {
|
|
86577
|
+
return;
|
|
86578
|
+
}
|
|
86579
|
+
if (this._posthogClient) {
|
|
86580
|
+
try {
|
|
86581
|
+
const properties = {
|
|
86582
|
+
event: event.name,
|
|
86583
|
+
user_id: this.userId,
|
|
86584
|
+
// Include user_id for distinct_id
|
|
86585
|
+
properties: {
|
|
86586
|
+
...event.properties,
|
|
86587
|
+
mcp_use_version: getPackageVersion(),
|
|
86588
|
+
language: "typescript",
|
|
86589
|
+
source: this._source,
|
|
86590
|
+
package: "inspector"
|
|
86591
|
+
}
|
|
86592
|
+
};
|
|
86593
|
+
await this._posthogClient.logEvent(properties);
|
|
86594
|
+
} catch {
|
|
86595
|
+
}
|
|
86596
|
+
}
|
|
86597
|
+
if (this._scarfClient) {
|
|
86598
|
+
try {
|
|
86599
|
+
const properties = {};
|
|
86600
|
+
properties.mcp_use_version = getPackageVersion();
|
|
86601
|
+
properties.user_id = this.userId;
|
|
86602
|
+
properties.event = event.name;
|
|
86603
|
+
properties.language = "typescript";
|
|
86604
|
+
properties.source = this._source;
|
|
86605
|
+
properties.package = "inspector";
|
|
86606
|
+
await this._scarfClient.logEvent(properties);
|
|
86607
|
+
} catch {
|
|
86608
|
+
}
|
|
86609
|
+
}
|
|
86610
|
+
}
|
|
86611
|
+
async trackPackageDownload(properties) {
|
|
86612
|
+
if (!this._scarfClient) {
|
|
86613
|
+
return;
|
|
86614
|
+
}
|
|
86615
|
+
if (!isBrowserEnvironment()) {
|
|
86616
|
+
return;
|
|
86617
|
+
}
|
|
86618
|
+
try {
|
|
86619
|
+
if (!isLocalStorageFunctional()) {
|
|
86620
|
+
throw new Error("localStorage is not available or not functional");
|
|
86621
|
+
}
|
|
86622
|
+
const currentVersion = getPackageVersion();
|
|
86623
|
+
let shouldTrack = false;
|
|
86624
|
+
let firstDownload = false;
|
|
86625
|
+
const storedVersion = localStorage.getItem(
|
|
86626
|
+
getCacheKey("download_version")
|
|
86627
|
+
);
|
|
86628
|
+
if (!storedVersion) {
|
|
86629
|
+
shouldTrack = true;
|
|
86630
|
+
firstDownload = true;
|
|
86631
|
+
localStorage.setItem(getCacheKey("download_version"), currentVersion);
|
|
86632
|
+
} else if (currentVersion > storedVersion) {
|
|
86633
|
+
shouldTrack = true;
|
|
86634
|
+
firstDownload = false;
|
|
86635
|
+
localStorage.setItem(getCacheKey("download_version"), currentVersion);
|
|
86636
|
+
}
|
|
86637
|
+
if (shouldTrack) {
|
|
86638
|
+
const eventProperties = { ...properties || {} };
|
|
86639
|
+
eventProperties.mcp_use_version = currentVersion;
|
|
86640
|
+
eventProperties.user_id = this.userId;
|
|
86641
|
+
eventProperties.event = "package_download";
|
|
86642
|
+
eventProperties.first_download = firstDownload;
|
|
86643
|
+
eventProperties.language = "typescript";
|
|
86644
|
+
eventProperties.source = this._source;
|
|
86645
|
+
eventProperties.package = "inspector";
|
|
86646
|
+
await this._scarfClient.logEvent(eventProperties);
|
|
86647
|
+
}
|
|
86648
|
+
} catch {
|
|
86649
|
+
}
|
|
86650
|
+
}
|
|
86651
|
+
async trackInspectorOpen(data) {
|
|
86652
|
+
const event = new MCPInspectorOpenEvent(data);
|
|
86653
|
+
await this.capture(event);
|
|
86654
|
+
}
|
|
86655
|
+
};
|
|
86656
|
+
__publicField(_Telemetry, "instance", null);
|
|
86657
|
+
var Telemetry = _Telemetry;
|
|
86658
|
+
|
|
86712
86659
|
// src/client/components/ToolsTab.tsx
|
|
86713
86660
|
import { AnimatePresence, motion as motion2 } from "motion/react";
|
|
86714
86661
|
import { ChevronLeft } from "lucide-react";
|
|
@@ -88660,7 +88607,6 @@ function ToolsTab({
|
|
|
88660
88607
|
})
|
|
88661
88608
|
).catch(() => {
|
|
88662
88609
|
});
|
|
88663
|
-
window.dispatchEvent(new Event("mcp-tool-executed"));
|
|
88664
88610
|
let appsSdkResource;
|
|
88665
88611
|
if (widgetResourceUri && typeof widgetResourceUri === "string") {
|
|
88666
88612
|
let resourceData = preFetchedResource;
|
|
@@ -88738,7 +88684,6 @@ function ToolsTab({
|
|
|
88738
88684
|
})
|
|
88739
88685
|
).catch(() => {
|
|
88740
88686
|
});
|
|
88741
|
-
window.dispatchEvent(new Event("mcp-tool-executed"));
|
|
88742
88687
|
const toolMeta = selectedTool?._meta || selectedTool?.metadata;
|
|
88743
88688
|
const errorResult = {
|
|
88744
88689
|
toolName: selectedTool.name,
|
|
@@ -89914,16 +89859,6 @@ function useConfig({ mcpServerUrl }) {
|
|
|
89914
89859
|
JSON.stringify(newAuthConfig)
|
|
89915
89860
|
);
|
|
89916
89861
|
window.dispatchEvent(new CustomEvent("llm-config-updated"));
|
|
89917
|
-
try {
|
|
89918
|
-
Telemetry.getInstance().capture(
|
|
89919
|
-
new MCPChatConfiguredEvent({
|
|
89920
|
-
provider: tempProvider,
|
|
89921
|
-
model: tempModel
|
|
89922
|
-
})
|
|
89923
|
-
).catch(() => {
|
|
89924
|
-
});
|
|
89925
|
-
} catch {
|
|
89926
|
-
}
|
|
89927
89862
|
setConfigDialogOpen(false);
|
|
89928
89863
|
}, [
|
|
89929
89864
|
tempProvider,
|