@mcp-use/inspector 2.0.0 → 2.1.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/cdn/inspector.css +1 -1
- package/dist/cdn/inspector.js +25706 -25420
- package/dist/cli.js +12 -1
- 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 +431 -366
- package/dist/client/telemetry/events.d.ts +54 -0
- package/dist/client/telemetry/events.d.ts.map +1 -1
- package/dist/client/telemetry/telemetry.d.ts +7 -0
- package/dist/client/telemetry/telemetry.d.ts.map +1 -1
- package/dist/server/{chunk-TJIMGJEY.js → chunk-CGBTAGR7.js} +10 -0
- package/dist/server/{chunk-LMSWBFF2.js → chunk-VYFEI5EK.js} +3 -2
- package/dist/server/cli.js +3 -2
- 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 +7 -0
- package/dist/server/shared-static.d.ts.map +1 -1
- package/dist/server/shared-static.js +1 -1
- package/dist/web/assets/{browser-MRsu2gXI.js → browser-nJL1SP5x.js} +3 -3
- package/dist/web/assets/{chunk-KTNIDGGJ-BhVuC_-M.js → chunk-F77S5WQQ-ObNc3qBe.js} +1 -1
- package/dist/web/assets/{chunk-LG5NSHEL-xh9zn4kA.js → chunk-LG5NSHEL-K0Lmy74o.js} +1 -1
- package/dist/web/assets/{chunk-T7VJV5W2-DxZ7xzIS.js → chunk-NRAKYNPD-DwSIPago.js} +1 -1
- package/dist/web/assets/{client-PK767MHF-B1Fl2lc6.js → client-443O24GJ-PPorrF4M.js} +3 -3
- package/dist/web/assets/{client-CB9M8odq.js → client-T9accjYH.js} +1 -1
- package/dist/web/assets/index-D-jT1sqH.css +2 -0
- package/dist/web/assets/index-D-uU84KW.js +720 -0
- package/dist/web/assets/react-B4a8I_-E.js +1 -0
- package/dist/web/assets/{stdio-6UZMVUCN-BkJtimjb.js → stdio-DVDETVUP-DuFUjAr0.js} +1 -1
- package/dist/web/index.html +6 -6
- package/package.json +3 -3
- package/dist/web/assets/index-CG1YzZnl.js +0 -720
- package/dist/web/assets/index-CM9P_1sf.css +0 -2
- package/dist/web/assets/react-C2F7FvmN.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-6JG7CF5A.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_6JG7CF5A = __esm({
|
|
5349
|
+
"../mcp-use/dist/chunk-6JG7CF5A.js"() {
|
|
5350
5350
|
"use strict";
|
|
5351
5351
|
init_chunk_QWQYAQCK();
|
|
5352
5352
|
init_chunk_3GQAWCBQ();
|
|
5353
|
-
VERSION = "1.24.
|
|
5353
|
+
VERSION = "1.24.1-canary.1";
|
|
5354
5354
|
__name(getPackageVersion2, "getPackageVersion");
|
|
5355
5355
|
BaseTelemetryEvent = (_a3 = class {
|
|
5356
5356
|
}, __name(_a3, "BaseTelemetryEvent"), _a3);
|
|
@@ -6620,7 +6620,7 @@ var init_chunk_C4ISR4J4 = __esm({
|
|
|
6620
6620
|
}
|
|
6621
6621
|
});
|
|
6622
6622
|
|
|
6623
|
-
// ../mcp-use/dist/chunk-
|
|
6623
|
+
// ../mcp-use/dist/chunk-F77S5WQQ.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_F77S5WQQ = __esm({
|
|
6689
|
+
"../mcp-use/dist/chunk-F77S5WQQ.js"() {
|
|
6690
6690
|
"use strict";
|
|
6691
|
-
|
|
6691
|
+
init_chunk_6JG7CF5A();
|
|
6692
6692
|
init_chunk_QWQYAQCK();
|
|
6693
6693
|
init_chunk_3GQAWCBQ();
|
|
6694
6694
|
SseConnectionManager = (_a18 = class extends ConnectionManager {
|
|
@@ -7947,7 +7947,7 @@ var init_chunk_KTNIDGGJ = __esm({
|
|
|
7947
7947
|
}
|
|
7948
7948
|
});
|
|
7949
7949
|
|
|
7950
|
-
// ../mcp-use/dist/chunk-
|
|
7950
|
+
// ../mcp-use/dist/chunk-NRAKYNPD.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_NRAKYNPD = __esm({
|
|
8261
|
+
"../mcp-use/dist/chunk-NRAKYNPD.js"() {
|
|
8262
8262
|
"use strict";
|
|
8263
|
-
|
|
8264
|
-
|
|
8263
|
+
init_chunk_F77S5WQQ();
|
|
8264
|
+
init_chunk_6JG7CF5A();
|
|
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-DVDETVUP.js
|
|
27982
|
+
var stdio_DVDETVUP_exports = {};
|
|
27983
|
+
__export(stdio_DVDETVUP_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_DVDETVUP = __esm({
|
|
27990
|
+
"../mcp-use/dist/stdio-DVDETVUP.js"() {
|
|
27991
27991
|
"use strict";
|
|
27992
|
-
|
|
27992
|
+
init_chunk_6JG7CF5A();
|
|
27993
27993
|
init_chunk_QWQYAQCK();
|
|
27994
27994
|
init_chunk_3GQAWCBQ();
|
|
27995
27995
|
init_stdio_transport();
|
|
@@ -28133,9 +28133,9 @@ var init_stdio_6UZMVUCN = __esm({
|
|
|
28133
28133
|
}
|
|
28134
28134
|
});
|
|
28135
28135
|
|
|
28136
|
-
// ../mcp-use/dist/client-
|
|
28137
|
-
var
|
|
28138
|
-
__export(
|
|
28136
|
+
// ../mcp-use/dist/client-443O24GJ.js
|
|
28137
|
+
var client_443O24GJ_exports = {};
|
|
28138
|
+
__export(client_443O24GJ_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_443O24GJ = __esm({
|
|
28279
|
+
"../mcp-use/dist/client-443O24GJ.js"() {
|
|
28280
28280
|
"use strict";
|
|
28281
28281
|
init_chunk_LG5NSHEL();
|
|
28282
|
-
|
|
28283
|
-
|
|
28282
|
+
init_chunk_F77S5WQQ();
|
|
28283
|
+
init_chunk_6JG7CF5A();
|
|
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_DVDETVUP(), stdio_DVDETVUP_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_NRAKYNPD();
|
|
74900
74900
|
init_chunk_UJPHRNQP();
|
|
74901
74901
|
init_chunk_LG5NSHEL();
|
|
74902
|
-
|
|
74903
|
-
|
|
74902
|
+
init_chunk_F77S5WQQ();
|
|
74903
|
+
init_chunk_6JG7CF5A();
|
|
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_443O24GJ(), client_443O24GJ_exports));
|
|
76251
76251
|
this.client = new MCPClient2({ mcpServers: this.mcpServersConfig });
|
|
76252
76252
|
logger.debug("\u2705 MCPClient created successfully");
|
|
76253
76253
|
}
|
|
@@ -77615,6 +77615,380 @@ ${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
|
+
|
|
77618
77992
|
// ../../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
|
|
77619
77993
|
import * as React2 from "react";
|
|
77620
77994
|
|
|
@@ -78428,7 +78802,15 @@ function AddToClientDropdown({
|
|
|
78428
78802
|
const [selectedClient, setSelectedClient] = useState(null);
|
|
78429
78803
|
const [copied, setCopied] = useState(false);
|
|
78430
78804
|
const { url, name, headers } = serverConfig;
|
|
78805
|
+
const trackAddToClient = (client) => {
|
|
78806
|
+
try {
|
|
78807
|
+
Telemetry.getInstance().capture(new MCPAddToClientEvent({ client })).catch(() => {
|
|
78808
|
+
});
|
|
78809
|
+
} catch {
|
|
78810
|
+
}
|
|
78811
|
+
};
|
|
78431
78812
|
const handleCursorClick = () => {
|
|
78813
|
+
trackAddToClient("cursor");
|
|
78432
78814
|
try {
|
|
78433
78815
|
const deepLink = generateCursorDeepLink(url, name, headers);
|
|
78434
78816
|
window.location.href = deepLink;
|
|
@@ -78439,6 +78821,7 @@ function AddToClientDropdown({
|
|
|
78439
78821
|
}
|
|
78440
78822
|
};
|
|
78441
78823
|
const handleVSCodeClick = () => {
|
|
78824
|
+
trackAddToClient("vscode");
|
|
78442
78825
|
try {
|
|
78443
78826
|
const deepLink = generateVSCodeDeepLink(url, name, headers);
|
|
78444
78827
|
window.location.href = deepLink;
|
|
@@ -78449,6 +78832,7 @@ function AddToClientDropdown({
|
|
|
78449
78832
|
}
|
|
78450
78833
|
};
|
|
78451
78834
|
const handleVSCodeInsidersClick = () => {
|
|
78835
|
+
trackAddToClient("vscode-insiders");
|
|
78452
78836
|
try {
|
|
78453
78837
|
const deepLink = generateVSCodeInsidersDeepLink(url, name, headers);
|
|
78454
78838
|
window.location.href = deepLink;
|
|
@@ -78459,6 +78843,7 @@ function AddToClientDropdown({
|
|
|
78459
78843
|
}
|
|
78460
78844
|
};
|
|
78461
78845
|
const handleClaudeDesktopClick = () => {
|
|
78846
|
+
trackAddToClient("claude-desktop");
|
|
78462
78847
|
try {
|
|
78463
78848
|
downloadMcpbFile(url, name, headers);
|
|
78464
78849
|
onSuccess?.("Claude Desktop");
|
|
@@ -78468,14 +78853,17 @@ function AddToClientDropdown({
|
|
|
78468
78853
|
}
|
|
78469
78854
|
};
|
|
78470
78855
|
const handleClaudeCodeClick = () => {
|
|
78856
|
+
trackAddToClient("claude-code");
|
|
78471
78857
|
setSelectedClient("claude-code");
|
|
78472
78858
|
setShowModal(true);
|
|
78473
78859
|
};
|
|
78474
78860
|
const handleGeminiCLIClick = () => {
|
|
78861
|
+
trackAddToClient("gemini-cli");
|
|
78475
78862
|
setSelectedClient("gemini-cli");
|
|
78476
78863
|
setShowModal(true);
|
|
78477
78864
|
};
|
|
78478
78865
|
const handleCodexCLIClick = () => {
|
|
78866
|
+
trackAddToClient("codex-cli");
|
|
78479
78867
|
setSelectedClient("codex-cli");
|
|
78480
78868
|
setShowModal(true);
|
|
78481
78869
|
};
|
|
@@ -86321,341 +86709,6 @@ function ResizableHandle({
|
|
|
86321
86709
|
);
|
|
86322
86710
|
}
|
|
86323
86711
|
|
|
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
|
-
|
|
86659
86712
|
// src/client/components/ToolsTab.tsx
|
|
86660
86713
|
import { AnimatePresence, motion as motion2 } from "motion/react";
|
|
86661
86714
|
import { ChevronLeft } from "lucide-react";
|
|
@@ -88607,6 +88660,7 @@ function ToolsTab({
|
|
|
88607
88660
|
})
|
|
88608
88661
|
).catch(() => {
|
|
88609
88662
|
});
|
|
88663
|
+
window.dispatchEvent(new Event("mcp-tool-executed"));
|
|
88610
88664
|
let appsSdkResource;
|
|
88611
88665
|
if (widgetResourceUri && typeof widgetResourceUri === "string") {
|
|
88612
88666
|
let resourceData = preFetchedResource;
|
|
@@ -88684,6 +88738,7 @@ function ToolsTab({
|
|
|
88684
88738
|
})
|
|
88685
88739
|
).catch(() => {
|
|
88686
88740
|
});
|
|
88741
|
+
window.dispatchEvent(new Event("mcp-tool-executed"));
|
|
88687
88742
|
const toolMeta = selectedTool?._meta || selectedTool?.metadata;
|
|
88688
88743
|
const errorResult = {
|
|
88689
88744
|
toolName: selectedTool.name,
|
|
@@ -89859,6 +89914,16 @@ function useConfig({ mcpServerUrl }) {
|
|
|
89859
89914
|
JSON.stringify(newAuthConfig)
|
|
89860
89915
|
);
|
|
89861
89916
|
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
|
+
}
|
|
89862
89927
|
setConfigDialogOpen(false);
|
|
89863
89928
|
}, [
|
|
89864
89929
|
tempProvider,
|