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
Txtai MCP Server
Txtai MCP servers enable AI models to interact with txtai, an AI-powered search engine that builds vector indexes (also known as embeddings) to perform similarity searches.
Blockchain and Web3 Development
Integrate AI with blockchain networks and Web3 tooling to manage wallets, execute transactions, call smart contracts, and build decentralized applications across multiple chains.
ArangoDB MCP Server
ArangoDB MCP servers enable AI models to interact with ArangoDB databases, providing capabilities for document operations, graph queries, AQL queries, and multi-model data management.