Salesforce MCP Server
Provides tools for interacting with the Salesforce REST API, enabling AI agents to discover objects and fields, run SOQL queries and aggregate queries, perform SOSL searches, and insert, update, upsert, or delete records in a Salesforce org.
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., "@Salesforce MCP Serverlist all open opportunities over $50k this quarter"
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.
Salesforce MCP Server
An MCP server for the Salesforce REST API. It lets an AI agent discover the objects and fields of a Salesforce org, run SOQL queries (including aggregates) and SOSL searches and, on explicit request, insert, update, upsert or delete records.
Transport: MCP Streamable HTTP at
POST /mcp, health probe atGET /healthStateless and multi-tenant: credentials arrive on every request as HTTP headers and are never stored; the access token is obtained per request and discarded with it
Python 3.12, uv, FastMCP, httpx (REST API v62.0)
License: Apache-2.0, Copyright 2026 MSPbots.ai
Authentication headers
X-Salesforce-Instance-Url is always required. Then send either the connected app's
consumer key and secret (client credentials flow) or a username and password (username /
password flow).
Header | Required | Type | Default | Allowed values | Description | Example |
| Yes | string | none | https URL | The org's My Domain URL (any path is ignored) |
|
| No | string | chosen from the fields sent |
| Force one flow |
|
| One of | string | none | - | Connected app consumer key |
|
| One of | string | none | - | Connected app consumer secret |
|
| One of | string | none | - | Salesforce username, for the username / password flow |
|
| One of | string | none | - | That user's password |
|
| No | string | none | - | Security token appended to the password (needed when logging in from outside the org's trusted IP ranges) |
|
How the flow is chosen when X-Salesforce-Auth-Mode is blank: username + password present ->
username / password flow; otherwise -> client credentials flow.
Where to get them:
Client credentials (recommended): in Setup create an External Client App or Connected App with OAuth enabled, the
apiscope and Enable Client Credentials Flow, and set a Run As user whose profile / permission sets cover the objects the agent may read and change. Copy the consumer key and secret. Client credentials requires the My Domain URL as the instance URL.Username / password: use a dedicated integration user. Its security token comes from Settings -> Reset My Security Token. If a consumer key / secret is also sent, the OAuth password grant is used; otherwise the server signs in with the SOAP API
login()call.
How credentials are sent to Salesforce: the server obtains an access token from
{instance}/services/oauth2/token (or a session from /services/Soap/u/62.0), then calls
{instance}/services/data/v62.0/... with Authorization: Bearer <token>. An expired session
(401) triggers one fresh login. Values that look like unresolved templates (${...}) are
treated as missing.
A request to /mcp without the headers its flow needs gets HTTP 401 naming them; a non-https
instance URL or an unknown auth mode gets HTTP 400.
Related MCP server: MCP Salesforce Lite
Tools
All tools return a JSON string. Records come back without Salesforce's per-record
attributes block; the object type is kept as _type.
Tool | Purpose | Parameters (required in bold) |
| Find standard and custom objects by part of their name or label | pattern |
| An object's fields (API name, type, picklist values, references) and child relationships | objectName |
| Run a SOQL query; returns records, | soql, next_records_url |
| Run a SOQL aggregate query (GROUP BY, COUNT, SUM, ...) | soql |
| Insert, update, upsert or delete up to 200 records of one object (write) | operation ( |
| Cross-object text search with SOSL | sosl |
salesforce_dml_records runs each record independently (allOrNone: false) and reports
succeeded, failed and per-record results. delete needs confirm: true.
Errors come back as a JSON envelope instead of an exception:
{"error": {"code": "invalid_argument", "message": "Salesforce returned HTTP 400 for ...: MALFORMED_QUERY: unexpected token: FORM", "retryable": false}}code is one of not_configured, unauthorized, not_found, invalid_argument,
rate_limited, upstream_error. Reads are retried with backoff on 429, 5xx and network
errors; writes are never retried. Every call counts towards the org's daily API request limit.
Run locally
uv sync
uv run python -m salesforce_mcp # listens on 0.0.0.0:8080or with Docker:
docker build --platform linux/amd64 -t salesforce-mcp:dev .
docker run --rm -p 8080:8080 salesforce-mcp:devConfiguration (environment variables, all optional): MCP_HTTP_HOST (default 0.0.0.0),
MCP_HTTP_PORT (default 8080), LOG_LEVEL (default INFO). Credentials are never read
from the environment.
Testing example
# list tools
curl -s http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "X-Salesforce-Instance-Url: https://acme.my.salesforce.com" \
-H "X-Salesforce-Client-Id: your-consumer-key" \
-H "X-Salesforce-Client-Secret: your-consumer-secret" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
# open opportunities by stage
curl -s http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "X-Salesforce-Instance-Url: https://acme.my.salesforce.com" \
-H "X-Salesforce-Client-Id: your-consumer-key" \
-H "X-Salesforce-Client-Secret: your-consumer-secret" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"salesforce_aggregate_query","arguments":{"soql":"SELECT StageName, COUNT(Id) FROM Opportunity WHERE IsClosed = false GROUP BY StageName"}}}'Unit tests (no network access needed):
uv run pytestDelivery notes
Tool count (6). Tool names and required parameters are unchanged.
Auth mode chosen from the fields. Older versions used client credentials unless the mode header said
username_password, so a connection with only a username and password failed. A blank mode now picks the flow from the credentials supplied.Paging.
salesforce_query_recordsgained an optionalnext_records_urlto read the batches after the first one.DML. Uses sObject collections (up to 200 records, each succeeding or failing on its own).
deletenow needsconfirm: true; the description tells the agent to show the user the records first. Insert rejects records that carry anId.Input checks.
soqlmust be a SELECT,sosla FIND, object and field names valid API names, andnext_records_urla query cursor from this org.
License
This server cannot be deployed
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
- AlicenseBqualityDmaintenanceA server implementation that enables LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and API operations including retrieving, creating, updating, and deleting records.101MIT
- 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
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Salesforce through a secure interface for performing CRUD operations, executing SOQL queries, and managing schema discovery. It features a smart learning system that analyzes custom objects and fields to provide intelligent assistance tailored to specific Salesforce configurations.1446 npm17BSD 2-Clause "Simplified"
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Salesforce CRM data by executing SOQL queries and managing records. It provides tools for object metadata discovery and record operations, specifically optimized for Heroku deployment.-