mcp-use 1.10.0-canary.6 → 1.10.0-canary.8

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.
Files changed (58) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/{chunk-464BT6EX.js → chunk-6W6MURTQ.js} +2 -2
  3. package/dist/{chunk-XU3C6BYJ.js → chunk-BBOYAKT6.js} +14 -0
  4. package/dist/{chunk-FWN7BKNM.js → chunk-CAIRNNL6.js} +14 -1
  5. package/dist/chunk-ITRC7CNB.js +942 -0
  6. package/dist/{chunk-7RUUAWVB.js → chunk-J75I2C26.js} +38 -10
  7. package/dist/{chunk-7AZ4YFTN.js → chunk-MSA3YBQE.js} +1 -1
  8. package/dist/{chunk-T4B7QDPT.js → chunk-QBKQ6JN2.js} +20 -4
  9. package/dist/{chunk-YMJL66MY.js → chunk-X5QAXENQ.js} +12 -402
  10. package/dist/index.cjs +617 -86
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +51 -18
  14. package/dist/src/agents/index.cjs +2050 -1603
  15. package/dist/src/agents/index.js +4 -4
  16. package/dist/src/agents/mcp_agent.d.ts +5 -0
  17. package/dist/src/agents/mcp_agent.d.ts.map +1 -1
  18. package/dist/src/auth/callback.d.ts.map +1 -1
  19. package/dist/src/auth/index.cjs +38 -10
  20. package/dist/src/auth/index.js +1 -1
  21. package/dist/src/browser.cjs +3277 -2770
  22. package/dist/src/browser.d.ts +1 -0
  23. package/dist/src/browser.d.ts.map +1 -1
  24. package/dist/src/browser.js +10 -5
  25. package/dist/src/client/browser.d.ts +5 -0
  26. package/dist/src/client/browser.d.ts.map +1 -1
  27. package/dist/src/client/prompts.cjs +12 -3
  28. package/dist/src/client/prompts.js +3 -2
  29. package/dist/src/client.d.ts +6 -0
  30. package/dist/src/client.d.ts.map +1 -1
  31. package/dist/src/connectors/base.d.ts +20 -10
  32. package/dist/src/connectors/base.d.ts.map +1 -1
  33. package/dist/src/connectors/http.d.ts.map +1 -1
  34. package/dist/src/connectors/stdio.d.ts.map +1 -1
  35. package/dist/src/react/index.cjs +877 -22
  36. package/dist/src/react/index.js +5 -5
  37. package/dist/src/server/endpoints/mount-mcp.d.ts.map +1 -1
  38. package/dist/src/server/index.cjs +1352 -78
  39. package/dist/src/server/index.d.ts +1 -0
  40. package/dist/src/server/index.d.ts.map +1 -1
  41. package/dist/src/server/index.js +199 -53
  42. package/dist/src/server/mcp-server.d.ts +31 -6
  43. package/dist/src/server/mcp-server.d.ts.map +1 -1
  44. package/dist/src/server/tools/tool-execution-helpers.d.ts.map +1 -1
  45. package/dist/src/server/widgets/mount-widgets-dev.d.ts.map +1 -1
  46. package/dist/src/telemetry/events.d.ts +219 -0
  47. package/dist/src/telemetry/events.d.ts.map +1 -1
  48. package/dist/src/telemetry/index.d.ts +2 -2
  49. package/dist/src/telemetry/index.d.ts.map +1 -1
  50. package/dist/src/telemetry/telemetry.d.ts +56 -1
  51. package/dist/src/telemetry/telemetry.d.ts.map +1 -1
  52. package/dist/src/telemetry/utils.d.ts +1 -1
  53. package/dist/src/telemetry/utils.d.ts.map +1 -1
  54. package/dist/src/version.d.ts +8 -0
  55. package/dist/src/version.d.ts.map +1 -0
  56. package/dist/{tool-execution-helpers-M5RO4YO2.js → tool-execution-helpers-BMGQQKS2.js} +3 -2
  57. package/package.json +5 -4
  58. package/dist/chunk-MTHLLDCX.js +0 -97
@@ -369,16 +369,44 @@ async function onMcpAuthorization() {
369
369
  );
370
370
  }
