by advancedcommunities
Enables AI assistants to execute Apex code, run SOQL/SOSL queries, manage metadata, and automate development workflows within Salesforce orgs via the Salesforce CLI.
A Model Context Protocol (MCP) server that bridges AI assistants with Salesforce organizations. It exposes 36 tools that let the model perform actions such as Apex execution, data queries, metadata generation, code analysis, package management, and user/permission handling directly against authenticated Salesforce orgs.
npx @advanced-communities/salesforce-mcp-server
(alternatively use the DXT desktop extension or build from source).mcpServers configuration pointing to the salesforce-mcp-server ID.READ_ONLY=true or ALLOWED_ORGS=dev,qa.READ_ONLY, ALLOWED_ORGS).Q: Do I need a Salesforce org logged in before using the server?
A: Yes. At least one org must be authenticated with the sf CLI (sf org login web).
Q: Can I restrict which orgs the AI can access?
A: Set ALLOWED_ORGS environment variable (comma‑separated aliases) or use READ_ONLY=true to prevent data‑changing actions.
Q: Is there a way to run the server without installing globally?
A: Use the DXT desktop extension for one‑click installation, or clone the repo and run npm install && npm run build.
Q: Which AI clients are supported? A: Any client that implements the MCP protocol – Claude Desktop/Code, Codex CLI, VS Code Copilot, Cursor, etc.
Q: How are files exported from query tools?
A: Specify the desired format (CSV or JSON) in the prompt; the server writes the file to the working directory and returns the path.
Salesforce MCP Server is a Model Context Protocol (MCP) server that enables AI assistants to interact with Salesforce organizations. It provides a set of tools that allow AI models to execute Apex code, query data, describe objects, and manage Salesforce org connections through the Salesforce CLI.
NPM Package: @advanced-communities/salesforce-mcp-server
sf) installed and configuredThe easiest way to install Salesforce MCP Server is directly from NPM using npx:
npx @advanced-communities/salesforce-mcp-server
This command will:
Benefits of NPM Installation:
npm updateFor a fully managed installation experience:
salesforce-mcp-server.dxt file from the releases page.dxt file to installFor development or customization:
git clone https://github.com/advancedcommunities/salesforce-mcp-server.gitcd salesforce-mcp-servernpm install && npm run buildbuild/index.jsTo be able to run the MCP Server – you need a client. The client can be any AI app which supports the MCP protocol, such as:
Install Claude Desktop from Anthropic.
Open it up and authenticate to Claude.
Edit your config file at:
~/Library/Application\ Support/Claude/claude_desktop_config.jsonC:\\Users\\YOUR_USERNAME\\AppData\\Roaming\\Claude\\claude_desktop_config.jsonIf you can't find the file. Open Claude Desktop, open the Settings menu, go to the Developer section and click Edit Config inside the servers section. Open and edit this file using the instructions below.
Add the following to your config file under the "mcpServers" key:
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"]
}
}
}
With environment variables (optional):
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"],
"env": {
"READ_ONLY": "true",
"ALLOWED_ORGS": "dev,qa,staging"
}
}
}
}
Restart Claude Desktop (quit & re-open the app). Now you are able to use the MCP in the Claude Desktop.
Install Claude Code.
Open it up and authenticate to Claude by runnung the claude command in your terminal.
Execute one of the following commands in your terminal:
Basic installation (local scope - default):
claude mcp add salesforce-mcp-server npx @advanced-communities/salesforce-mcp-server
User scope installation (recommended for global access):
claude mcp add --scope user salesforce-mcp-server npx @advanced-communities/salesforce-mcp-server
With environment variables:
# Read-only mode (local scope)
claude mcp add salesforce-mcp-server npx @advanced-communities/salesforce-mcp-server -e READ_ONLY=true
# Read-only mode (user scope)
claude mcp add --scope user salesforce-mcp-server npx @advanced-communities/salesforce-mcp-server -e READ_ONLY=true
# Restrict to specific orgs (user scope)
claude mcp add --scope user salesforce-mcp-server npx @advanced-communities/salesforce-mcp-server -e ALLOWED_ORGS=dev,qa,staging
# Both restrictions (user scope)
claude mcp add --scope user salesforce-mcp-server npx @advanced-communities/salesforce-mcp-server -e READ_ONLY=true -e ALLOWED_ORGS=production
Note: By default, Claude Code installs MCP servers in local scope (current directory). Use
--scope userto install globally for all projects.
The Codex CLI can be configured to leverage MCP servers by defining an mcp_servers section in ~/.codex/config.toml.
It is intended to mirror how tools such as Claude and Cursor define mcpServers in their respective JSON config files,
though the Codex format is slightly different since it uses TOML rather than JSON, e.g.:
[mcp_servers.salesforce-mcp-server]
command = "npx"
args = ["@advanced-communities/salesforce-mcp-server"]
# Optional: Add environment variables
[mcp_servers.salesforce-mcp-server.env]
READ_ONLY = "true"
ALLOWED_ORGS = "dev,qa,staging"
Command + Shift + P or Ctrl + Shift + P.MCP: Add Server option.Command(stdio) option.npx @advanced-communities/salesforce-mcp-server into the command input.salesforce-mcp-server.Global or Workspace installation option.Preferences: Open Settings (JSON))"mcp.servers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"],
"env": {
"READ_ONLY": "true",
"ALLOWED_ORGS": "dev,qa"
}
}
}
Install Cursor
Open it up and create your account and connect to a model provider
Open Cursor -> Settings -> Cursor Settings -> Mcp
Add new global MCP Server
This will drop you into an editor of the JSON config. Fill in a value for the key salesforce-mcp-server:
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"]
}
}
}
With environment variables (optional):
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"],
"env": {
"READ_ONLY": "true",
"ALLOWED_ORGS": "production,staging"
}
}
}
}
If there are any existing keys under mcpServer, don't delete them. Add salesforce-mcp-server to the end.
Save the file. Go back to the Cursor Settings tab. You should see salesforce-mcp-server listed and the dot should go green.
Open Composer view and toggle from normal to agent (small text on bottom of input)
You can now use tools
The server supports the following environment variables for access control:
READ_ONLY=true - Prevents execution of Apex code (anonymous execution and tests)ALLOWED_ORGS=ALL - Allow access to all orgs (default)ALLOWED_ORGS=org1,org2,org3 - Restrict access to specific org aliasesWhen ALLOWED_ORGS is set, the list_connected_salesforce_orgs tool will only show orgs that match the allowed list.
Read-only access to all orgs:
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"],
"env": {
"READ_ONLY": "true"
}
}
}
}
Full access to specific orgs only:
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"],
"env": {
"ALLOWED_ORGS": "dev,qa,staging"
}
}
}
}
Read-only access to specific orgs:
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": ["@advanced-communities/salesforce-mcp-server"],
"env": {
"READ_ONLY": "true",
"ALLOWED_ORGS": "production,prod-backup"
}
}
}
}
You can check the current permission settings using the get_server_permissions tool.
Once the SF MCP Server is configured in your AI client, you can interact with Salesforce using natural language. The AI assistant will have access to 36 powerful tools:
View all Salesforce orgs currently authenticated with the Salesforce CLI.
Example prompts:
Retrieve all standard and custom objects available in a specific Salesforce org.
Example prompts:
Get detailed metadata about a specific Salesforce object, including fields, relationships, and properties.
Example prompts:
Run anonymous Apex code directly in a Salesforce org and see the debug output.
Example prompts:
Execute SOQL queries and retrieve results in JSON format.
Example prompts:
Execute SOQL queries and save results to CSV or JSON files.
Example prompts:
Execute Apex test classes with various options including test level and code coverage.
Example prompts:
Retrieve results from a previous asynchronous Apex test run.
Example prompts:
Get code coverage information for a Salesforce org.
Example prompts:
Generate metadata source files for a new Apex class.
Example prompts:
Generate metadata source files for a new Apex trigger.
Example prompts:
Fetch and list Apex debug logs from the org.
Example prompts:
Fetch specific Apex debug logs or recent logs from the org.
Example prompts:
Authenticate and login to a Salesforce org via web browser.
Example prompts:
Check current server permission settings.
Example prompts:
Analyze your code with configurable rules to ensure good coding practices.
Example prompts:
List available rules for code analysis.
Example prompts:
Scan a codebase with various security and quality rules using multiple engines.
Example prompts:
Run Salesforce Graph Engine for data flow analysis to identify complex security issues.
Example prompts:
Assign permission sets to one or more org users.
Example prompts:
Assign permission set licenses to org users.
Example prompts:
Display information about a Salesforce user including profile, org ID, and access details.
Example prompts:
List metadata components and properties of a specified type.
Example prompts:
Display details about all metadata types enabled for your org.
Example prompts:
Log out of a Salesforce org, removing stored authentication.
Example prompts:
Open a Salesforce org in your browser.
Example prompts:
Open a specific Salesforce record in the browser.
Example prompts:
Create a new record in a Salesforce org using the REST API.
Example prompts:
Update an existing record in a Salesforce org using the REST API.
Example prompts:
Delete a record from a Salesforce org using the REST API.
Example prompts:
Install or upgrade a package version in a Salesforce org.
Example prompts:
Uninstall a second-generation package from a Salesforce org.
Example prompts:
Generate metadata source files for a new custom tab on a custom object.
Example prompts:
Execute SOSL text-based searches across multiple objects. This is the primary tool for finding records that mention or contain specific text across your Salesforce org.
Example prompts:
Generate Lightning Web Components (LWC) or Aura components with configurable templates and output directories.
Example prompts:
Deploy metadata components to a Salesforce org with various configuration options including test execution.
Example prompts:
User: "I need to analyze our customer data. First, show me what custom objects we have in the production org."
AI: [Lists all custom objects]
User: "Great! Now query all Customer__c records created this year and export them to CSV."
AI: [Executes query and creates CSV file]
User: "I'm having issues with a trigger. Can you execute this Apex to test it:
List<Account> accs = [SELECT Id, Name FROM Account LIMIT 5];
for(Account a : accs) {
System.debug('Account: ' + a.Name);
}"
AI: [Executes the code and shows debug logs]
User: "I need to document our data model. Can you describe the Order__c object including all its fields and relationships?"
AI: [Provides detailed object metadata]
Specify the Target Org: Always mention which org you want to work with (e.g., "in my dev org", "using production")
Be Specific with Queries: Provide field names and conditions for SOQL queries
Object Names: You can use either user-friendly names or API names - the AI assistant will use the describe tools to find the correct API names
Apex Code Formatting: When providing Apex code, you can use code blocks or inline code
File Exports: Specify the format (CSV or JSON) when exporting query results
"No orgs found": Make sure you have authenticated orgs using sf org login
"Object not found": Verify the object exists and you're using the correct API name
"Query error": Check your SOQL syntax and field names
"Apex execution failed": Review the debug logs for specific error messages
If you want to build the Desktop Extension file yourself:
salesforce-mcp-server directorynpm installnpm run build:dxt.dxt file will be created in the dist/ directoryFor more details about Desktop Extensions, see DXT.md
Please log in to share your review and rating for this MCP.
{
"mcpServers": {
"salesforce-mcp-server": {
"command": "npx",
"args": [
"@advanced-communities/salesforce-mcp-server"
]
}
}
}claude mcp add salesforce-mcp-server npx @advanced-communities/salesforce-mcp-serverExplore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.