sf-mcp
Provides tools for interacting with Salesforce APIs, including executing SOQL/SOSL queries, managing sObject records, running anonymous Apex, deploying and retrieving metadata, performing bulk data operations, querying Data 360, and using Einstein AI models for chat and embeddings.
Click on "Install 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., "@sf-mcpshow all accounts in my-org"
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.
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-org2. Install
uv tool install sf-mcp
# or:
pipx install sf-mcp
# or, in a project venv:
uv add sf-mcp3. Add the server to your MCP client
Claude Code (CLI)
claude mcp add sf-mcp -- uvx sf-mcpBy 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-mcpClaude 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 |
| List every authenticated org |
| Show creds + metadata for the bound org |
| Execute anonymous Apex |
| SOQL via the CLI |
| Run Apex tests |
| Deploy a directory of metadata |
| Retrieve metadata into a local directory |
REST API (soql_*, sosl_*, sobject_*, tooling_*, limits_*)
Tool | Purpose |
| Single-page SOQL via REST |
| Paginated SOQL — every record |
| Full-text SOSL search |
| Field/relationship describe for one sObject |
| Describe-global — every sObject in the org |
| Get a record by ID |
| Create a record |
| Patch a record |
| Delete a record |
| Upsert by external ID |
| SOQL against the Tooling API |
| API/storage/governor limits |
Connect REST (connect_*)
Generic passthroughs against /services/data/vXX.X/connect/<path>:
Tool | Purpose |
| HTTP verb against any Connect subpath |
Data 360 / CDP (data360_*)
Tool | Purpose |
| Run a V2 (SAQL-style) query |
| Submit a SQL query, poll, and return rows |
| Fetch additional row pages |
Bulk API 2.0 (bulk_*)
Tool | Purpose |
| End-to-end Bulk SOQL → CSV |
| 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 |
| Chat completion |
| Text embeddings |
Configuration
Env var | Purpose |
| Optional. Highest-priority default org alias; overrides |
| Optional. Standard sf CLI env var; honoured when |
| Required for Einstein Models tools |
| 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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/GeekStewie/sf-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server