371
371
  try {
372
- document.body.innerHTML = `
373
- <div style="font-family: sans-serif; padding: 20px;">
374
- <h1>Authentication Error</h1>
375
- <p style="color: red; background-color: #ffebeb; border: 1px solid red; padding: 10px; border-radius: 4px;">
376
- ${errorMessage}
377
- </p>
378
- <p>You can close this window or <a href="#" onclick="window.close(); return false;">click here to close</a>.</p>
379
- <pre style="font-size: 0.8em; color: #555; margin-top: 20px; white-space: pre-wrap;">${err instanceof Error ? err.stack : ""}</pre>
380
- </div>
381
- `;
372
+ document.body.innerHTML = "";
373
+ const container = document.createElement("div");
374
+ container.style.fontFamily = "sans-serif";
375
+ container.style.padding = "20px";
376
+ const heading = document.createElement("h1");
377
+ heading.textContent = "Authentication Error";
378
+ container.appendChild(heading);
379
+ const errorPara = document.createElement("p");
380
+ errorPara.style.color = "red";
381
+ errorPara.style.backgroundColor = "#ffebeb";
382
+ errorPara.style.border = "1px solid red";
383
+ errorPara.style.padding = "10px";
384
+ errorPara.style.borderRadius = "4px";
385
+ errorPara.textContent = errorMessage;
386
+ container.appendChild(errorPara);
387
+ const closePara = document.createElement("p");
388
+ closePara.textContent = "You can close this window or ";
389
+ const closeLink = document.createElement("a");
390
+ closeLink.href = "#";
391
+ closeLink.textContent = "click here to close";
392
+ closeLink.onclick = (e) => {
393
+ e.preventDefault();
394
+ window.close();
395
+ return false;
396
+ };
397
+ closePara.appendChild(closeLink);
398
+ closePara.appendChild(document.createTextNode("."));
399
+ container.appendChild(closePara);
400
+ if (err instanceof Error && err.stack) {
401
+ const stackPre = document.createElement("pre");
402
+ stackPre.style.fontSize = "0.8em";
403
+ stackPre.style.color = "#555";
404
+ stackPre.style.marginTop = "20px";
405
+ stackPre.style.whiteSpace = "pre-wrap";
406
+ stackPre.textContent = err.stack;
407
+ container.appendChild(stackPre);
408
+ }
409
+ document.body.appendChild(container);
382
410
  } catch (displayError) {
383
411
  console.error(
384
412
  `${logPrefix} Could not display error in callback window:`,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseConnector
3
- } from "./chunk-XU3C6BYJ.js";
3
+ } from "./chunk-BBOYAKT6.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-3GQAWCBQ.js";
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  BaseConnector
3
- } from "./chunk-XU3C6BYJ.js";
3
+ } from "./chunk-BBOYAKT6.js";
4
+ import {
5
+ generateUUID,
6
+ getPackageVersion
7
+ } from "./chunk-ITRC7CNB.js";
4
8
  import {
5
9
  logger
6
10
  } from "./chunk-34R6SIER.js";
7
- import {
8
- generateUUID
9
- } from "./chunk-MTHLLDCX.js";
10
11
  import {
11
12
  __name
12
13
  } from "./chunk-3GQAWCBQ.js";
