mcp-salesforce
This server exposes Salesforce data and APIs through MCP tools for querying, searching, and managing records.
Run SOQL queries and SOSL searches
Retrieve Salesforce object field metadata (names, labels, types, lookups)
Get, create, update, and delete records by object and ID
Execute Salesforce Tooling API requests (e.g., ApexClass)
Execute Apex REST endpoints
Make direct REST API calls to Salesforce with custom paths, methods, params, and data
Authenticates via OAuth 2.0 client credentials or legacy password flow, with automatic re-authentication and metadata caching
Integrates with Salesforce to provide tools for running SOQL queries, SOSL searches, retrieving object field metadata, performing CRUD operations on records, and executing Tooling API, Apex REST API, and direct REST API calls.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-salesforce query all accounts where name = 'Acme'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server for salesforce
Features
Connects to Salesforce using environment variables for credentials.
Authenticates with the OAuth 2.0 client credentials flow (recommended), or with the legacy username/password SOAP login.
Re-authenticates automatically when the Salesforce session expires.
Provides tools to:
Run SOQL queries.
Run SOSL searches.
Retrieve metadata about Salesforce object fields.
Get, create, update, and delete Salesforce records.
Execute Salesforce Tooling API requests.
Execute Apex REST API requests.
Make direct REST API calls to Salesforce.
Caches object field metadata for performance.
Handles errors and connection issues gracefully.
Related MCP server: Salesforce MCP Server
Salesforce setup (client credentials flow)
In Setup, create (or edit) a Connected App with OAuth enabled.
Selected OAuth scopes: at least
Manage user data via APIs (api).Check Enable Client Credentials Flow.
In Manage → Edit Policies, set the Run As user: every API call is made as this user, so its profile and permission sets define what the MCP server can see and do.
Collect the Consumer Key and Consumer Secret.
The token endpoint for this flow lives on your My Domain: login.salesforce.com and
test.salesforce.com do not serve the client_credentials grant.
Configuration
{
"mcpServers": {
"salesforce": {
"command": "uvx",
"args": [
"mcp-salesforce"
],
"env": {
"SALESFORCE_INSTANCE_URL": "acme",
"SALESFORCE_CLIENT_ID": "YOUR_CONNECTED_APP_CONSUMER_KEY",
"SALESFORCE_CLIENT_SECRET": "YOUR_CONNECTED_APP_CONSUMER_SECRET"
}
}
}
}Environment variables
Variable | Description |
| My Domain of the org. Accepts a prefix ( |
| Connected app consumer key (client credentials flow). |
| Connected app consumer secret (client credentials flow). |
| Username (legacy password flow). |
| Password (legacy password flow). |
| Security token (legacy password flow). |
| Optional, forces |
| Optional, e.g. |
| Optional, absolute path of the |
Without SALESFORCE_AUTH_FLOW, the flow is chosen from what is present: client
credentials when SALESFORCE_CLIENT_ID and SALESFORCE_CLIENT_SECRET are set, otherwise
the username/password login.
For sandboxes, use the sandbox My Domain, e.g.
SALESFORCE_INSTANCE_URL=acme--uat.sandbox.my.
Storing the credentials
Putting the consumer secret in the MCP client config means it sits in clear text in a
file that is often synced or shared. The alternative is a .env file readable only by
you:
./scripts/set-credentials.shIt prompts for the My Domain, the consumer key and the consumer secret; the two secrets
are read with a hidden prompt, so they never reach the screen, the shell history or the
process arguments. The file is written with mode 600.
The server reads MCP_SALESFORCE_ENV_FILE if set, otherwise it looks for a .env file
from the working directory upwards, then next to the package. Point the MCP client at an
explicit path when installing with uvx:
"env": { "MCP_SALESFORCE_ENV_FILE": "/Users/you/.config/mcp-salesforce/.env" }Environment variables always take precedence over the file.
Verify the credentials without printing them:
python scripts/check_auth.pyIt reports the flow used, a masked fingerprint of the key, and the connected app's run-as user as Salesforce sees it.
Legacy username/password flow
Still supported, but Salesforce is retiring the SOAP login() call and orgs increasingly
block it (MFA requirements, "API access with legacy protocols" disabled). Prefer the
client credentials flow.
"env": {
"SALESFORCE_INSTANCE_URL": "login",
"SALESFORCE_USERNAME": "YOUR_SALESFORCE_USERNAME",
"SALESFORCE_PASSWORD": "YOUR_SALESFORCE_PASSWORD",
"SALESFORCE_SECURITY_TOKEN": "YOUR_SALESFORCE_SECURITY_TOKEN"
}You can also use it with simonw/llm cli utils.
Available Tools
10 toolsapex_executeB
Executes an Apex REST request. Args: action: The Apex REST endpoint to call (e.g., '/MyApexClass') method: The HTTP method (default: 'GET') data: Data for POST/PATCH requests
Inputs: action (required), method, data.
create_recordC
Creates a new record. Args: object_name: The name of the Salesforce object (e.g., 'Account', 'Contact') data: The data for the new record
Inputs: object_name (required), data (required).
delete_recordA
Deletes a record. Args: object_name: The name of the Salesforce object (e.g., 'Account', 'Contact') record_id: The ID of the record to delete
Inputs: object_name (required), record_id (required).
get_recordA
Retrieves a specific record by ID. Args: object_name: The name of the Salesforce object (e.g., 'Account', 'Contact') record_id: The ID of the record to retrieve
Inputs: object_name (required), record_id (required).
get_sobject_fieldsA
Retrieves field Names, labels and types for a specific Salesforce object. if there is a lookup, the type is reference with the lookup table name and the fields name.
Args:
object_name: The name of the Salesforce object (e.g., 'Account', 'Contact')
Inputs: object_name (required).
restfulB
Makes a direct REST API call to Salesforce. Args: path: The path of the REST API endpoint (e.g., 'sobjects/Account/describe') method: The HTTP method (default: 'GET') params: Query parameters for the request data: Data for POST/PATCH requests
Inputs: path (required), method, params, data.
run_soql_queryA
Executes a SOQL query against Salesforce. Args: query: The SOQL query to execute
When using this tool, always use a column name in the query.
It is important when you aggregate or count.
In this case use the Id column. example: select count(Id) from Account
Inputs: query (required).
run_sosl_searchC
Executes a SOSL search against Salesforce. Args: search: The SOSL search to execute (e.g., 'FIND {John Smith} IN ALL FIELDS')
Inputs: search (required).
tooling_executeC
Executes a Tooling API request. Args: action: The Tooling API endpoint to call (e.g., 'sobjects/ApexClass') method: The HTTP method (default: 'GET') data: Data for POST/PATCH requests
Inputs: action (required), method, data.
update_recordA
Updates an existing record. Args: object_name: The name of the Salesforce object (e.g., 'Account', 'Contact') record_id: The ID of the record to update data: The updated data for the record
Inputs: object_name (required), record_id (required), data (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools are clearly distinct (CRUD, queries, Apex, Tooling), but apex_execute and tooling_execute could be confused despite different endpoints. Overall clear.
Most tools follow verb_noun snake_case, but 'restful' breaks the pattern, and there's inconsistency between 'get', 'run', 'execute' verbs.
10 tools is well-scoped for a Salesforce MCP, covering essential operations without being excessive.
Covers CRUD, queries, metadata, and APIs (Apex, Tooling, REST). Minor gaps like bulk operations or file uploads, but core is solid.
Maintenance
Related MCP Connectors
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Plan Salesforce deploys, open pull requests and trigger pipelines from your AI client.
Run SOQL queries against your Salesforce org to retrieve records and insights. Explore objects, fi…
Run SOQL queries to explore and retrieve Salesforce data. Inspect records, fields, and relationshi…
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables natural language interactions with Salesforce data and metadata, supporting queries, data manipulation, custom object/field management, Apex code operations, and debug logging across multiple authentication methods.15MIT
- AlicenseNot gradedqualityDmaintenanceEnables natural language interactions with Salesforce, allowing users to query and modify data, manage custom objects and fields, execute Apex code, and perform SOQL/SOSL searches across Salesforce organizations.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to securely interact with Salesforce CRM data through SOQL queries, CRUD operations, and metadata exploration. Supports connecting to Salesforce objects like Accounts, Contacts, and Opportunities via OAuth 2.0 authentication.82MIT
- AlicenseNot gradedqualityDmaintenanceIntegrates Claude with Salesforce to enable natural language querying, modification, and management of Salesforce records and metadata. It supports comprehensive operations including object/field management, SOSL searches, and Apex code execution.1MIT