@salesforce/b2c-dx-mcp 1.10.1 → 2.1.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 (110) hide show
  1. package/README.md +15 -62
  2. package/dist/commands/mcp.d.ts +14 -7
  3. package/dist/commands/mcp.js +91 -12
  4. package/dist/registry.d.ts +3 -3
  5. package/dist/registry.js +7 -14
  6. package/dist/server-context.d.ts +1 -1
  7. package/dist/server-context.js +1 -1
  8. package/dist/services.d.ts +29 -1
  9. package/dist/services.js +48 -1
  10. package/dist/tools/adapter.d.ts +25 -1
  11. package/dist/tools/adapter.js +53 -8
  12. package/dist/tools/cartridges/index.js +14 -3
  13. package/dist/tools/diagnostics/config-inspect.js +3 -2
  14. package/dist/tools/diagnostics/debug-list-sessions.js +1 -1
  15. package/dist/tools/diagnostics/debug-start-session.js +22 -9
  16. package/dist/tools/diagnostics/log-watch-registry.d.ts +3 -0
  17. package/dist/tools/diagnostics/log-watch-registry.js +1 -0
  18. package/dist/tools/diagnostics/logs-watch-list.js +1 -0
  19. package/dist/tools/diagnostics/logs-watch-start.js +6 -1
  20. package/dist/tools/diagnostics/mrt-log-watch-registry.d.ts +3 -0
  21. package/dist/tools/diagnostics/mrt-log-watch-registry.js +0 -0
  22. package/dist/tools/diagnostics/mrt-logs-watch-list.js +1 -0
  23. package/dist/tools/diagnostics/mrt-logs-watch-start.js +7 -1
  24. package/dist/tools/diagnostics/session-registry.d.ts +3 -0
  25. package/dist/tools/diagnostics/session-registry.js +4 -3
  26. package/dist/tools/index.d.ts +0 -1
  27. package/dist/tools/index.js +0 -1
  28. package/dist/tools/mrt/index.js +13 -3
  29. package/dist/tools/project-context.d.ts +53 -0
  30. package/dist/tools/project-context.js +55 -0
  31. package/dist/tools/scapi/metrics-get.js +1 -0
  32. package/dist/tools/scapi/scapi-custom-api-generate-scaffold.d.ts +8 -1
  33. package/dist/tools/scapi/scapi-custom-api-generate-scaffold.js +41 -7
  34. package/dist/tools/scapi/scapi-custom-apis-get-status.js +1 -0
  35. package/dist/tools/scapi/scapi-schemas-list.js +1 -0
  36. package/dist/utils/constants.d.ts +2 -13
  37. package/dist/utils/constants.js +1 -20
  38. package/oclif.manifest.json +2 -2
  39. package/package.json +3 -3
  40. package/content/sfnext/auth.md +0 -62
  41. package/content/sfnext/components.md +0 -123
  42. package/content/sfnext/config.md +0 -180
  43. package/content/sfnext/data-fetching.md +0 -323
  44. package/content/sfnext/extensions.md +0 -80
  45. package/content/sfnext/i18n.md +0 -121
  46. package/content/sfnext/page-designer.md +0 -78
  47. package/content/sfnext/performance.md +0 -80
  48. package/content/sfnext/pitfalls.md +0 -141
  49. package/content/sfnext/quick-reference.md +0 -226
  50. package/content/sfnext/state-management.md +0 -75
  51. package/content/sfnext/styling.md +0 -51
  52. package/content/sfnext/testing.md +0 -232
  53. package/dist/tools/storefrontnext/figma/figma-to-component/figma-url-parser.d.ts +0 -24
  54. package/dist/tools/storefrontnext/figma/figma-to-component/figma-url-parser.js +0 -53
  55. package/dist/tools/storefrontnext/figma/figma-to-component/index.d.ts +0 -42
  56. package/dist/tools/storefrontnext/figma/figma-to-component/index.js +0 -326
  57. package/dist/tools/storefrontnext/figma/generate-component/decision.d.ts +0 -40
  58. package/dist/tools/storefrontnext/figma/generate-component/decision.js +0 -312
  59. package/dist/tools/storefrontnext/figma/generate-component/formatter.d.ts +0 -9
  60. package/dist/tools/storefrontnext/figma/generate-component/formatter.js +0 -92
  61. package/dist/tools/storefrontnext/figma/generate-component/index.d.ts +0 -114
  62. package/dist/tools/storefrontnext/figma/generate-component/index.js +0 -99
  63. package/dist/tools/storefrontnext/figma/map-tokens/css-parser.d.ts +0 -71
  64. package/dist/tools/storefrontnext/figma/map-tokens/css-parser.js +0 -260
  65. package/dist/tools/storefrontnext/figma/map-tokens/index.d.ts +0 -61
  66. package/dist/tools/storefrontnext/figma/map-tokens/index.js +0 -235
  67. package/dist/tools/storefrontnext/figma/map-tokens/token-matcher.d.ts +0 -65
  68. package/dist/tools/storefrontnext/figma/map-tokens/token-matcher.js +0 -268
  69. package/dist/tools/storefrontnext/index.d.ts +0 -30
  70. package/dist/tools/storefrontnext/index.js +0 -28
  71. package/dist/tools/storefrontnext/page-designer-decorator/analyzer.d.ts +0 -169
  72. package/dist/tools/storefrontnext/page-designer-decorator/analyzer.js +0 -567
  73. package/dist/tools/storefrontnext/page-designer-decorator/index.d.ts +0 -252
  74. package/dist/tools/storefrontnext/page-designer-decorator/index.js +0 -617
  75. package/dist/tools/storefrontnext/page-designer-decorator/rules/1-mode-selection.d.ts +0 -8
  76. package/dist/tools/storefrontnext/page-designer-decorator/rules/1-mode-selection.js +0 -65
  77. package/dist/tools/storefrontnext/page-designer-decorator/rules/2a-auto-mode.d.ts +0 -13
  78. package/dist/tools/storefrontnext/page-designer-decorator/rules/2a-auto-mode.js +0 -87
  79. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-0-interactive-overview.d.ts +0 -4
  80. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-0-interactive-overview.js +0 -55
  81. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-1-interactive-analyze.d.ts +0 -22
  82. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-1-interactive-analyze.js +0 -109
  83. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-2-interactive-select-props.d.ts +0 -21
  84. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-2-interactive-select-props.js +0 -60
  85. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-3-interactive-configure-attrs.d.ts +0 -27
  86. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-3-interactive-configure-attrs.js +0 -68
  87. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-4-interactive-configure-regions.d.ts +0 -4
  88. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-4-interactive-configure-regions.js +0 -65
  89. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-5-interactive-confirm-generation.d.ts +0 -11
  90. package/dist/tools/storefrontnext/page-designer-decorator/rules/2b-5-interactive-confirm-generation.js +0 -92
  91. package/dist/tools/storefrontnext/page-designer-decorator/rules.d.ts +0 -51
  92. package/dist/tools/storefrontnext/page-designer-decorator/rules.js +0 -70
  93. package/dist/tools/storefrontnext/page-designer-decorator/templates/decorator-generator.d.ts +0 -116
  94. package/dist/tools/storefrontnext/page-designer-decorator/templates/decorator-generator.js +0 -350
  95. package/dist/tools/storefrontnext/sfnext-development-guidelines.d.ts +0 -9
  96. package/dist/tools/storefrontnext/sfnext-development-guidelines.js +0 -141
  97. package/dist/tools/storefrontnext/site-theming/color-contrast.d.ts +0 -92
  98. package/dist/tools/storefrontnext/site-theming/color-contrast.js +0 -186
  99. package/dist/tools/storefrontnext/site-theming/color-mapping.d.ts +0 -16
  100. package/dist/tools/storefrontnext/site-theming/color-mapping.js +0 -131
  101. package/dist/tools/storefrontnext/site-theming/guidance-merger.d.ts +0 -11
  102. package/dist/tools/storefrontnext/site-theming/guidance-merger.js +0 -78
  103. package/dist/tools/storefrontnext/site-theming/index.d.ts +0 -14
  104. package/dist/tools/storefrontnext/site-theming/index.js +0 -123
  105. package/dist/tools/storefrontnext/site-theming/response-builder.d.ts +0 -16
  106. package/dist/tools/storefrontnext/site-theming/response-builder.js +0 -316
  107. package/dist/tools/storefrontnext/site-theming/theming-store.d.ts +0 -62
  108. package/dist/tools/storefrontnext/site-theming/theming-store.js +0 -417
  109. package/dist/tools/storefrontnext/site-theming/types.d.ts +0 -35
  110. package/dist/tools/storefrontnext/site-theming/types.js +0 -7
