- Home
- MCP servers
- Salesforce
Salesforce
- javascript
35
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"codefriar-sf-mcp": {
"command": "npx",
"args": [
"-y",
"codefriar/sf-mcp",
"/path/to/project1",
"/path/to/project2"
]
}
}
}You run a Salesforce CLI MCP Server to expose Salesforce CLI functionality as MCP tools and resources for AI agents. This enables you to view help topics, execute Salesforce CLI commands, and integrate Salesforce capabilities into your workflows with minimal setup.
How to use
Start by launching the MCP server from your project workspace. You can run it with default project roots or specify one or more root directories to provide project context for commands that require a sfdx project.
Then interact with the server using an MCP client. The server exposes Salesforce CLI commands as MCP tools such as sf_version, sf_help, and deployment-related commands. You can call a tool to execute the corresponding Salesforce CLI command and receive structured results.
How to install
Prerequisites: you need Node.js 18 or newer and npm installed. You also need Salesforce CLI (sf) installed and configured with your Salesforce org credentials.
Install locally by cloning the project, installing dependencies, and starting the server.
git clone <repository-url>
cd sfMcp
npm install
npm start
Additional notes and configuration
Project roots let you run commands against multiple Salesforce project directories. You can specify roots on startup or configure them via dedicated tools. When multiple roots exist, the first is treated as default unless you specify another root.
If you install new Salesforce CLI plugins, you may need to refresh the command cache and restart the MCP server to ensure all commands are discoverable.
You can also run the server via a convenient npm script or with npx for quick ad-hoc use in your environment.
Starting the server with roots or via npx
npm start
# Start with explicit roots
npm start /path/to/project1 /path/to/project2
# Or use the convenience script if available
npm run with-roots /path/to/project1 /path/to/project2
# Or run via npx
npx -y codefriar/sf-mcp /path/to/project1 /path/to/project2
Configuration for Claude Desktop and client usage
Configure the MCP server as a tool in Claude Desktop or your MCP client by pointing to the command runner and providing the roots. The server exposes commands as tools in the form sf_<topic>_<command>, with aliases where applicable.
Troubleshooting
If you encounter missing commands after initial startup, clear the cache and rediscover commands. Stop the MCP server, delete the cache file, and start again.
If you add new Salesforce CLI plugins, refresh the cache using the provided tool and restart the MCP server to ensure new commands are registered.
Notes on roots and command execution
Commands that require a Salesforce project context (deployments, retrievals, etc.) must run within a configured root. If you have multiple roots, you can specify the target root when invoking a tool or rely on the default root.
Available tools
sf_version
Get the Salesforce CLI version information.
sf_help
Get help information for Salesforce CLI topics and commands.
sf_cache_clear
Clear the command discovery cache for faster startup.
sf_cache_refresh
Refresh the command discovery cache to include newly installed plugins.
sf_org_list
List Salesforce orgs configured in the CLI.
sf_auth_list_orgs
List authenticated Salesforce orgs.
sf_org_display
Display details about a specific Salesforce org.
sf_org_open
Open a Salesforce org in the browser.
sf_apex_run
Execute anonymous Apex code in a target org.
sf_apex_test_run
Run Apex tests in a target org.
sf_data_query
Execute a SOQL query against a Salesforce org.
sf_schema_list_objects
List sObjects in the target org.
sf_schema_describe
Describe a Salesforce object in detail.
sf_project_deploy_start
Deploy source code to a Salesforce org.