> mcp integration
Salesforce MCP Server: What It Does & How to Use It with Claude
What the Salesforce MCP server does — SOQL queries, record CRUD, metadata, Apex — and how to connect it to Claude Cowork, Claude Code, or Claude Desktop.
The Salesforce MCP server lets an AI assistant query and act on your Salesforce org, running SOQL, reading and writing records, and deploying metadata, without you leaving the chat. Salesforce maintains two official options: the open-source DX MCP Server for developer and CLI workflows, and Hosted MCP Servers (now generally available) that run inside your org and expose business data over OAuth.
What can the Salesforce MCP server do?
Capabilities depend on which server you run. The table below reflects what the official DX MCP Server documents today.
| Capability | What it enables |
|---|---|
| Org management | List and switch between authorized orgs; set a default target org |
| Data (SOQL) | Run SOQL queries against your org and list records (e.g. all accounts) |
| Metadata | Deploy and retrieve metadata between your DX project and the org |
| Users | Manage org users, for example assigning a permission set |
| Apex / testing | Run Apex tests and agent tests via dedicated tools |
| Code analysis | Static analysis through Salesforce Code Analyzer |
| LWC / Aura experts | Lightning Web Component guidance and Aura-to-LWC migration help |
| DevOps | Interact with DevOps Center resources |
The DX server ships more than a dozen toolsets and 60+ tools; you enable only the ones you need with the --toolsets flag to keep Claude’s context small.
Official vs community server
- Official DX MCP Server (
@salesforce/mcp) is the right default for developers. It runs locally over the Salesforce CLI, so it inherits your existing org auth and stays inside your DX project. Open source (Apache-2.0), on GitHub atsalesforcecli/mcp. - Official Hosted MCP Servers are a platform feature, generally available on Enterprise Edition and above, that runs in your org and exposes business assets: SObject CRUD with field-level security and sharing rules, Apex Invocable Actions,
@AuraEnabledmethods, Apex REST methods, Flows, Named Queries, Data 360 SQL, and Prompt Builder templates, all behind per-user OAuth 2.0 with PKCE. Best when non-developers or external AI clients need governed access to live org data. - Community server (
tsmztech/mcp-server-salesforce) is the most-referenced third-party option. Adds natural-language object/field creation, SOSL search, upsert, and Apex class/trigger editing. Useful for admin-style tasks, but vet it yourself since it isn’t Salesforce-maintained.
How do I connect Salesforce to Claude (Cowork / Code / Desktop)?
- Authenticate the CLI. Install the Salesforce CLI and run
sf org login webso the DX MCP Server can reuse your org session. - Add the server to your client config. In Claude Code, Claude Desktop, or Cowork’s MCP settings, register the server:
{ "mcpServers": { "Salesforce DX": { "command": "npx", "args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG", "--toolsets", "orgs,data"] } } } - Scope the toolsets. Start with
orgs,data(read-leaning) before addingmetadataorusers. Restart the client and confirm the tools appear, then ask Claude a read-only question like “how many open opportunities do we have this quarter?” to verify.
How we use it: Good for read-first work: pulling pipeline summaries, sanity-checking record counts, drafting SOQL against an unfamiliar schema, and scripting metadata retrieves before a deploy. Bad for bulk writes or anything touching production data unattended; the model will happily generate a DML it shouldn’t run. The one gotcha that bites people is that the
--orgs DEFAULT_TARGET_ORGvalue follows your CLI’s default org, so if you switched defaults in another terminal, Claude may quietly be talking to the wrong sandbox. Pin an explicit org alias instead.
Is the Salesforce MCP server secure?
Run least-privilege from day one. With the DX server, scope --orgs to a named sandbox (not all authorized orgs), enable only the --toolsets you need, and gate experimental tools behind --allow-non-ga-tools rather than leaving them on. For Hosted MCP Servers, access flows through per-user OAuth 2.0 with PKCE and respects field-level security and sharing rules, so the assistant can only see and do what the connected user can. Read-only first, write scopes later, and never point it at production until you’ve watched it behave in a sandbox.
Wiring Salesforce into your stack
The MCP server is the easy part; the hard part is deciding which org operations an assistant should be trusted to perform, and wiring that trust into the toolsets, permission sets, and review steps around it. That’s the work we do: connecting Salesforce, Linear, QuickBooks, and the rest of your stack into one assistant that acts safely.
Sources: salesforcecli/mcp (GitHub) · Hosted MCP Servers (Salesforce Developers) · Hosted MCP Servers Are Now GA (Salesforce Developers Blog) · tsmztech/mcp-server-salesforce