package/README.md CHANGED
@@ -61,30 +61,27 @@ See the [Installation Guide](https://salesforcecommercecloud.github.io/b2c-devel
61
61
 
62
62
  **Project-level configuration** (recommended for Cursor and GitHub Copilot) automatically detects your project location. For **user-level configuration** or when using explicit paths, set `--project-directory` (or `SFCC_PROJECT_DIRECTORY`). MCP clients spawn from the home directory (`~`), not your project.
63
63
 
64
- | Environment Variable | Description |
65
- |---------------------|-------------|
64
+ | Environment Variable | Description |
65
+ | ------------------------ | ------------------------------------------------------------- |
66
66
  | `SFCC_PROJECT_DIRECTORY` | Project directory (enables auto-discovery and config loading) |
67
- | `SFCC_SERVER` | B2C instance hostname |
68
- | `SFCC_USERNAME` | Username for WebDAV |
69
- | `SFCC_PASSWORD` | Password/access key for WebDAV |
70
- | `SFCC_CLIENT_ID` | OAuth client ID |
71
- | `SFCC_CLIENT_SECRET` | OAuth client secret |
72
- | `MRT_API_KEY` | MRT API key (`SFCC_MRT_API_KEY` also supported) |
67
+ | `SFCC_SERVER` | B2C instance hostname |
68
+ | `SFCC_USERNAME` | Username for WebDAV |
69
+ | `SFCC_PASSWORD` | Password/access key for WebDAV |
70
+ | `SFCC_CLIENT_ID` | OAuth client ID |
71
+ | `SFCC_CLIENT_SECRET` | OAuth client secret |
72
+ | `MRT_API_KEY` | MRT API key (`SFCC_MRT_API_KEY` also supported) |
73
73
 
74
74
  See the [Configuration Guide](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/configuration) for credentials, flags, and toolset selection.
75
75
 
76
76
  ## Tools
77
77
 
78
- | Toolset | Tools | Docs |
79
- |---------|-------|------|
80
- | CARTRIDGES | `cartridge_deploy` | [toolsets#cartridges](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#cartridges) |
81
- | MRT | `mrt_bundle_push` | [toolsets#mrt](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#mrt) |
82
- | SCAPI | `scapi_schemas_list`, `scapi_custom_apis_get_status`, `scapi_custom_api_generate_scaffold` | [toolsets#scapi](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#scapi) |
83
- | STOREFRONTNEXT | `mrt_bundle_push` + SCAPI tools (auto-enabled for Storefront Next projects) | [toolsets#storefrontnext](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#storefrontnext) |
84
- | STOREFRONTNEXT_DEPRECATED ⛔ | `sfnext_get_guidelines`, `sfnext_add_page_designer_decorator`, `sfnext_configure_theme`, `sfnext_start_figma_workflow`, `sfnext_analyze_component`, `sfnext_match_tokens_to_theme` — **deprecated, see note below** | [toolsets#storefrontnext-deprecated](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#storefrontnext-deprecated) |
85
- | PWAV3 | `pwakit_get_guidelines` + SCAPI tools | [toolsets#pwav3](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#pwav3) |
86
-
87
- > **⛔ `sfnext_*` tools are deprecated.** The Storefront Next MCP tools are **not compatible with the Storefront Next 1.0 GA release** and have been superseded by the [`storefront-next` and `storefront-next-figma` agent-skills plugins](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/agent-skills), which stay current with the GA release. They have moved to the `STOREFRONTNEXT_DEPRECATED` toolset, which is **never auto-enabled** and **excluded from `--toolsets all`**; to use them you must request the toolset explicitly (`--toolsets STOREFRONTNEXT_DEPRECATED --allow-non-ga-tools`). They will be removed in a future release.
78
+ | Toolset | Tools | Docs |
79
+ | -------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
80
+ | CARTRIDGES | `cartridge_deploy` | [toolsets#cartridges](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#cartridges) |
81
+ | MRT | `mrt_bundle_push` | [toolsets#mrt](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#mrt) |
82
+ | SCAPI | `scapi_schemas_list`, `scapi_custom_apis_get_status`, `scapi_custom_api_generate_scaffold` | [toolsets#scapi](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#scapi) |
83
+ | STOREFRONTNEXT | `mrt_bundle_push` + SCAPI tools (auto-enabled for Storefront Next projects) | [toolsets#storefrontnext](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#storefrontnext) |
84
+ | PWAV3 | `pwakit_get_guidelines` + SCAPI tools | [toolsets#pwav3](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/toolsets#pwav3) |
88
85
 
89
86
  ### cartridge_deploy
90
87
 
@@ -121,49 +118,6 @@ Generate new custom SCAPI endpoint in a cartridge. [Details](https://salesforcec
121
118
  - "Use the MCP tool to scaffold a new custom API named my-products."
122
119
  - "Use the MCP tool to create a custom admin API called customer-trips."
123
120
 
124
- ## Deprecated: Storefront Next (`sfnext_*`) tools
125
-
126
- > **⛔ Deprecated and not compatible with the Storefront Next 1.0 GA release.** The tools below have been superseded by the [`storefront-next` and `storefront-next-figma` agent-skills plugins](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/agent-skills) and will be removed in a future release. They no longer auto-enable for Storefront Next projects and are excluded from `--toolsets all`; to use them, request `--toolsets STOREFRONTNEXT_DEPRECATED --allow-non-ga-tools`. Migrate to the skills plugins.
127
-
128
- ### sfnext_get_guidelines
129
-
130
- Get Storefront Next guidelines and best practices. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-get-guidelines)
131
-
132
- - "Use the MCP tool to show me critical Storefront Next rules."
133
- - "Use the MCP tool to get data-fetching and component patterns."
134
-
135
- ### sfnext_add_page_designer_decorator
136
-
137
- Add Page Designer decorators to components. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-add-page-designer-decorator)
138
-
139
- - "Use the MCP tool to add Page Designer decorators to my component."
140
-
141
- ### sfnext_configure_theme
142
-
143
- Get theming guidelines, questions, and WCAG color validation for Storefront Next. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-configure-theme)
144
-
145
- - "Use the MCP tool to help me apply my brand colors to my Storefront Next site."
146
- - "Use the MCP tool to validate my color combinations for accessibility."
147
-
148
- ### sfnext_start_figma_workflow
149
-
150
- Workflow orchestrator for Figma-to-component conversion. Parses Figma URL, returns step-by-step instructions for subsequent tool calls. Requires external Figma MCP server. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-start-figma-workflow) — [Figma Setup](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/figma-tools-setup)
151
-
152
- - "Use the MCP tool to convert this Figma design to a Storefront Next component: [Figma URL with node-id]"
153
- - "Use the MCP tool to create this homepage from the Figma design: [Figma URL with node-id]"
154
-
155
- ### sfnext_analyze_component
156
-
157
- Analyze design and discovered components to recommend REUSE, EXTEND, or CREATE strategy. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-analyze-component)
158
-
159
- - "Use the MCP tool to analyze the Figma design and recommend whether to reuse, extend, or create a component."
160
-
161
- ### sfnext_match_tokens_to_theme
162
-
163
- Map design tokens to existing theme tokens in app.css with confidence scores and suggestions. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/sfnext-match-tokens-to-theme)
164
-
165
- - "Use the MCP tool to map these Figma design tokens to my theme."
166
-
167
121
  ### pwakit_get_guidelines
168
122
 
169
123
  Get PWA Kit v3 guidelines. [Details](https://salesforcecommercecloud.github.io/b2c-developer-tooling/mcp/tools/pwakit-get-guidelines)
@@ -187,4 +141,3 @@ For MCP development, testing, and local setup, see [CONTRIBUTING.md](./CONTRIBUT
187
141
  ## License
188
142
 
189
143
  This project is licensed under the Apache License 2.0. See [LICENSE.txt](../../LICENSE.txt) for full details.
190
-
@@ -1,6 +1,7 @@
1
1
  import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
2
2
  import type { ResolvedB2CConfig } from '@salesforce/b2c-tooling-sdk/config';
3
3
  import { Services } from '../services.js';
4
+ import type { ProjectContextInput } from '../tools/project-context.js';
4
5
  /**
5
6
  * oclif Command that starts the B2C DX MCP server.
6
7
  *
@@ -81,13 +82,17 @@ export default class McpServerCommand extends BaseCommand<typeof McpServerComman
81
82
  * - extractInstanceFlags() - B2C instance flags (--server, --username, etc.)
82
83
  * - extractMrtFlags() - MRT flags (--api-key, --project, etc.) and loading options
83
84
  *
84
- * Priority (highest to lowest):
85
- * 1. CLI flags (--server, --username, --api-key, etc.)
86
- * 2. Environment variables (SFCC_SERVER, SFCC_USERNAME, MRT_API_KEY, etc.)
87
- * 3. dw.json file (via --config flag or auto-discovered from --project-directory)
88
- * 4. ~/.mobify file (for MRT API key)
85
+ * Configuration file selection (highest to lowest):
86
+ * 1. Per-call configPath
87
+ * 2. Startup --config / SFCC_CONFIG
88
+ * 3. SFCC_CONFIG from the selected project's .env
89
+ * 4. dw.json in the selected project directory
90
+ * 5. Shared default dw.json from the tooling settings
91
+ *
92
+ * Values are then merged through the normal CLI resolver, including
93
+ * environment, plugin, dw.json, ~/.mobify, and package.json sources.
89
94
  */
90
- protected loadConfiguration(): Promise<ResolvedB2CConfig>;
95
+ protected loadConfiguration(projectContext?: ProjectContextInput): Promise<ResolvedB2CConfig>;
91
96
  /**
92
97
  * Loads configuration and creates a new Services instance.
93
98
  *
@@ -97,7 +102,7 @@ export default class McpServerCommand extends BaseCommand<typeof McpServerComman
97
102
  *
98
103
  * @returns A new Services instance with loaded configuration
99
104
  */
100
- protected loadServices(): Promise<Services>;
105
+ protected loadServices(projectContext?: ProjectContextInput): Promise<Services>;
101
106
  /**
102
107
  * Main entry point - starts the MCP server.
103
108
  *
@@ -125,4 +130,6 @@ export default class McpServerCommand extends BaseCommand<typeof McpServerComman
125
130
  * These can be exposed to Services if needed for features like telemetry or caching.
126
131
  */
127
132
  run(): Promise<void>;
133
+ /** Parse a project's .env without mutating the long-lived MCP process environment. */
134
+ private loadProjectEnvironment;
128
135
  }
@@ -132,8 +132,10 @@
132
132
  * { "args": ["--toolsets", "all", "--allow-non-ga-tools", "--debug"] }
133
133
  * ```
134
134
  */
135
+ import path from 'node:path';
135
136
  import { Flags } from '@oclif/core';
136
137
  import { BaseCommand, MrtCommand, InstanceCommand, loadConfig, extractInstanceFlags, extractMrtFlags, } from '@salesforce/b2c-tooling-sdk/cli';
138
+ import { EnvSource, readProjectEnvironment } from '@salesforce/b2c-tooling-sdk/config';
137
139
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
138
140
  import { B2CDxMcpServer } from '../server.js';
139
141
  import { Services } from '../services.js';
@@ -240,24 +242,47 @@ export default class McpServerCommand extends BaseCommand {
240
242
  * - extractInstanceFlags() - B2C instance flags (--server, --username, etc.)
241
243
  * - extractMrtFlags() - MRT flags (--api-key, --project, etc.) and loading options
242
244
  *
243
- * Priority (highest to lowest):
244
- * 1. CLI flags (--server, --username, --api-key, etc.)
245
- * 2. Environment variables (SFCC_SERVER, SFCC_USERNAME, MRT_API_KEY, etc.)
246
- * 3. dw.json file (via --config flag or auto-discovered from --project-directory)
247
- * 4. ~/.mobify file (for MRT API key)
245
+ * Configuration file selection (highest to lowest):
246
+ * 1. Per-call configPath
247
+ * 2. Startup --config / SFCC_CONFIG
248
+ * 3. SFCC_CONFIG from the selected project's .env
249
+ * 4. dw.json in the selected project directory
250
+ * 5. Shared default dw.json from the tooling settings
251
+ *
252
+ * Values are then merged through the normal CLI resolver, including
253
+ * environment, plugin, dw.json, ~/.mobify, and package.json sources.
248
254
  */
249
- async loadConfiguration() {
255
+ async loadConfiguration(projectContext) {
250
256
  const mrt = extractMrtFlags(this.flags);
257
+ const baseOptions = this.flags ? this.getBaseConfigOptions() : {};
258
+ const effectiveProjectDirectory = path.resolve(projectContext?.projectDirectory ?? baseOptions.projectDirectory ?? process.cwd());
259
+ const projectEnvironment = this.loadProjectEnvironment(effectiveProjectDirectory);
260
+ const projectConfigPath = projectEnvironment?.SFCC_CONFIG;
261
+ const configPath = (projectContext?.configPath
262
+ ? path.resolve(effectiveProjectDirectory ?? process.cwd(), projectContext.configPath)
263
+ : undefined) ??
264
+ baseOptions.configPath ??
265
+ (projectConfigPath && effectiveProjectDirectory
266
+ ? path.isAbsolute(projectConfigPath)
267
+ ? projectConfigPath
268
+ : path.resolve(effectiveProjectDirectory, projectConfigPath)
269
+ : undefined);
251
270
  const options = {
252
- ...this.getBaseConfigOptions(),
271
+ ...baseOptions,
253
272
  ...mrt.options,
273
+ configPath,
274
+ instance: projectContext?.instanceName ?? baseOptions.instance,
275
+ projectDirectory: effectiveProjectDirectory,
276
+ workingDirectory: effectiveProjectDirectory,
254
277
  };
255
278
  // Combine B2C instance flags and MRT config flags
256
279
  const flagConfig = {
257
280
  ...extractInstanceFlags(this.flags),
258
281
  ...mrt.config,
259
282
  };
260
- return loadConfig(flagConfig, options);
283
+ return loadConfig(flagConfig, options, {
284
+ before: projectEnvironment ? [new EnvSource(projectEnvironment)] : undefined,
285
+ });
261
286
  }
262
287
  /**
263
288
  * Loads configuration and creates a new Services instance.
@@ -268,9 +293,41 @@ export default class McpServerCommand extends BaseCommand {
268
293
  *
269
294
  * @returns A new Services instance with loaded configuration
270
295
  */
271
- async loadServices() {
272
- const config = await this.loadConfiguration();
273
- return Services.fromResolvedConfig(config);
296
+ async loadServices(projectContext) {
297
+ const config = await this.loadConfiguration(projectContext);
298
+ const baseOptions = this.flags ? this.getBaseConfigOptions() : {};
299
+ const configuredProjectDirectory = baseOptions.projectDirectory;
300
+ const effectiveProjectDirectory = path.resolve(projectContext?.projectDirectory ?? configuredProjectDirectory ?? process.cwd());
301
+ const projectEnvironment = this.loadProjectEnvironment(effectiveProjectDirectory);
302
+ const projectConfigPath = projectEnvironment?.SFCC_CONFIG;
303
+ let primaryConfiguration;
304
+ if (projectContext?.configPath) {
305
+ primaryConfiguration = {
306
+ path: path.resolve(effectiveProjectDirectory, projectContext.configPath),
307
+ source: 'argument',
308
+ };
309
+ }
310
+ else if (baseOptions.configPath) {
311
+ primaryConfiguration = { path: path.resolve(baseOptions.configPath), source: 'server' };
312
+ }
313
+ else if (projectConfigPath) {
314
+ primaryConfiguration = {
315
+ path: path.isAbsolute(projectConfigPath)
316
+ ? projectConfigPath
317
+ : path.resolve(effectiveProjectDirectory, projectConfigPath),
318
+ source: 'projectEnvironment',
319
+ };
320
+ }
321
+ else {
322
+ primaryConfiguration = { path: path.join(effectiveProjectDirectory, 'dw.json'), source: 'projectDirectory' };
323
+ }
324
+ return Services.fromResolvedConfig(config, projectEnvironment, {
325
+ projectDirectory: {
326
+ path: effectiveProjectDirectory,
327
+ source: projectContext?.projectDirectory ? 'argument' : configuredProjectDirectory ? 'config' : 'cwd',
328
+ },
329
+ primaryConfiguration,
330
+ });
274
331
  }
275
332
  /**
276
333
  * Main entry point - starts the MCP server.
@@ -333,7 +390,15 @@ export default class McpServerCommand extends BaseCommand {
333
390
  this.serverContext = new ServerContext();
334
391
  // Register toolsets with loader function that loads config and creates Services on each tool call
335
392
  // This allows tools to pick up changes to config files (dw.json, ~/.mobify) between invocations
336
- await registerToolsets(startupFlags, server, this.loadServices.bind(this), this.serverContext);
393
+ const loadServices = this.loadServices.bind(this);
394
+ const configuredProjectDirectory = this.flags['project-directory'];
395
+ loadServices.projectContextDefaults = {
396
+ projectDirectory: {
397
+ path: path.resolve(configuredProjectDirectory ?? process.cwd()),
398
+ source: configuredProjectDirectory ? 'config' : 'cwd',
399
+ },
400
+ };
401
+ await registerToolsets(startupFlags, server, loadServices, this.serverContext);
337
402
  // Connect to stdio transport
338
403
  const transport = new StdioServerTransport();
339
404
  await server.connect(transport);
@@ -362,5 +427,19 @@ export default class McpServerCommand extends BaseCommand {
362
427
  });
363
428
  this.logger.info({ version: this.config.version }, 'MCP Server running on stdio');
364
429
  }
430
+ /** Parse a project's .env without mutating the long-lived MCP process environment. */
431
+ loadProjectEnvironment(projectDirectory) {
432
+ if (!projectDirectory)
433
+ return undefined;
434
+ const envPath = path.join(projectDirectory, '.env');
435
+ try {
436
+ return readProjectEnvironment(projectDirectory);
437
+ }
438
+ catch (error) {
439
+ const message = error instanceof Error ? error.message : String(error);
440
+ this.logger?.warn({ envPath, error: message }, '[Config] Failed to load project .env file');
441
+ }
442
+ return undefined;
443
+ }
365
444
  }
366
445
  //# sourceMappingURL=mcp.js.map
@@ -2,8 +2,8 @@ import { type ProjectType } from '@salesforce/b2c-tooling-sdk/discovery';
2
2
  import { type DocCategory } from '@salesforce/b2c-tooling-sdk/docs';
3
3
  import type { McpTool, Toolset, StartupFlags } from './utils/index.js';
4
4
  import type { B2CDxMcpServer } from './server.js';
5
- import type { Services } from './services.js';
6
5
  import type { ServerContext } from './server-context.js';
6
+ import type { ServicesLoader } from './tools/adapter.js';
7
7
  /**
8
8
  * Registry of tools organized by toolset.
9
9
  * Tools can belong to multiple toolsets via their `toolsets` array.
@@ -17,5 +17,5 @@ export type ToolRegistry = Record<Toolset, McpTool[]>;
17
17
  * @param loadServices - Function that loads configuration and returns Services instance
18
18
  * @returns Complete tool registry
19
19
  */
20
- export declare function createToolRegistry(loadServices: () => Promise<Services> | Services, serverContext?: ServerContext, detectedWorkspaces?: readonly ProjectType[], enabledDocCategories?: readonly DocCategory[]): ToolRegistry;
21
- export declare function registerToolsets(flags: StartupFlags, server: B2CDxMcpServer, loadServices: () => Promise<Services> | Services, serverContext?: ServerContext): Promise<void>;
20
+ export declare function createToolRegistry(loadServices: ServicesLoader, serverContext?: ServerContext, detectedWorkspaces?: readonly ProjectType[], enabledDocCategories?: readonly DocCategory[]): ToolRegistry;
21
+ export declare function registerToolsets(flags: StartupFlags, server: B2CDxMcpServer, loadServices: ServicesLoader, serverContext?: ServerContext): Promise<void>;
package/dist/registry.js CHANGED
@@ -5,17 +5,17 @@
5
5
  */
6
6
  import os from 'node:os';
7
7
  import path from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
8
9
  import { getLogger } from '@salesforce/b2c-tooling-sdk/logging';
9
10
  import { detectWorkspaceType } from '@salesforce/b2c-tooling-sdk/discovery';
10
11
  import { DOC_CATEGORIES, resolveEnabledCategories } from '@salesforce/b2c-tooling-sdk/docs';
11
- import { ALL_TOOLSETS, DEPRECATED_TOOLSETS, TOOLSETS, VALID_TOOLSET_NAMES } from './utils/index.js';
12
+ import { ALL_TOOLSETS, TOOLSETS, VALID_TOOLSET_NAMES } from './utils/index.js';
12
13
  import { createCartridgesTools } from './tools/cartridges/index.js';
13
14
  import { createDiagnosticsTools } from './tools/diagnostics/index.js';
14
15
  import { createDocsTools } from './tools/docs/index.js';
15
16
  import { createMrtTools } from './tools/mrt/index.js';
16
17
  import { createPwav3Tools } from './tools/pwav3/index.js';
17
18
  import { createScapiTools } from './tools/scapi/index.js';
18
- import { createStorefrontNextTools } from './tools/storefrontnext/index.js';
19
19
  /**
20
20
  * Base toolsets that are always enabled regardless of detected project type.
21
21
  * - SCAPI: SCAPI discovery and custom API scaffolding tools.
@@ -33,9 +33,6 @@ const PROJECT_TYPE_TOOLSETS = {
33
33
  // (A SFRA workspace also matches the `cartridges` marker; the union dedupes.)
34
34
  sfra: ['CARTRIDGES'],
35
35
  'pwa-kit-v3': ['PWAV3', 'MRT'],
36
- // Note: STOREFRONTNEXT_DEPRECATED is intentionally NOT auto-activated. The
37
- // legacy sfnext_* tools are superseded by the storefront-next agent-skills
38
- // plugins and must be explicitly requested via --toolsets.
39
36
  'storefront-next': ['STOREFRONTNEXT', 'MRT', 'CARTRIDGES'],
40
37
  };
41
38
  /**
@@ -84,7 +81,6 @@ export function createToolRegistry(loadServices, serverContext, detectedWorkspac
84
81
  PWAV3: [],
85
82
  SCAPI: [],
86
83
  STOREFRONTNEXT: [],
87
- STOREFRONTNEXT_DEPRECATED: [],
88
84
  };
89
85
  // Collect all tools from all factories
90
86
  const allTools = [
@@ -94,7 +90,6 @@ export function createToolRegistry(loadServices, serverContext, detectedWorkspac
94
90
  ...createMrtTools(loadServices),
95
91
  ...createPwav3Tools(loadServices),
96
92
  ...createScapiTools(loadServices),
97
- ...createStorefrontNextTools(loadServices),
98
93
  ];
99
94
  // Organize tools by their declared toolsets (supports multi-toolset)
100
95
  for (const tool of allTools) {
@@ -117,6 +112,7 @@ export function createToolRegistry(loadServices, serverContext, detectedWorkspac
117
112
  * without descending into unrelated deep trees.
118
113
  */
119
114
  const DISCOVERY_MAX_DEPTH = 5;
115
+ const MCP_PACKAGE_DIRECTORY = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
120
116
  /**
121
117
  * Returns true when `dir` is a location that should never be recursively
122
118
  * scanned for a workspace: the user's home directory or a filesystem root.
@@ -130,7 +126,7 @@ function isUnscannableRoot(dir) {
130
126
  return true;
131
127
  }
132
128
  const home = os.homedir();
133
- return Boolean(home) && path.resolve(home) === resolved;
129
+ return (Boolean(home) && path.resolve(home) === resolved) || resolved === MCP_PACKAGE_DIRECTORY;
134
130
  }
135
131
  /**
136
132
  * Performs workspace auto-discovery and returns appropriate toolsets.
@@ -157,7 +153,7 @@ async function detectProjectTypes(flags) {
157
153
  // Never recursively scan a home directory or filesystem root — the scan would
158
154
  // be expensive and would not identify a meaningful workspace anyway.
159
155
  if (isUnscannableRoot(projectDirectory)) {
160
- logger.warn({ projectDirectory }, 'Project directory is a home or root directory; skipping workspace auto-discovery. ' +
156
+ logger.warn({ projectDirectory }, 'Project directory is a home, filesystem root, or MCP installation directory; skipping workspace auto-discovery. ' +
161
157
  'Set --project-directory or SFCC_PROJECT_DIRECTORY to the project path to enable it.');
162
158
  return [];
163
159
  }
@@ -224,12 +220,9 @@ export async function registerToolsets(flags, server, loadServices, serverContex
224
220
  if (invalidToolsets.length > 0) {
225
221
  logger.warn({ invalidToolsets, validToolsets: VALID_TOOLSET_NAMES }, `Ignoring invalid toolset(s): "${invalidToolsets.join('", "')}"`);
226
222
  }
227
- // Determine which toolsets to enable.
228
- // `ALL` expands to every toolset EXCEPT deprecated ones — deprecated toolsets
229
- // must always be named explicitly.
223
+ // Determine which toolsets to enable. `ALL` expands to every toolset.
230
224
  const validToolsets = toolsets.filter((t) => TOOLSETS.includes(t));
231
- const allNonDeprecatedToolsets = TOOLSETS.filter((t) => !DEPRECATED_TOOLSETS.includes(t));
232
- const toolsetsToEnable = new Set(toolsets.includes(ALL_TOOLSETS) ? allNonDeprecatedToolsets : validToolsets);
225
+ const toolsetsToEnable = new Set(toolsets.includes(ALL_TOOLSETS) ? TOOLSETS : validToolsets);
233
226
  // Auto-discovery: only when no valid toolsets AND no valid individual tools
234
227
  // were provided. This handles both (1) no flags provided, and (2) all
235
228
  // provided flags are invalid. Skip workspace detection entirely otherwise —
@@ -18,7 +18,7 @@ import { DebugSessionRegistry } from './tools/diagnostics/session-registry.js';
18
18
  * client would also share the same context. Tools that mutate registries
19
19
  * (like the debug tools) should not assume single-tenant access.
20
20
  *
21
- * The registries dedup on a stable key (host:client_id for debug, hostname for
21
+ * The registries dedup on an internal stable key (host plus MCP-owned debugger client ID, hostname for
22
22
  * SFCC log watches, project/environment/origin for MRT log watches), so
23
23
  * multi-agent use is functional but agents may see each other's
24
24
  * sessions/watches via list tools.
@@ -23,7 +23,7 @@ import { DebugSessionRegistry } from './tools/diagnostics/session-registry.js';
23
23
  * client would also share the same context. Tools that mutate registries
24
24
  * (like the debug tools) should not assume single-tenant access.
25
25
  *
26
- * The registries dedup on a stable key (host:client_id for debug, hostname for
26
+ * The registries dedup on an internal stable key (host plus MCP-owned debugger client ID, hostname for
27
27
  * SFCC log watches, project/environment/origin for MRT log watches), so
28
28
  * multi-agent use is functional but agents may see each other's
29
29
  * sessions/watches via list tools.
@@ -40,6 +40,7 @@ import fs from 'node:fs';
40
40
  import type { B2CInstance } from '@salesforce/b2c-tooling-sdk';
41
41
  import type { AuthStrategy } from '@salesforce/b2c-tooling-sdk/auth';
42
42
  import type { ResolvedB2CConfig } from '@salesforce/b2c-tooling-sdk/config';
43
+ import type { ConfigurationResolutionSource, ProjectDirectoryInfo, ToolResolution } from './tools/project-context.js';
43
44
  import { WebDavClient, type CustomApisClient, type MetricsClient, type ScapiSchemasClient } from '@salesforce/b2c-tooling-sdk/clients';
44
45
  /**
45
46
  * MRT (Managed Runtime) configuration.
@@ -65,6 +66,20 @@ export interface ServicesOptions {
65
66
  mrtConfig?: MrtConfig;
66
67
  /** Resolved configuration for access to SCAPI settings */
67
68
  resolvedConfig: ResolvedB2CConfig;
69
+ /** Project-scoped environment parsed from the effective project's .env file. */
70
+ projectEnvironment?: Readonly<Record<string, string | undefined>>;
71
+ /** Inputs needed to attribute project and primary-configuration selection. */
72
+ resolution?: ServicesResolutionInputs;
73
+ }
74
+ /** Resolution inputs captured centrally by the MCP command for one tool call. */
75
+ export interface ServicesResolutionInputs {
76
+ /** Effective project directory and its selection source. */
77
+ projectDirectory: ProjectDirectoryInfo;
78
+ /** Primary configuration candidate selected before the SDK resolver runs. */
79
+ primaryConfiguration?: {
80
+ path: string;
81
+ source: Exclude<ConfigurationResolutionSource, 'globalDefault' | 'none'>;
82
+ };
68
83
  }
69
84
  /**
70
85
  * Services class that provides utilities for MCP tools.
@@ -100,6 +115,8 @@ export declare class Services {
100
115
  * Provides access to shortCode, tenantId, and OAuth credentials.
101
116
  * @private
102
117
  */
118
+ private readonly projectEnvironment;
119
+ private readonly resolution;
103
120
  private readonly resolvedConfig;
104
121
  constructor(opts: ServicesOptions);
105
122
  /**
@@ -114,7 +131,7 @@ export declare class Services {
114
131
  * const services = Services.fromResolvedConfig(this.resolvedConfig);
115
132
  * ```
116
133
  */
117
- static fromResolvedConfig(config: ResolvedB2CConfig): Services;
134
+ static fromResolvedConfig(config: ResolvedB2CConfig, projectEnvironment?: Readonly<Record<string, string | undefined>>, resolution?: ServicesResolutionInputs): Services;
118
135
  /**
119
136
  * Check if a file or directory exists.
120
137
  *
@@ -143,6 +160,11 @@ export declare class Services {
143
160
  * Get the current working directory.
144
161
  */
145
162
  getCwd(): string;
163
+ /**
164
+ * Read an environment variable with the ambient process environment taking
165
+ * precedence over the project-scoped .env value.
166
+ */
167
+ getEnvironmentVariable(name: string): string | undefined;
146
168
  /**
147
169
  * Get the user's home directory.
148
170
  */
@@ -167,6 +189,12 @@ export declare class Services {
167
189
  * Get OS platform information.
168
190
  */
169
191
  getPlatform(): NodeJS.Platform;
192
+ /**
193
+ * Get compact project and selected-configuration provenance for MCP results.
194
+ * Detailed source graphs remain available through {@link getResolvedConfig}
195
+ * for the config_inspect tool.
196
+ */
197
+ getResolution(): ToolResolution;
170
198
  /**
171
199
  * Get the resolved configuration (values, sources, warnings).
172
200
  *
package/dist/services.js CHANGED
@@ -45,6 +45,28 @@ import fs from 'node:fs';
45
45
  import path from 'node:path';
46
46
  import os from 'node:os';
47
47
  import { createCustomApisClient, createMetricsClient, createScapiSchemasClient, toOrganizationId, WebDavClient, } from '@salesforce/b2c-tooling-sdk/clients';
48
+ function createToolResolution(config, inputs) {
49
+ const configuredProjectDirectory = config.values.projectDirectory;
50
+ const projectDirectory = inputs?.projectDirectory ??
51
+ (configuredProjectDirectory
52
+ ? { path: configuredProjectDirectory, source: 'config' }
53
+ : { path: process.cwd(), source: 'cwd' });
54
+ const dwJsonSource = config.sources.find((source) => source.name === 'DwJsonSource' && source.location);
55
+ const configurationSource = dwJsonSource
56
+ ? dwJsonSource.scope === 'global'
57
+ ? 'globalDefault'
58
+ : (inputs?.primaryConfiguration?.source ?? 'projectDirectory')
59
+ : 'none';
60
+ return {
61
+ projectDirectory,
62
+ configuration: {
63
+ ...(dwJsonSource?.location ? { path: dwJsonSource.location } : {}),
64
+ source: configurationSource,
65
+ ...(config.values.instanceName ? { instanceName: config.values.instanceName } : {}),
66
+ ...(config.values.hostname ? { hostname: config.values.hostname } : {}),
67
+ },
68
+ };
69
+ }
48
70
  /**
49
71
  * Services class that provides utilities for MCP tools.
50
72
  *
@@ -79,11 +101,15 @@ export class Services {
79
101
  * Provides access to shortCode, tenantId, and OAuth credentials.
80
102
  * @private
81
103
  */
104
+ projectEnvironment;
105
+ resolution;
82
106
  resolvedConfig;
83
107
  constructor(opts) {
84
108
  this.b2cInstance = opts.b2cInstance;
85
109
  this.mrtConfig = opts.mrtConfig ?? {};
86
110
  this.resolvedConfig = opts.resolvedConfig;
111
+ this.projectEnvironment = opts.projectEnvironment ?? {};
112
+ this.resolution = createToolResolution(opts.resolvedConfig, opts.resolution);
87
113
  }
88
114
  /**
89
115
  * Creates a Services instance from an already-resolved configuration.
@@ -97,7 +123,7 @@ export class Services {
97
123
  * const services = Services.fromResolvedConfig(this.resolvedConfig);
98
124
  * ```
99
125
  */
100
- static fromResolvedConfig(config) {
126
+ static fromResolvedConfig(config, projectEnvironment, resolution) {
101
127
  // Build MRT config using factory methods
102
128
  const mrtConfig = {
103
129
  auth: config.hasMrtConfig() ? config.createMrtAuth() : undefined,
@@ -111,6 +137,8 @@ export class Services {
111
137
  b2cInstance,
112
138
  mrtConfig,
113
139
  resolvedConfig: config,
140
+ projectEnvironment,
141
+ resolution,
114
142
  });
115
143
  }
116
144
  // ============================================
@@ -161,6 +189,13 @@ export class Services {
161
189
  getCwd() {
162
190
  return process.cwd();
163
191
  }
192
+ /**
193
+ * Read an environment variable with the ambient process environment taking
194
+ * precedence over the project-scoped .env value.
195
+ */
196
+ getEnvironmentVariable(name) {
197
+ return process.env[name] ?? this.projectEnvironment[name];
198
+ }
164
199
  /**
165
200
  * Get the user's home directory.
166
201
  */
@@ -206,6 +241,18 @@ export class Services {
206
241
  getPlatform() {
207
242
  return os.platform();
208
243
  }
244
+ /**
245
+ * Get compact project and selected-configuration provenance for MCP results.
246
+ * Detailed source graphs remain available through {@link getResolvedConfig}
247
+ * for the config_inspect tool.
248
+ */
249
+ getResolution() {
250
+ return {
251
+ projectDirectory: { ...this.resolution.projectDirectory },
252
+ ...(this.resolution.configuration ? { configuration: { ...this.resolution.configuration } } : {}),
253
+ ...(this.resolution.directories ? { directories: { ...this.resolution.directories } } : {}),
254
+ };
255
+ }
209
256
  /**
210
257
  * Get the resolved configuration (values, sources, warnings).
211
258
  *
@@ -69,6 +69,12 @@ import type { B2CInstance } from '@salesforce/b2c-tooling-sdk';
69
69
  import type { McpTool, ToolResult, Toolset } from '../utils/index.js';
70
70
  import type { Services, MrtConfig } from '../services.js';
71
71
  import type { ServerContext } from '../server-context.js';
72
+ import { type DirectoryResolutionInfo, type ProjectContextDefaults, type ProjectContextInput, type ToolResolution } from './project-context.js';
73
+ /** Services loader enriched with registration-time project fallback provenance. */
74
+ export interface ServicesLoader {
75
+ (projectContext?: ProjectContextInput): Promise<Services> | Services;
76
+ projectContextDefaults?: ProjectContextDefaults;
77
+ }
72
78
  /**
73
79
  * Context provided to tool execute functions.
74
80
  * Contains the B2CInstance and/or MRT config based on tool requirements.
@@ -95,6 +101,10 @@ export interface ToolExecutionContext {
95
101
  * Created once at server startup and shared across all tool invocations.
96
102
  */
97
103
  serverContext?: ServerContext;
104
+ /** Compact resolution provenance that will be attached to this tool result. */
105
+ resolution: ToolResolution;
106
+ /** Record a specialized directory resolved by the tool. */
107
+ setResolvedDirectory: (name: string, value: DirectoryResolutionInfo) => void;
98
108
  }
99
109
  /**
100
110
  * Options for creating a tool adapter.
@@ -125,6 +135,18 @@ export interface ToolAdapterOptions<TInput, TOutput> {
125
135
  * Defaults to false.
126
136
  */
127
137
  requiresMrtAuth?: boolean;
138
+ /**
139
+ * Whether this tool resolves configuration or files relative to a project.
140
+ * Project-aware tools automatically expose a per-call `projectDirectory`
141
+ * input and use it while loading Services.
142
+ */
143
+ usesProjectContext?: boolean;
144
+ /**
145
+ * Whether this tool selects project configuration without requiring a
146
+ * B2CInstance or MRT auth object (for example config_inspect or SCAPI clients).
147
+ * Adds projectDirectory, configPath, and instanceName to the public schema.
148
+ */
149
+ usesConfigurationContext?: boolean;
128
150
  /**
129
151
  * Execute function that performs the tool's operation.
130
152
  * Receives validated input and a context with B2CInstance and/or auth based on requirements.
@@ -173,6 +195,8 @@ export declare function errorResult(message: string): ToolResult;
173
195
  * ```
174
196
  */
175
197
  export declare function jsonResult(data: unknown, indent?: number): ToolResult;
198
+ /** Attach compact resolution provenance while preserving existing tool output. */
199
+ export declare function attachResolution(result: ToolResult, resolution: ToolResolution): ToolResult;
176
200
  /**
177
201
  * Creates an MCP tool from a b2c-tooling function.
178
202
  *
@@ -212,4 +236,4 @@ export declare function jsonResult(data: unknown, indent?: number): ToolResult;
212
236
  * }, loadServices);
213
237
  * ```
214
238
  */
215
- export declare function createToolAdapter<TInput, TOutput>(options: ToolAdapterOptions<TInput, TOutput>, loadServices: () => Promise<Services> | Services, serverContext?: ServerContext): McpTool;
239
+ export declare function createToolAdapter<TInput, TOutput>(options: ToolAdapterOptions<TInput, TOutput>, loadServices: ServicesLoader, serverContext?: ServerContext): McpTool;