@@ -636,6 +637,10 @@ var HttpConnector = class extends BaseConnector {
636
637
  logger.debug(
637
638
  `Successfully connected to MCP implementation via streamable HTTP: ${baseUrl}`
638
639
  );
640
+ this.trackConnectorInit({
641
+ serverUrl: this.baseUrl,
642
+ publicIdentifier: `${this.baseUrl} (streamable-http)`
643
+ });
639
644
  } catch (err) {
640
645
  await this.cleanupResources();
641
646
  throw err;
@@ -683,6 +688,10 @@ var HttpConnector = class extends BaseConnector {
683
688
  logger.debug(
684
689
  `Successfully connected to MCP implementation via HTTP/SSE: ${baseUrl}`
685
690
  );
691
+ this.trackConnectorInit({
692
+ serverUrl: this.baseUrl,
693
+ publicIdentifier: `${this.baseUrl} (sse)`
694
+ });
686
695
  } catch (err) {
687
696
  await this.cleanupResources();
688
697
  throw err;
@@ -1098,6 +1107,13 @@ var BrowserMCPClient = class _BrowserMCPClient extends BaseMCPClient {
1098
1107
  static {
1099
1108
  __name(this, "BrowserMCPClient");
1100
1109
  }
1110
+ /**
1111
+ * Get the mcp-use package version.
1112
+ * Works in all environments (Node.js, browser, Cloudflare Workers, Deno, etc.)
1113
+ */
1114
+ static getPackageVersion() {
1115
+ return getPackageVersion();
1116
+ }
1101
1117
  constructor(config) {
1102
1118
  super(config);
1103
1119
  }
@@ -1,9 +1,11 @@
1
+ import {
2
+ Telemetry,
3
+ extractModelInfo,
4
+ getPackageVersion
5
+ } from "./chunk-ITRC7CNB.js";
1
6
  import {
2
7
  logger
3
8
  } from "./chunk-34R6SIER.js";
4
- import {
5
- generateUUID
6
- } from "./chunk-MTHLLDCX.js";
7
9
  import {
8
10
  __name
9
11
  } from "./chunk-3GQAWCBQ.js";
@@ -1400,403 +1402,6 @@ var ObservabilityManager = class {
1400
1402
  }
1401
1403
  };
1402
1404
 
1403
- // src/telemetry/telemetry.ts
1404
- import * as fs2 from "fs";
1405
- import * as os from "os";
1406
- import * as path2 from "path";
1407
- import { PostHog } from "posthog-node";
1408
-
1409
- // src/telemetry/events.ts
1410
- var BaseTelemetryEvent = class {
1411
- static {
1412
- __name(this, "BaseTelemetryEvent");
1413
- }
1414
- };
1415
- var MCPAgentExecutionEvent = class extends BaseTelemetryEvent {
1416
- constructor(data) {
1417
- super();
1418
- this.data = data;
1419
- }
1420
- static {
1421
- __name(this, "MCPAgentExecutionEvent");
1422
- }
1423
- get name() {
1424
- return "mcp_agent_execution";
1425
- }
1426
- get properties() {
1427
- return {
1428
- // Core execution info
1429
- execution_method: this.data.executionMethod,
1430
- query: this.data.query,
1431
- query_length: this.data.query.length,
1432
- success: this.data.success,
1433
- // Agent configuration
1434
- model_provider: this.data.modelProvider,
1435
- model_name: this.data.modelName,
1436
- server_count: this.data.serverCount,
1437
- server_identifiers: this.data.serverIdentifiers,
1438
- total_tools_available: this.data.totalToolsAvailable,
1439
- tools_available_names: this.data.toolsAvailableNames,
1440
- max_steps_configured: this.data.maxStepsConfigured,
1441
- memory_enabled: this.data.memoryEnabled,
1442
- use_server_manager: this.data.useServerManager,
1443
- // Execution parameters (always include, even if null)
1444
- max_steps_used: this.data.maxStepsUsed,
1445
- manage_connector: this.data.manageConnector,
1446
- external_history_used: this.data.externalHistoryUsed,
1447
- // Execution results (always include, even if null)
1448
- steps_taken: this.data.stepsTaken ?? null,
1449
- tools_used_count: this.data.toolsUsedCount ?? null,
1450
- tools_used_names: this.data.toolsUsedNames ?? null,
1451
- response: this.data.response ?? null,
1452
- response_length: this.data.response ? this.data.response.length : null,
1453
- execution_time_ms: this.data.executionTimeMs ?? null,
1454
- error_type: this.data.errorType ?? null,
1455
- conversation_history_length: this.data.conversationHistoryLength ?? null
1456
- };
1457
- }
1458
- };
1459
-
1460
- // src/telemetry/utils.ts
1461
- import * as fs from "fs";
1462
- import * as path from "path";
1463
- function getPackageVersion() {
1464
- try {
1465
- if (typeof __dirname === "undefined" || typeof fs === "undefined") {
1466
- return "unknown";
1467
- }
1468
- const packagePath = path.join(__dirname, "../../package.json");
1469
- const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
1470
- return packageJson.version || "unknown";
1471
- } catch {
1472
- return "unknown";
1473
- }
1474
- }
1475
- __name(getPackageVersion, "getPackageVersion");
1476
- function getModelProvider(llm) {
1477
- return llm._llm_type || llm.constructor.name.toLowerCase();
1478
- }
1479
- __name(getModelProvider, "getModelProvider");
1480
- function getModelName(llm) {
1481
- if ("_identifyingParams" in llm) {
1482
- const identifyingParams = llm._identifyingParams;
1483
- if (typeof identifyingParams === "object" && identifyingParams !== null) {
1484
- for (const key of [
1485
- "model",
1486
- "modelName",
1487
- "model_name",
1488
- "modelId",
1489
- "model_id",
1490
- "deploymentName",
1491
- "deployment_name"
1492
- ]) {
1493
- if (key in identifyingParams) {
1494
- return String(identifyingParams[key]);
1495
- }
1496
- }
1497
- }
1498
- }
1499
- return llm.model || llm.modelName || llm.constructor.name;
1500
- }
1501
- __name(getModelName, "getModelName");
1502
- function extractModelInfo(llm) {
1503
- return [getModelProvider(llm), getModelName(llm)];
1504
- }
1505
- __name(extractModelInfo, "extractModelInfo");
1506
-
1507
- // src/telemetry/telemetry.ts
1508
- function isNodeJSEnvironment() {
1509
- try {
1510
- if (typeof navigator !== "undefined" && navigator.userAgent?.includes("Cloudflare-Workers")) {
1511
- return false;
1512
- }
1513
- if (typeof globalThis.EdgeRuntime !== "undefined" || typeof globalThis.Deno !== "undefined") {
1514
- return false;
1515
- }
1516
- const hasNodeGlobals = typeof process !== "undefined" && typeof process.platform !== "undefined" && typeof __dirname !== "undefined";
1517
- const hasNodeModules = typeof fs2 !== "undefined" && typeof os !== "undefined" && typeof fs2.existsSync === "function";
1518
- return hasNodeGlobals && hasNodeModules;
1519
- } catch {
1520
- return false;
1521
- }
1522
- }
1523
- __name(isNodeJSEnvironment, "isNodeJSEnvironment");
1524
- var ScarfEventLogger = class {
1525
- static {
1526
- __name(this, "ScarfEventLogger");
1527
- }
1528
- endpoint;
1529
- timeout;
1530
- constructor(endpoint, timeout = 3e3) {
1531
- this.endpoint = endpoint;
1532
- this.timeout = timeout;
1533
- }
1534
- async logEvent(properties) {
1535
- try {
1536
- const controller = new AbortController();
1537
- const timeoutId = setTimeout(() => controller.abort(), this.timeout);
1538
- const response = await fetch(this.endpoint, {
1539
- method: "POST",
1540
- headers: {
1541
- "Content-Type": "application/json"
1542
- },
1543
- body: JSON.stringify(properties),
1544
- signal: controller.signal
1545
- });
1546
- clearTimeout(timeoutId);
1547
- if (!response.ok) {
1548
- throw new Error(`HTTP error! status: ${response.status}`);
1549
- }
1550
- } catch (error) {
1551
- logger.debug(`Failed to send Scarf event: ${error}`);
1552
- }
1553
- }
1554
- };
1555
- function getCacheHome() {
1556
- if (!isNodeJSEnvironment()) {
1557
- return "/tmp/mcp_use_cache";
1558
- }
1559
- const envVar = process.env.XDG_CACHE_HOME;
1560
- if (envVar && path2.isAbsolute(envVar)) {
1561
- return envVar;
1562
- }
1563
- const platform = process.platform;
1564
- const homeDir = os.homedir();
1565
- if (platform === "win32") {
1566
- const appdata = process.env.LOCALAPPDATA || process.env.APPDATA;
1567
- if (appdata) {
1568
- return appdata;
1569
- }
1570
- return path2.join(homeDir, "AppData", "Local");
1571
- } else if (platform === "darwin") {
1572
- return path2.join(homeDir, "Library", "Caches");
1573
- } else {
1574
- return path2.join(homeDir, ".cache");
1575
- }
1576
- }
1577
- __name(getCacheHome, "getCacheHome");
1578
- var Telemetry = class _Telemetry {
1579
- static {
1580
- __name(this, "Telemetry");
1581
- }
1582
- static instance = null;
1583
- USER_ID_PATH = path2.join(
1584
- getCacheHome(),
1585
- "mcp_use_3",
1586
- "telemetry_user_id"
1587
- );
1588
- VERSION_DOWNLOAD_PATH = path2.join(
1589
- getCacheHome(),
1590
- "mcp_use",
1591
- "download_version"
1592
- );
1593
- PROJECT_API_KEY = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI";
1594
- HOST = "https://eu.i.posthog.com";
1595
- SCARF_GATEWAY_URL = "https://mcpuse.gateway.scarf.sh/events-ts";
1596
- UNKNOWN_USER_ID = "UNKNOWN_USER_ID";
1597
- _currUserId = null;
1598
- _posthogClient = null;
1599
- _scarfClient = null;
1600
- _source = "typescript";
1601
- constructor() {
1602
- const isNodeJS = isNodeJSEnvironment();
1603
- const telemetryDisabled = typeof process !== "undefined" && process.env?.MCP_USE_ANONYMIZED_TELEMETRY?.toLowerCase() === "false" || false;
1604
- this._source = typeof process !== "undefined" && process.env?.MCP_USE_TELEMETRY_SOURCE || "typescript";
1605
- if (telemetryDisabled) {
1606
- this._posthogClient = null;
1607
- this._scarfClient = null;
1608
- logger.debug("Telemetry disabled via environment variable");
1609
- } else if (!isNodeJS) {
1610
- this._posthogClient = null;
1611
- this._scarfClient = null;
1612
- logger.debug(
1613
- "Telemetry disabled - non-Node.js environment detected (e.g., Cloudflare Workers)"
1614
- );
1615
- } else {
1616
- logger.info(
1617
- "Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."
1618
- );
1619
- try {
1620
- this._posthogClient = new PostHog(this.PROJECT_API_KEY, {
1621
- host: this.HOST,
1622
- disableGeoip: false
1623
- });
1624
- } catch (e) {
1625
- logger.warn(`Failed to initialize PostHog telemetry: ${e}`);
1626
- this._posthogClient = null;
1627
- }
1628
- try {
1629
- this._scarfClient = new ScarfEventLogger(this.SCARF_GATEWAY_URL, 3e3);
1630
- } catch (e) {
1631
- logger.warn(`Failed to initialize Scarf telemetry: ${e}`);
1632
- this._scarfClient = null;
1633
- }
1634
- }
1635
- }
1636
- static getInstance() {
1637
- if (!_Telemetry.instance) {
1638
- _Telemetry.instance = new _Telemetry();
1639
- }
1640
- return _Telemetry.instance;
1641
- }
1642
- /**
1643
- * Set the source identifier for telemetry events.
1644
- * This allows tracking usage from different applications.
1645
- * @param source - The source identifier (e.g., "my-app", "cli", "vs-code-extension")
1646
- */
1647
- setSource(source) {
1648
- this._source = source;
1649
- logger.debug(`Telemetry source set to: ${source}`);
1650
- }
1651
- /**
1652
- * Get the current source identifier.
1653
- */
1654
- getSource() {
1655
- return this._source;
1656
- }
1657
- get userId() {
1658
- if (this._currUserId) {
1659
- return this._currUserId;
1660
- }
1661
- if (!isNodeJSEnvironment()) {
1662
- this._currUserId = this.UNKNOWN_USER_ID;
1663
- return this._currUserId;
1664
- }
1665
- try {
1666
- const isFirstTime = !fs2.existsSync(this.USER_ID_PATH);
1667
- if (isFirstTime) {
1668
- logger.debug(`Creating user ID path: ${this.USER_ID_PATH}`);
1669
- fs2.mkdirSync(path2.dirname(this.USER_ID_PATH), { recursive: true });
1670
- const newUserId = generateUUID();
1671
- fs2.writeFileSync(this.USER_ID_PATH, newUserId);
1672
- this._currUserId = newUserId;
1673
- logger.debug(`User ID path created: ${this.USER_ID_PATH}`);
1674
- } else {
1675
- this._currUserId = fs2.readFileSync(this.USER_ID_PATH, "utf-8").trim();
1676
- }
1677
- this.trackPackageDownload({
1678
- triggered_by: "user_id_property"
1679
- }).catch((e) => logger.debug(`Failed to track package download: ${e}`));
1680
- } catch (e) {
1681
- logger.debug(`Failed to get/create user ID: ${e}`);
1682
- this._currUserId = this.UNKNOWN_USER_ID;
1683
- }
1684
- return this._currUserId;
1685
- }
1686
- async capture(event) {
1687
- if (!this._posthogClient && !this._scarfClient) {
1688
- return;
1689
- }
1690
- if (this._posthogClient) {
1691
- try {
1692
- const properties = { ...event.properties };
1693
- properties.mcp_use_version = getPackageVersion();
1694
- properties.language = "typescript";
1695
- properties.source = this._source;
1696
- this._posthogClient.capture({
1697
- distinctId: this.userId,
1698
- event: event.name,
1699
- properties
1700
- });
1701
- } catch (e) {
1702
- logger.debug(`Failed to track PostHog event ${event.name}: ${e}`);
1703
- }
1704
- }
1705
- if (this._scarfClient) {
1706
- try {
1707
- const properties = {};
1708
- properties.mcp_use_version = getPackageVersion();
1709
- properties.user_id = this.userId;
1710
- properties.event = event.name;
1711
- properties.language = "typescript";
1712
- properties.source = this._source;
1713
- await this._scarfClient.logEvent(properties);
1714
- } catch (e) {
1715
- logger.debug(`Failed to track Scarf event ${event.name}: ${e}`);
1716
- }
1717
- }
1718
- }
1719
- async trackPackageDownload(properties) {
1720
- if (!this._scarfClient) {
1721
- return;
1722
- }
1723
- if (!isNodeJSEnvironment()) {
1724
- return;
1725
- }
1726
- try {
1727
- const currentVersion = getPackageVersion();
1728
- let shouldTrack = false;
1729
- let firstDownload = false;
1730
- if (!fs2.existsSync(this.VERSION_DOWNLOAD_PATH)) {
1731
- shouldTrack = true;
1732
- firstDownload = true;
1733
- fs2.mkdirSync(path2.dirname(this.VERSION_DOWNLOAD_PATH), {
1734
- recursive: true
1735
- });
1736
- fs2.writeFileSync(this.VERSION_DOWNLOAD_PATH, currentVersion);
1737
- } else {
1738
- const savedVersion = fs2.readFileSync(this.VERSION_DOWNLOAD_PATH, "utf-8").trim();
1739
- if (currentVersion > savedVersion) {
1740
- shouldTrack = true;
1741
- firstDownload = false;
1742
- fs2.writeFileSync(this.VERSION_DOWNLOAD_PATH, currentVersion);
1743
- }
1744
- }
1745
- if (shouldTrack) {
1746
- logger.debug(
1747
- `Tracking package download event with properties: ${JSON.stringify(properties)}`
1748
- );
1749
- const eventProperties = { ...properties || {} };
1750
- eventProperties.mcp_use_version = currentVersion;
1751
- eventProperties.user_id = this.userId;
1752
- eventProperties.event = "package_download";
1753
- eventProperties.first_download = firstDownload;
1754
- eventProperties.language = "typescript";
1755
- eventProperties.source = this._source;
1756
- await this._scarfClient.logEvent(eventProperties);
1757
- }
1758
- } catch (e) {
1759
- logger.debug(`Failed to track Scarf package_download event: ${e}`);
1760
- }
1761
- }
1762
- async trackAgentExecution(data) {
1763
- const event = new MCPAgentExecutionEvent(data);
1764
- await this.capture(event);
1765
- }
1766
- flush() {
1767
- if (this._posthogClient) {
1768
- try {
1769
- this._posthogClient.flush();
1770
- logger.debug("PostHog client telemetry queue flushed");
1771
- } catch (e) {
1772
- logger.debug(`Failed to flush PostHog client: ${e}`);
1773
- }
1774
- }
1775
- if (this._scarfClient) {
1776
- logger.debug("Scarf telemetry events sent immediately (no flush needed)");
1777
- }
1778
- }
1779
- shutdown() {
1780
- if (this._posthogClient) {
1781
- try {
1782
- this._posthogClient.shutdown();
1783
- logger.debug("PostHog client shutdown successfully");
1784
- } catch (e) {
1785
- logger.debug(`Error shutting down PostHog client: ${e}`);
1786
- }
1787
- }
1788
- if (this._scarfClient) {
1789
- logger.debug("Scarf telemetry client shutdown (no action needed)");
1790
- }
1791
- }
1792
- };
1793
-
1794
- // src/telemetry/index.ts
1795
- function setTelemetrySource(source) {
1796
- Telemetry.getInstance().setSource(source);
1797
- }
1798
- __name(setTelemetrySource, "setTelemetrySource");
1799
-
1800
1405
  // src/agents/remote.ts
1801
1406
  import { toJSONSchema } from "zod";
1802
1407
  var API_CHATS_ENDPOINT = "/api/v1/chats";
@@ -2134,6 +1739,13 @@ var MCPAgent = class {
2134
1739
  static {
2135
1740
  __name(this, "MCPAgent");
2136
1741
  }
1742
+ /**
1743
+ * Get the mcp-use package version.
1744
+ * Works in all environments (Node.js, browser, Cloudflare Workers, Deno, etc.)
1745
+ */
1746
+ static getPackageVersion() {
1747
+ return getPackageVersion();
1748
+ }
2137
1749
  llm;
2138
1750
  client;
2139
1751
  connectors;
@@ -3547,8 +3159,6 @@ export {
3547
3159
  ReleaseMCPServerConnectionTool,
3548
3160
  ServerManager,
3549
3161
  ObservabilityManager,
3550
- Telemetry,
3551
- setTelemetrySource,
3552
3162
  RemoteAgent,
3553
3163
  MCPAgent
3554
3164
  };