sf-mcp
MCP server for Salesforce that exposes CLI, REST, Connect, Data 360, Bulk 2.0, and Einstein Models APIs as tools for any MCP-compatible client to manage orgs, data, and metadata.
README
sf-mcp
Model Context Protocol server for Salesforce, built on salesforce-py and FastMCP.
Exposes the Salesforce CLI, REST, Connect, Data 360, Models, and Bulk 2.0 APIs as MCP tools that any MCP-compatible client — Claude Code, Claude Desktop, Codex, Cursor — can call.
Quick start
1. Authenticate at least one Salesforce org
sf-mcp reuses your local sf CLI session. Before running the server, log in to an org:
sf org login web --alias my-org
2. Install
uv tool install sf-mcp
# or:
pipx install sf-mcp
# or, in a project venv:
uv add sf-mcp
3. Add the server to your MCP client
Claude Code (CLI)
claude mcp add sf-mcp -- uvx sf-mcp
By default, every tool call takes a target_org argument naming the alias to use, so the MCP works against whichever org you ask for at call time — no global pin required. Optionally, pin a default for this client:
claude mcp add sf-mcp --env SF_MCP_ALIAS=my-org -- uvx sf-mcp
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"sf-mcp": {
"command": "uvx",
"args": ["sf-mcp"]
}
}
}
A copy of this config lives at examples/claude_desktop_config.json. To pin a default org alias for this client, add "env": { "SF_MCP_ALIAS": "my-org" }.
Cursor
Add to ~/.cursor/mcp.json (or your workspace's .cursor/mcp.json):
{
"mcpServers": {
"sf-mcp": {
"command": "uvx",
"args": ["sf-mcp"]
}
}
}
A copy lives at examples/cursor_config.json. To pin a default org alias for this client, add "env": { "SF_MCP_ALIAS": "my-org" }.
Codex CLI
Add to ~/.codex/config.toml:
[mcp_servers.sf-mcp]
command = "uvx"
args = ["sf-mcp"]
To pin a default org alias for this client, add [mcp_servers.sf-mcp.env]\nSF_MCP_ALIAS = "my-org".
Tools
Every tool takes an optional target_org argument naming the alias to operate against. The expected default usage is to ask for an org per call — "list every account in qlabs", "deploy this to dev_99christian" — and let the MCP route to the matching sf CLI session.
If you'd rather not pass target_org every time, sf-mcp falls back through this chain when it's omitted:
SF_MCP_ALIASenv var (set on the MCP client process)SF_TARGET_ORGenv var (sfCLI's own standard)target-orgfrom the project-local.sf/config.jsonor the global~/.sf/config.json— i.e. whateversf config get target-orgwould return
sf CLI (sf_*)
| Tool | Purpose |
|---|---|
sf_org_list |
List every authenticated org |
sf_org_display |
Show creds + metadata for the bound org |
sf_apex_run_anonymous |
Execute anonymous Apex |
sf_data_query |
SOQL via the CLI |
sf_apex_run_tests |
Run Apex tests |
sf_project_deploy |
Deploy a directory of metadata |
sf_project_retrieve |
Retrieve metadata into a local directory |
REST API (soql_*, sosl_*, sobject_*, tooling_*, limits_*)
| Tool | Purpose |
|---|---|
soql_query |
Single-page SOQL via REST |
soql_query_all_pages |
Paginated SOQL — every record |
sosl_search |
Full-text SOSL search |
sobject_describe |
Field/relationship describe for one sObject |
sobject_list |
Describe-global — every sObject in the org |
sobject_get |
Get a record by ID |
sobject_create |
Create a record |
sobject_update |
Patch a record |
sobject_delete |
Delete a record |
sobject_upsert |
Upsert by external ID |
tooling_query |
SOQL against the Tooling API |
limits_get |
API/storage/governor limits |
Connect REST (connect_*)
Generic passthroughs against /services/data/vXX.X/connect/<path>:
| Tool | Purpose |
|---|---|
connect_get / connect_post / connect_patch / connect_delete |
HTTP verb against any Connect subpath |
Data 360 / CDP (data360_*)
| Tool | Purpose |
|---|---|
data360_query_v2 |
Run a V2 (SAQL-style) query |
data360_sql_run |
Submit a SQL query, poll, and return rows |
data360_sql_rows |
Fetch additional row pages |
Bulk API 2.0 (bulk_*)
| Tool | Purpose |
|---|---|
bulk_query |
End-to-end Bulk SOQL → CSV |
bulk_upsert |
End-to-end CSV upsert with polling |
Einstein Models (models_*)
Requires SF_MODELS_CLIENT_ID and SF_MODELS_CLIENT_SECRET in the environment (Connected App with the sfap_api einstein_gpt_api api scopes).
| Tool | Purpose |
|---|---|
models_chat |
Chat completion |
models_embed |
Text embeddings |
Configuration
| Env var | Purpose |
|---|---|
SF_MCP_ALIAS |
Optional. Highest-priority default org alias; overrides SF_TARGET_ORG and the sf CLI's own configured target-org. |
SF_TARGET_ORG |
Optional. Standard sf CLI env var; honoured when SF_MCP_ALIAS is unset. |
SF_MODELS_CLIENT_ID / SF_MODELS_CLIENT_SECRET |
Required for Einstein Models tools |
SF_MODELS_INSTANCE_URL |
Override the My Domain used for Models OAuth (defaults to the alias's instance URL) |
When neither env var is set and no target_org is passed, sf-mcp defers to sf config get target-org (project-local .sf/config.json first, then global ~/.sf/config.json).
Local development
git clone https://github.com/geekstewie/sf-mcp
cd sf-mcp
uv sync --extra dev
# Run the server in stdio mode
uv run python -m sf_mcp
# Run tests
uv run pytest
# Lint + format
uv run ruff check src/
uv run ruff format src/
License
This project is a personal open-source project, released under the Apache License, Version 2.0.
You are free to use, modify, and distribute this software in accordance with the terms of the license. It is provided as-is, without warranty of any kind — express or implied — including but not limited to warranties of merchantability or fitness for a particular purpose. Use it at your own risk.
This project is not an official Salesforce product and is not affiliated with or endorsed by Salesforce, Inc. in any way.
See the LICENSE file for the full license text.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.