Salesforce MCP in Cursor: setup
Cursor reads MCP servers from .cursor/mcp.json in your project, or ~/.cursor/mcp.json for every project, under the mcpServers key. Build your org's metadata folder first, point the server at it with an absolute --vault path, then turn the server off and on in Cursor's MCP settings. Cursor does not reload the file by itself.
Before you start
You need:
- Cursor, with Agent mode available in chat.
- Node.js 20 or later. Check with
node --version. - The Salesforce CLI, logged in to your org. Check with
sf org list. If needed, runsf org login web --alias my-org. - A Salesforce DX project for that org, open in Cursor.
Set it up
-
Build the local copy of your org’s metadata. From your project folder, run:
Terminalnpx -y sf-intelligence init --target-org my-org npx -y sf-intelligence refresh --target-org my-orgThis retrieves metadata with the Salesforce CLI and stores it in an
org-kbfolder in your project. It reads only. Nothing is written to the org. -
Create
.cursor/mcp.jsonin the project and paste:JSON{ "mcpServers": { "sf-intelligence": { "command": "npx", "args": ["-y", "sf-intelligence", "mcp", "--vault", "/full/path/to/your-project/org-kb"] } } }Replace the path with the full path to your
org-kbfolder. Keep--vault. Without it, the server looks fororg-kbin whatever folder it was started from, which may not be your project. If the file already lists other servers, add this entry inside the existingmcpServersblock.Cursor’s MCP documentation also lets you write
${workspaceFolder}/org-kbinargsinstead of a full path.${workspaceFolder}is the folder that contains.cursor/mcp.json. -
Reload the server. Cursor does not pick up changes to
.cursor/mcp.jsonby itself. Turn the server off and on in Cursor’s MCP settings (in recent versions, under Customize in the sidebar; in older versions, Settings → MCP), or restart Cursor. -
Ask a question. Open chat in Agent mode and ask, for example: “What happens when I save an Opportunity?” The answer should name the triggers, flows and rules it found. Cursor asks for your approval before it runs a tool, unless you change that setting.
If you only see setup_status
That is setup mode, not a failure. The server started but did not find your metadata. Ask: “What do you need from me?” The tool reports where it looked and which command to run. Usually step 1 was skipped, or --vault points to the wrong folder. Reload the server after fixing it.
Every project, not just this one
To make the server available in all your projects, put the same block in ~/.cursor/mcp.json in your home folder. Use a full --vault path there. One server reads one org’s metadata folder, so for a second org, add a second entry with its own name and path.
Windows notes
| Problem | What to do |
|---|---|
| Path in the config | Double every backslash in JSON: "D:\\projects\\my-org\\org-kb". |
spawn npx ENOENT | Wrap the command: "command": "cmd", "args": ["/c", "npx", "-y", "sf-intelligence", "mcp", "--vault", "..."]. A console window may flash at start. |
You tried "command": "npx.cmd" | Do not. Node refuses to start a .cmd file directly and returns EINVAL. Use npx or the cmd /c form. |
| Refresh fails with a lock error | Windows will not replace a file another process holds open. Turn the server off in Cursor, run the refresh, then turn it on again. |
| Cursor cannot find Node | Apps started outside a terminal get the system PATH, not your shell’s. Install globally (npm install -g sf-intelligence) and point command at the full path to node, with the full path to sfi.js in args. This applies on macOS too. |
Still stuck? Run npx -y sf-intelligence doctor in your project. It checks Node, the Salesforce CLI, the metadata folder and org login, and prints a fix for each problem.
Try it on the demo org
No Salesforce org or CLI login needed. Add this to .cursor/mcp.json in any folder, then reload the server:
{
"mcpServers": {
"sf-intelligence-demo": {
"command": "npx",
"args": ["-y", "sf-intelligence", "demo"]
}
}
}
The first start downloads the package and builds the demo, so it takes a little longer. Then ask: “Can I delete the Amount field on Invoice?”
Using VS Code instead? It reads a different key. See Salesforce MCP in VS Code + Copilot.
Questions
Why don't the sf-intelligence tools show up in Cursor?
Usually Cursor has not reloaded the file. It does not pick up changes to .cursor/mcp.json by itself, so turn the server off and on in Cursor's MCP settings, or restart Cursor. Also check that the file uses the mcpServers key.
Why do I only see one tool, setup_status?
That is setup mode. The server started but did not find your org's metadata folder. Ask Cursor "What do you need from me?" and the tool tells you where it looked and which command to run.
Can I use the same config in VS Code?
No. VS Code reads a different file, .vscode/mcp.json, and a different top-level key, servers. Pasting a Cursor block into VS Code loads nothing and shows no error.