@salesforce/mcp 0.19.2-dev.0 → 0.20.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/lib/index.js CHANGED
@@ -139,12 +139,20 @@ You can also use special values to control access to orgs:
139
139
  }, {
140
140
  telemetry: this.telemetry,
141
141
  });
142
- const services = new Services({ telemetry: this.telemetry, dataDir: this.config.dataDir });
142
+ const services = new Services({
143
+ telemetry: this.telemetry,
144
+ dataDir: this.config.dataDir,
145
+ // Startup flags that could be useful to reference inside of a MCP tool
146
+ startupFlags: {
147
+ // !! Never pass the 'orgs' flag here. Use 'getOrgService()'.
148
+ 'allow-non-ga-tools': flags['allow-non-ga-tools'],
149
+ debug: flags.debug,
150
+ },
151
+ });
143
152
  await registerToolsets(flags.toolsets ?? ['all'], flags['dynamic-tools'] ?? false, flags['allow-non-ga-tools'] ?? false, server, services);
144
153
  const transport = new StdioServerTransport();
145
154
  await server.connect(transport);
146
155
  console.error(`✅ Salesforce MCP Server v${this.config.version} running on stdio`);
147
- console.error('BUNDLE BUILD TESTING');
148
156
  }
149
157
  async catch(error) {
150
158
  if (!this.telemetry && !process.argv.includes('--no-telemetry')) {
package/lib/registry.js CHANGED
@@ -15,10 +15,16 @@
15
15
  */
16
16
  import { DxCoreMcpProvider } from '@salesforce/mcp-provider-dx-core';
17
17
  import { CodeAnalyzerMcpProvider } from '@salesforce/mcp-provider-code-analyzer';
18
+ import { LwcExpertsMcpProvider } from '@salesforce/mcp-provider-lwc-experts';
19
+ import { AuraExpertsMcpProvider } from '@salesforce/mcp-provider-aura-experts';
20
+ import { MobileWebMcpProvider } from '@salesforce/mcp-provider-mobile-web';
18
21
  /** -------- ADD McpProvider INSTANCES HERE ------------------------------------------------------------------------- */
19
22
  export const MCP_PROVIDER_REGISTRY = [
20
23
  new DxCoreMcpProvider(),
21
24
  new CodeAnalyzerMcpProvider(),
25
+ new LwcExpertsMcpProvider(),
26
+ new AuraExpertsMcpProvider(),
27
+ new MobileWebMcpProvider(),
22
28
  // Add new instances here
23
29
  ];
24
30
  //# sourceMappingURL=registry.js.map
package/lib/services.d.ts CHANGED
@@ -1,10 +1,12 @@
1
- import { Services as IServices, TelemetryService, OrgService, ConfigService } from '@salesforce/mcp-provider-api';
1
+ import { Services as IServices, TelemetryService, OrgService, ConfigService, StartupFlags } from '@salesforce/mcp-provider-api';
2
2
  export declare class Services implements IServices {
3
3
  private readonly telemetry;
4
4
  private readonly dataDir;
5
+ private readonly startupFlags;
5
6
  constructor(opts: {
6
7
  telemetry: TelemetryService | undefined;
7
8
  dataDir: string;
9
+ startupFlags: StartupFlags;
8
10
  });
9
11
  getTelemetryService(): TelemetryService;
10
12
  getConfigService(): ConfigService;
package/lib/services.js CHANGED
@@ -3,9 +3,11 @@ import { getConnection, getDefaultTargetOrg, getDefaultTargetDevHub, getAllAllow
3
3
  export class Services {
4
4
  telemetry;
5
5
  dataDir;
6
+ startupFlags;
6
7
  constructor(opts) {
7
8
  this.telemetry = opts.telemetry ? opts.telemetry : new NoopTelemetryService();
8
9
  this.dataDir = opts.dataDir;
10
+ this.startupFlags = opts.startupFlags;
9
11
  }
10
12
  getTelemetryService() {
11
13
  return this.telemetry;
@@ -13,6 +15,7 @@ export class Services {
13
15
  getConfigService() {
14
16
  return {
15
17
  getDataDir: () => this.dataDir,
18
+ getStartupFlags: () => this.startupFlags,
16
19
  };
17
20
  }
18
21
  getOrgService() {
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
17
- import { Logger } from '@salesforce/core-bundle';
17
+ import { Logger } from '@salesforce/core';
18
18
  import { createRateLimiter } from './utils/rate-limiter.js';
19
19
  /**
20
20
  * A server implementation that extends the base MCP server with telemetry and rate limiting capabilities.
@@ -1,4 +1,4 @@
1
- import { Connection, type OrgAuthorization } from '@salesforce/core-bundle';
1
+ import { Connection, type OrgAuthorization } from '@salesforce/core';
2
2
  import { type OrgConfigInfo, type SanitizedOrgAuthorization } from '@salesforce/mcp-provider-api';
3
3
  /**
4
4
  * Sanitizes org authorization data by filtering out sensitive fields
package/lib/utils/auth.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { AuthInfo, Connection, ConfigAggregator, OrgConfigProperties } from '@salesforce/core-bundle';
16
+ import { AuthInfo, Connection, ConfigAggregator, OrgConfigProperties } from '@salesforce/core';
17
17
  import Cache from './cache.js';
18
18
  /**
19
19
  * Sanitizes org authorization data by filtering out sensitive fields
@@ -13,9 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- // import { Mutex } from '@salesforce/core-bundle';
17
- import pkg from '@salesforce/core-bundle';
18
- const { Mutex } = pkg;
16
+ import { Mutex } from '@salesforce/core';
19
17
  /**
20
18
  * A thread-safe cache providing generic Map operations with mutex protection.
21
19
  * Offers atomic read, write, and update operations for concurrent access.
@@ -16,7 +16,7 @@
16
16
  import { ux } from '@oclif/core';
17
17
  import { MCP_PROVIDER_API_VERSION, ReleaseState, Toolset, TOOLSETS, } from '@salesforce/mcp-provider-api';
18
18
  import { MCP_PROVIDER_REGISTRY } from '../registry.js';
19
- import { addTool } from '../utils/tools.js';
19
+ import { addTool, isToolRegistered } from '../utils/tools.js';
20
20
  import { createDynamicServerTools } from '../main-server-provider.js';
21
21
  export async function registerToolsets(toolsets, useDynamicTools, allowNonGaTools, server, services) {
22
22
  if (useDynamicTools) {
@@ -29,7 +29,8 @@ export async function registerToolsets(toolsets, useDynamicTools, allowNonGaTool
29
29
  ux.stderr('Skipping registration of dynamic tools.');
30
30
  }
31
31
  const toolsetsToEnable = toolsets.includes('all')
32
- ? new Set(TOOLSETS) : new Set([Toolset.CORE, ...toolsets]);
32
+ ? new Set(TOOLSETS)
33
+ : new Set([Toolset.CORE, ...toolsets]);
33
34
  const newToolRegistry = await createToolRegistryFromProviders(MCP_PROVIDER_REGISTRY, services);
34
35
  for (const toolset of TOOLSETS) {
35
36
  if (toolsetsToEnable.has(toolset)) {
@@ -48,6 +49,11 @@ async function registerTools(tools, server, useDynamicTools, allowNonGaTools) {
48
49
  ux.stderr(`* Skipping registration of non-ga tool '${tool.getName()}' because the '--allow-non-ga-tools' flag was not set at server startup.`);
49
50
  continue;
50
51
  }
52
+ // eslint-disable-next-line no-await-in-loop
53
+ if (await isToolRegistered(tool.getName())) {
54
+ ux.stderr(`* Skipping registration of tool '${tool.getName()}' because it is already registered.`);
55
+ continue;
56
+ }
51
57
  const registeredTool = server.registerTool(tool.getName(), tool.getConfig(), (...args) => tool.exec(...args));
52
58
  const toolsets = tool.getToolsets();
53
59
  if (useDynamicTools && !toolsets.includes(Toolset.CORE)) {
@@ -6,6 +6,13 @@ export declare function addTool(tool: RegisteredTool, name: string): Promise<{
6
6
  success: boolean;
7
7
  message: string;
8
8
  }>;
9
+ /**
10
+ * Check if a tool is registered
11
+ *
12
+ * @param toolName The name of the tool to check
13
+ * @returns True if the tool is registered, false otherwise
14
+ */
15
+ export declare function isToolRegistered(toolName: string): Promise<boolean>;
9
16
  /**
10
17
  * Enable an individual tool
11
18
  */
@@ -18,10 +18,7 @@ import Cache from './cache.js';
18
18
  * Add a tool to the cache
19
19
  */
20
20
  export async function addTool(tool, name) {
21
- const existingTools = await Cache.safeGet('tools');
22
- // Check if tool already exists
23
- const existingTool = existingTools.find((t) => t.name === name);
24
- if (existingTool) {
21
+ if (await isToolRegistered(name)) {
25
22
  return { success: false, message: `Tool ${name} already exists` };
26
23
  }
27
24
  await Cache.safeUpdate('tools', (toolsArray) => {
@@ -33,6 +30,16 @@ export async function addTool(tool, name) {
33
30
  });
34
31
  return { success: true, message: `Added tool ${name}` };
35
32
  }
33
+ /**
34
+ * Check if a tool is registered
35
+ *
36
+ * @param toolName The name of the tool to check
37
+ * @returns True if the tool is registered, false otherwise
38
+ */
39
+ export async function isToolRegistered(toolName) {
40
+ const existingTools = await Cache.safeGet('tools');
41
+ return existingTools.some((t) => t.name === toolName);
42
+ }
36
43
  /**
37
44
  * Enable an individual tool
38
45
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/mcp",
3
- "version": "0.19.2-dev.0",
3
+ "version": "0.20.0",
4
4
  "description": "MCP Server for interacting with Salesforce instances",
5
5
  "bin": {
6
6
  "sf-mcp-server": "bin/run.js"
@@ -44,15 +44,18 @@
44
44
  "dependencies": {
45
45
  "@modelcontextprotocol/sdk": "^1.16.0",
46
46
  "@oclif/core": "^4.5.1",
47
- "@salesforce/agents-bundle": "^0.17.5",
48
- "@salesforce/apex-node-bundle": "^8.2.8",
49
- "@salesforce/core-bundle": "^8.21.0",
47
+ "@salesforce/agents": "^0.15.4",
48
+ "@salesforce/apex-node": "^8.2.1",
49
+ "@salesforce/core": "^8.18.0",
50
50
  "@salesforce/kit": "^3.1.6",
51
- "@salesforce/mcp-provider-api": "0.2.0",
52
- "@salesforce/mcp-provider-dx-core": "0.2.2",
51
+ "@salesforce/mcp-provider-api": "0.2.1",
52
+ "@salesforce/mcp-provider-dx-core": "0.2.3",
53
53
  "@salesforce/mcp-provider-code-analyzer": "0.0.2",
54
- "@salesforce/source-deploy-retrieve-bundle": "^12.22.9",
55
- "@salesforce/source-tracking-bundle": "^7.4.9",
54
+ "@salesforce/mcp-provider-lwc-experts": "0.1.1",
55
+ "@salesforce/mcp-provider-aura-experts": "0.1.1",
56
+ "@salesforce/mcp-provider-mobile-web": "0.0.2",
57
+ "@salesforce/source-deploy-retrieve": "^12.22.0",
58
+ "@salesforce/source-tracking": "^7.4.8",
56
59
  "@salesforce/telemetry": "^6.1.0",
57
60
  "@salesforce/ts-types": "^2.0.11",
58
61
  "zod": "^3.25.76"