Salesforce DX MCP Server
Salesforce DX MCP servers enable AI models to interact with Salesforce instances, providing capabilities for managing orgs, metadata, data, and users.
Overview
The Salesforce DX MCP Server is a specialized Model Context Protocol (MCP) implementation designed to facilitate seamless interaction between large language models (LLMs) and Salesforce orgs. This MCP server provides a robust set of tools and capabilities that enable LLMs to read, manage, and operate Salesforce resources securely.
Official Server:
Developed and maintained by Salesforce CLI
Key Features
Salesforce Org Management
Interact with Salesforce orgs, including authorization and environment customization.
Metadata and Data Operations
Manage Salesforce metadata and perform data operations securely.
User and Apex Test Management
Manage Salesforce users and execute Apex tests.
Extensible Toolsets
Utilize various toolsets for orgs, metadata, data, and users, with support for non-GA tools.
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
orgs | Manage Salesforce orgs | Management |
metadata | Manage Salesforce metadata | Management |
data | Perform data operations | Data |
users | Manage Salesforce users | Management |
run_apex_tests | Execute Apex tests | Testing |
Detailed Usage
orgsβΆ
Tools for managing Salesforce organizations.
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "orgs",
arguments: {
// specific orgs arguments
}
});
metadataβΆ
Tools for managing Salesforce metadata.
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "metadata",
arguments: {
// specific metadata arguments
}
});
dataβΆ
Tools for performing data operations in Salesforce.
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "data",
arguments: {
// specific data arguments
}
});
usersβΆ
Tools for managing Salesforce users.
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "users",
arguments: {
// specific users arguments
}
});
run_apex_testsβΆ
Tool for executing Apex tests in Salesforce.
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "run_apex_tests",
arguments: {
// specific run_apex_tests arguments
}
});
Installation
{
"mcpServers": {
"Salesforce DX": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs", "DEFAULT_TARGET_ORG",
"--toolsets", "orgs,metadata,data,users",
"--tools", "run_apex_tests",
"--allow-non-ga-tools"
]
}
}
}
Configuration:
Replace DEFAULT_TARGET_ORG with your authorized Salesforce org. You can specify toolsets and tools as needed.
Common Use Cases
1. Querying Salesforce Data
Retrieve records from Salesforce using natural language queries.
// Example: Get all Accounts with their related Contacts
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "data",
arguments: {
query: "SELECT Id, Name, (SELECT Id, FirstName, LastName FROM Contacts) FROM Account"
}
});
2. Managing Salesforce Metadata
Create or modify custom objects and fields.
// Example: Create a new custom object
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "metadata",
arguments: {
action: "createCustomObject",
objectName: "MyCustomObject__c",
label: "My Custom Object"
}
});
3. Executing Apex Tests
Run specific Apex tests within your Salesforce org.
// Example: Run all tests in a specific Apex class
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "run_apex_tests",
arguments: {
classNames: ["MyApexTestClass"]
}
});
4. User Management
Create or update Salesforce users.
// Example: Create a new Salesforce user
use_mcp_tool({
server_name: "Salesforce DX",
tool_name: "users",
arguments: {
action: "createUser",
username: "[email protected]",
email: "[email protected]",
lastName: "User",
profileId: "Standard User Profile ID"
}
});
Sources
Related Articles & Guides
ClickUp MCP Server
ClickUp MCP server enables AI models to interact with ClickUp workspaces, providing tools for task management, workspace organization, and docs retrieval.
Confluence MCP Server
Confluence MCP servers provide interfaces for LLMs to interact with Atlassian Confluence workspaces. These servers enable AI models to manage documentation, collaborate on content, and automate knowledge management tasks.
ServiceNow MCP Server
ServiceNow MCP Server enables AI models to interact with ServiceNow instances, providing capabilities for IT service management, incident tracking, workflow automation, and knowledge base management through natural language.