Salesforce DX MCP
The MCP Server enables secure interaction between LLMs and Salesforce orgs, offering tools for org management, metadata handling, data queries, testing, and user administration. It supports customizable configurations, including toolsets and specific tools, to streamline Salesforce DX workflows efficiently.
How to Install and Use Salesforce DX MCP
Salesforce DX MCP is a special server that helps tools like VS Code or Claude Code connect to your Salesforce orgs. It lets large language models (LLMs) safely read and manage Salesforce data. Below is a simple guide on how to set it up and use it.
Step 1: Authorize Your Salesforce Orgs
Before you can use Salesforce DX MCP, you need to make sure your Salesforce orgs are authorized on your computer. This is important because the MCP server needs permission to access those orgs.
To do this, use the Salesforce CLI command or VS Code command:
sfdx auth:web:login
Or in VS Code, run the SFDX: Authorize an Org command from the command palette.
Make sure you authorize the orgs you want to use with the MCP server.
Step 2: Create or Update Your MCP Configuration File
Next, you need to tell your MCP client (like VS Code, Claude Code, or Cursor) how to run the Salesforce DX MCP server.
Create or update the .mcp.json (or similar config) file in your project folder. Here’s an example for VS Code:
{
"servers": {
"Salesforce DX": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"DEFAULT_TARGET_ORG",
"--toolsets",
"orgs,metadata,data,users",
"--tools",
"run_apex_test",
"--allow-non-ga-tools"
]
}
}
}
This setup tells the MCP server which orgs and features to enable.
--orgs DEFAULT_TARGET_ORGmeans use your default authorized org.--toolsets orgs,metadata,data,usersenables useful groups of tools.--tools run_apex_testenables an individual testing tool.--allow-non-ga-toolslets the server use experimental tools too.
Step 3: Choose Your MCP Client and Apply the Configuration
Depending on the tool you use, you might need to put the config file in a different place or use a slightly different format. Here are simple examples for popular clients:
- Claude Code: Add the config in
.mcp.json - Cursor: Edit your
mcp.jsonwith the same JSON format. - Cline: Use
cline_mcp_settings.jsonand paste the same snippet.
Each client uses the "command": "npx" with the "args" shown above.
Step 4: Run the MCP Server Through Your Client
Once the config is saved, start or reload your MCP client (e.g., open your project in VS Code or restart Claude Code). The client will automatically run the Salesforce DX MCP server using the settings you provided.
Now your language tools can securely connect to your Salesforce org and manage data or run tests.
Step 5: Optional Flags You Can Use
You can customize the MCP server startup further with some extra flags:
--no-telemetry: Turn off data collection.--debug: Show debug logs (helpful if you have trouble).--dynamic-tools: (Experimental) Load tools only when needed to save resources.
Use these flags in the args array like this:
"--no-telemetry",
"--debug"
Summary
To install and use Salesforce DX MCP:
- Authorize your Salesforce orgs on your computer.
- Create or update your MCP client config file with the right command and arguments.
- Use the config in your MCP client (VS Code, Claude Code, Cline, etc.).
- Start your MCP client to launch the MCP server.
- Customize with optional flags if needed.
That’s it! You now have Salesforce DX MCP running and ready to help you work with your Salesforce orgs through large language models and smart tools.