Skip to content

feat(mcp): implement MRT Push MCP Tool#110

Merged
patricksullivansf merged 4 commits intomainfrom
feature/mcpMrtPushImplementation
Feb 6, 2026
Merged

feat(mcp): implement MRT Push MCP Tool#110
patricksullivansf merged 4 commits intomainfrom
feature/mcpMrtPushImplementation

Conversation

@patricksullivansf
Copy link
Contributor

@patricksullivansf patricksullivansf commented Feb 5, 2026

Summary

Provides an implementation for the MCP MRT Bundle Push Tool (mrt_bundle_push).

  • implement using MRT SDK pushBundle
  • add support for alternate cloud origins via SFCC_MRT_CLOUD_ORIGIN, --cloud-orgin, and mrtOrigin options. Update adapter tests for cloud origin.
  • add unit tests for MCP MRT Bundle Push Tool, and introduce dependency injection pattern for SDK stubbing.
  • copy test file lint rule exceptions from CLI project to reduce spurious warnings.
  • remove trailing whitespace in unrelated storefrontnext/README.md

Testing

This was tested in cursor within a folder created with the commands:

npx @salesforce/pwa-kit-create-app
cd retail-react-app
npm run build

To run the MCP we used the mcp.json below with the prompt run the bundle push tool with message 'from mcp'

    "b2c-dx": {
      "command": "node",
      "args": [
        "/opt/workspace/dev/b2c-developer-tooling/packages/b2c-dx-mcp/bin/dev.js",
        "--working-directory",
        "${workspaceFolder}",
        "--toolsets",
        "MRT",
        "--cloud-origin",
        "https://cloud-staging.mrt-staging.com",
        "--project",
        "cc-sparks",
        "--allow-non-ga-tools",
        "--debug"
      ],
      "env": {
        "SFCC_MRT_API_KEY": "REDACTED"
      }
    }

Note the inclusion of local MCP server path, explicit destination & credentials (see caveats below)

The bundle successfully uploaded and can be seen ready to be deployed in https://runtime-admin-staging.mobify-storefront.com/salesforce-internal/cc-sparks/patrick

However, there are caveats worth further investigation

  • the current folder used in cursor seems off.  It always starts with ./build but gives a file not found error, then retries with absolute path to build folder and succeeds.
  • setting options in package.json seem to be ignored. For example, "b2c": { "mrtProject": "cc-sparks" }.
  • it fails to load and use the api_key from my ~./mobify file. For example, { "username": "patricksullivan@salesforce.com", "api_key": "REDACTED" }

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

@clavery
Copy link
Collaborator

clavery commented Feb 5, 2026

setting options in project.json

Do you mean package.json? or dw.json?

@clavery
Copy link
Collaborator

clavery commented Feb 5, 2026

it fails to load and use the api_key from my ~./mobify file

Highly recommend using mcp inspector tool here and running the MCP with --log-level trace to see what's going on. It's possible the config loading logic in the MCP is not correct.

@patricksullivansf
Copy link
Contributor Author

setting options in project.json

Do you mean package.json? or dw.json?

Oops, corrected description. I mean package.json of the test project (retail-react-app)

@patricksullivansf patricksullivansf marked this pull request as ready for review February 6, 2026 00:18
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.

I do not get chance to test it but it looks good.

project?: string;
/** MRT environment from --environment flag or SFCC_MRT_ENVIRONMENT env var */
environment?: string;
/** MRT API origin URL from --cloud-origin flag, SFCC_MRT_CLOUD_ORIGIN env var, or mrtOrigin in dw.json */
Copy link
Contributor

Choose a reason for hiding this comment

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

is this the correct sequence to get origin? do we still have issue read from dw.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The actual sequence is apparently this, but I'm not sure we need his level of detail?

 /** MRT API origin URL from --cloud-origin flag (oclif also checks SFCC_MRT_CLOUD_ORIGIN env var), mrtOrigin in dw.json, or default */

Copy link
Collaborator

@clavery clavery Feb 6, 2026

Choose a reason for hiding this comment

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

The MCP shouldn't be concerned with reading from dw.json or ~/.mobify ever. It is only concerned with flags and env vars (which are tied to the flags anyway in oclif so just flags). Those are passed into the config resolution logic if we have it and you get origin: this.resolvedConfig.values.mrtOrigin. But this should generally be concerned with the SDK operations not the MCP.

We do have an annoying issue were it's called mrtOrigin and cloudOrigin interchangably. But since this isn't a customer need it's not a huge deal

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also the MRT operations in the SDK are inconsistent in signature patterns (some take a client some create it internally). We identified this in another PR. I'll probably do a refactoring pass on those at some point.

...oclifRules,
},
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for adding it.

yhsieh1
yhsieh1 previously approved these changes Feb 6, 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.

happy to look deeper in main. approving to unblock other things

@patricksullivansf patricksullivansf merged commit ddf749d into main Feb 6, 2026
3 checks passed
@patricksullivansf patricksullivansf deleted the feature/mcpMrtPushImplementation branch February 6, 2026 23:24
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