@salesforce/mcp 0.22.0 → 0.23.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.
Files changed (2) hide show
  1. package/lib/telemetry.js +29 -1
  2. package/package.json +4 -4
package/lib/telemetry.js CHANGED
@@ -16,11 +16,30 @@
16
16
  import { randomBytes } from 'node:crypto';
17
17
  import { readFileSync } from 'node:fs';
18
18
  import { join } from 'node:path';
19
+ import * as os from 'node:os';
19
20
  import { TelemetryReporter } from '@salesforce/telemetry';
20
21
  import { warn } from '@oclif/core/ux';
21
22
  const PROJECT = 'salesforce-mcp-server';
23
+ // WARN: This is intentionally empty! It's populated at the time of publish
24
+ // This is to prevent telemetry pollution from local clones and forks
22
25
  const APP_INSIGHTS_KEY = 'InstrumentationKey=2ca64abb-6123-4c7b-bd9e-4fe73e71fe9c;IngestionEndpoint=https://eastus-1.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/;ApplicationId=ecd8fa7a-0e0d-4109-94db-4d7878ada862';
26
+ const O11Y_UPLOAD_ENDPOINT = 'https://794testsite.my.site.com/byolwr/webruntime/log/metrics';
23
27
  const generateRandomId = () => randomBytes(20).toString('hex');
28
+ /**
29
+ * Check if the current host is an internal Salesforce environment
30
+ */
31
+ function isInternalHost() {
32
+ return os.hostname().endsWith('internal.salesforce.com');
33
+ }
34
+ /**
35
+ * Get internal Salesforce environment properties
36
+ */
37
+ function getInternalProperties() {
38
+ return {
39
+ 'sfInternal.hostname': os.hostname(),
40
+ 'sfInternal.username': os.userInfo().username,
41
+ };
42
+ }
24
43
  const getCliId = (cacheDir) => {
25
44
  // We need to find sf's cache directory and read the CLIID.txt file from there.
26
45
  // The problem is that sf's cache directory is OS specific and we don't want to
@@ -70,7 +89,10 @@ export class Telemetry {
70
89
  constructor(config, attributes = {}) {
71
90
  this.config = config;
72
91
  this.attributes = attributes;
73
- warn('You acknowledge and agree that the MCP server may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the MCP server and product improvements.');
92
+ const startupMessage = APP_INSIGHTS_KEY
93
+ ? 'You acknowledge and agree that the MCP server may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the MCP server and product improvements.'
94
+ : 'Telemetry is automatically disabled for local development.';
95
+ warn(startupMessage);
74
96
  this.sessionId = generateRandomId();
75
97
  this.cliId = getCliId(config.cacheDir);
76
98
  }
@@ -96,6 +118,8 @@ export class Telemetry {
96
118
  date: new Date().toUTCString(),
97
119
  timestamp: String(Date.now()),
98
120
  processUptime: process.uptime() * 1000,
121
+ // Internal Properties (only in internal Salesforce environments)
122
+ ...(isInternalHost() ? getInternalProperties() : {}),
99
123
  });
100
124
  }
101
125
  catch {
@@ -105,6 +129,8 @@ export class Telemetry {
105
129
  async start() {
106
130
  if (this.started)
107
131
  return;
132
+ if (!APP_INSIGHTS_KEY)
133
+ return;
108
134
  this.started = true;
109
135
  try {
110
136
  this.reporter = await McpTelemetryReporter.create({
@@ -112,6 +138,8 @@ export class Telemetry {
112
138
  key: APP_INSIGHTS_KEY,
113
139
  userId: this.cliId,
114
140
  waitForConnection: true,
141
+ o11yUploadEndpoint: O11Y_UPLOAD_ENDPOINT,
142
+ enableO11y: true,
115
143
  });
116
144
  this.reporter.start();
117
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/mcp",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "MCP Server for interacting with Salesforce instances",
5
5
  "bin": {
6
6
  "sf-mcp-server": "bin/run.js"
@@ -43,13 +43,13 @@
43
43
  "@salesforce/mcp-provider-api": "0.4.0",
44
44
  "@salesforce/mcp-provider-dx-core": "0.3.5",
45
45
  "@salesforce/mcp-provider-code-analyzer": "0.2.0",
46
- "@salesforce/mcp-provider-lwc-experts": "0.5.3",
46
+ "@salesforce/mcp-provider-lwc-experts": "0.6.0",
47
47
  "@salesforce/mcp-provider-aura-experts": "0.3.3",
48
48
  "@salesforce/mcp-provider-mobile-web": "0.2.0",
49
- "@salesforce/mcp-provider-devops": "0.1.4",
49
+ "@salesforce/mcp-provider-devops": "0.1.5",
50
50
  "@salesforce/source-deploy-retrieve": "^12.22.0",
51
51
  "@salesforce/source-tracking": "^7.4.8",
52
- "@salesforce/telemetry": "^6.1.0",
52
+ "@salesforce/telemetry": "^6.2.6",
53
53
  "@salesforce/ts-types": "^2.0.11",
54
54
  "zod": "^3.25.76"
55
55
  },