Skip to content

Feature/mcp cartridge deploy implementation#114

Merged
patricksullivansf merged 6 commits intomainfrom
feature/mcpCartridgeDeployImplementation
Feb 10, 2026
Merged

Feature/mcp cartridge deploy implementation#114
patricksullivansf merged 6 commits intomainfrom
feature/mcpCartridgeDeployImplementation

Conversation

@patricksullivansf
Copy link
Contributor

@patricksullivansf patricksullivansf commented Feb 6, 2026

Summary

Provides an implementation for the MCP Cartridge Deploy Tool (cartridge_deploy).

  • implement using operations SDK findAndDeployCartridges
  • add unit tests for MCP Cartridge Deploy Tool, using dependency injection pattern for SDK stubbing.
  • add patricksullivansf to CODEOWNERS

Testing

This was tested in cursor within a folder created with the commands (wonky because I don't have b2c cli installed globally):

cd /opt/workspace/dev/b2c-developer-tooling
pnpm --filter @salesforce/b2c-cli run dev scaffold cartridge --name app_custom_test
mkdir ../tmp/cartridge_mcp_test
mv packages/b2c-cli/cartridges ../tmp/cartridge_mcp_test/.

#
# Final Project Folder Layout
#

cartridge_mcp_test/
 ├── dw.json
└── cartridges/
    └── app_custom_test/
        ├── .project      
        └── cartridge/
            ├── app_custom_test.properties
            ├── controllers/
            ├── models/
            ├── scripts/
            └── templates/

# dw.json contents
{
  "client-id": "50f33ebd-20cd-4f08-88bd-4dfefeedbc9e",
  "client-secret": "REDACTED",
   "username": "patricksullivan@salesforce.com",
  "password": "REDACTED",
  "hostname": "zzrf-045.dx.commercecloud.salesforce.com",
  "code-version": "v1"
}

To run the MCP we used the mcp.json below with the prompt: run the cartridge deploy tool to deploy app_custom_test

Note there were several failed attempts (see caveats below)

 "b2c-dx": {
      "command": "node",
      "args": [
        "/opt/workspace/dev/b2c-developer-tooling/packages/b2c-dx-mcp/bin/dev.js",
        "--working-directory",
        "${workspaceFolder}",
        "--toolsets",
        "CARTRIDGES",
        "--allow-non-ga-tools",
        "--debug"
      ]
    }

The cartridge successfully uploaded and can be seen ready to be deployed in https://zzrf-045.dx.commercecloud.salesforce.com/on/demandware.store/Sites-Site/default%3bapp%3d__bm_admin/ViewCodeVersion-Start?VersionID=v1

However, there are caveats worth further investigation

  • originally I opened cursor with the root folder /opt/workspace/dev/tmp/cartridge_mcp_test/cartridges and dw.json at this root. I used the simple prompt "run the cartridge deploy tool" and cursor did an excellent job of supplying reasonable default paths to the tool. However, it was unable to find the dw.json file and deployment failed.
  • after changing cursors root folder to /opt/workspace/dev/tmp/cartridge_mcp_test and dw.json at this root, cursor found the dw.json file. However, it did a terrible job of supplying default paths. On it's first run it scanned my entire home folder "~/." looking and failing to find the cartridges (note my home folder isn't even in the project path). On the third run it supplied an absolute path as the tool "directory" argument /opt/workspace/dev/tmp/cartridge_mcp_test/cartridges and this run succeeded.
  • note the code-version also needed to be explicitly specified in the dw.json or the tool errored out. Mentioning this because I'm not sure if we want to supply a default, or if we want the MCP tool to be able to supply (and hallucinate) a code-version.

  • Tests pass (pnpm test)
  • Code is formatted (pnpm run format)

@patricksullivansf patricksullivansf marked this pull request as ready for review February 6, 2026 23:30
@patricksullivansf patricksullivansf force-pushed the feature/mcpCartridgeDeployImplementation branch from df9304e to daab57f Compare February 6, 2026 23:43
clavery
clavery previously approved these changes Feb 10, 2026
Copy link
Collaborator

@clavery clavery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

{
name: 'cartridge_deploy',
description: '[PLACEHOLDER] Deploy cartridges to a B2C Commerce instance',
description: 'Deploy cartridges to a B2C Commerce instance via WebDAV',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we want to allow push only operation?

Copy link
Contributor

@yhsieh1 yhsieh1 Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patricksullivansf Sorry for not clear on what I mean. A better description helps understand how to use the tool. Can we improve the description so that agent knows how to use this tool properly?
For example add sections for:
When to use this tool:
How to choose operation:
Efficient workflows for agents:
Rules:
Examples:
Requirements:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can reference the b2c-code skill for some ideas.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated tool description and option descriptions using claude opus suggested text based on code and jsdoc of underlying sdk.


// TODO: Remove this log when implementing
// Parse options
const options: DeployOptions = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need better tool name and description if we allow all operations.
We should also ask agent to confirm dangerous operation like delete.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update readme.md with some examples how to prompt agent to use the tool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only has description for cartridge deploy but does not contain other operation provided here. Also

Cartridge development, deployment, and code version management.
needs update as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the delete option.

"cartridge deploy but does not contain other operation provided here" - think this was just a misunderstanding; updated the option descriptions to make it more clear the options affect cartridge deployment and are not unique operations.

Copy link
Contributor

@yhsieh1 yhsieh1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@patricksullivansf patricksullivansf merged commit c045eec into main Feb 10, 2026
3 checks passed
@patricksullivansf patricksullivansf deleted the feature/mcpCartridgeDeployImplementation branch February 10, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants