
Andrew Hanna

Andrew Hanna

Short answer: setting up a Salesforce MCP server takes three decisions and about ten minutes of config. Pick the server (local Salesforce DX, a hosted Salesforce endpoint, or your DevOps platform's own), point your AI client at it with an explicit list of authorized orgs, then narrow the toolsets to the smallest set that does the job. The part that takes longer than ten minutes, and the part most guides skip, is deciding which actions the agent may run on its own and which stay behind a human.
The Model Context Protocol is an open standard for exposing tools to an AI client. An MCP server for Salesforce turns operations you would normally run from the CLI or a UI into tools an assistant can call: query an org, retrieve metadata, run Apex tests, open a pull request, plan a deployment. The client decides what to call, the server decides what exists and who is allowed to call it.
For DevOps that framing matters. The server is your policy boundary. Anything you expose, the model can eventually try.
@salesforce/mcp.
plan_deploy,
create_pull_request, resolve_metadata_conflict and
trigger_pipeline to Claude, Cursor, Windsurf, Codex, Cline, GitHub
Copilot and Agentforce.
Most teams end up running two: one for org work, one for release work. They answer different questions.
sf org login web for
each org. The MCP server can only reach orgs the CLI already knows about, which is
your first and cheapest control.
{"mcpServers":{"Salesforce
DX":{"command":"npx","args":["-y","@salesforce/mcp","--orgs","DEFAULT_TARGET_ORG","--toolsets","orgs,metadata,data"]}}}
--orgs flag is
required. It accepts DEFAULT_TARGET_ORG,
DEFAULT_TARGET_DEV_HUB, explicit usernames or aliases, and
ALLOW_ALL_ORGS. Salesforce's own documentation flags that last value as
one to use with caution. Take the hint.
--toolsets selects functional
groups rather than loading everything. There are more than fifteen, including orgs,
metadata, data, users, testing, devops and code-analysis. Enabling
all works and is discouraged, because every tool you load spends
context the model could be using to think.
--allow-non-ga-tools. Do not turn that flag on in a
repo anyone else clones.
Local servers inherit CLI credentials, which is convenient and means the agent's blast radius equals the developer's. Hosted servers use OAuth with PKCE through an External Client App, which is the right model when you want a separate identity with its own scopes.
The rule that survives both: the MCP identity should not be a shared admin. Give it its own user, its own permission set, and no more object access than the tools you enabled actually need. If your agent can call a data tool, assume one day it will.
This is the part worth arguing about in your team, not copying from a blog. A workable default:
The important design point is that approval must live in the server, not in the prompt. A model instructed to ask first will ask first almost always, and "almost always" is not a control. Serpent's MCP server runs preflight checks and requires human approval before a deployment executes, so the boundary is enforced by the platform rather than by good manners.
A typical loop: the developer asks the assistant to prepare a release. The agent reads the diff, calls the plan tool, and comes back with the components, the tests it will run and the risks it found. A human reads that plan and approves it. The agent triggers the pipeline, watches it, and reports the result. Every write is auditable, and the human spent two minutes instead of forty.
Start with one repo and one sandbox. Expand the toolsets only when an actual task fails for lack of one. More Salesforce DevOps guides cover the pipeline side of this in detail.
Do I need the Salesforce CLI to use MCP?
For the local Salesforce DX MCP server, yes, because it uses CLI credentials. Hosted MCP servers use OAuth instead and do not require a local CLI install.
Can an MCP server deploy to production?
Technically yes, which is exactly why it should not do so unattended. Keep production deploys behind an approval step enforced by the server, not by instructions in a prompt.
Which toolsets should I enable first?
Start with orgs, metadata and data. Add testing when you want the agent running Apex tests, and add devops tooling once the read-only loop is trusted.
Is MCP safe for regulated environments?
It can be, if the agent has its own identity, least-privilege permissions, an audit trail and a human gate on writes. Treat it like any other integration user, because that is what it is.
Commitment free!