If you’re a Salesforce developer exploring AI workflows, you’ve probably tried tools like GitHub Copilot, Claude, or Cursor. These AI agents are powerful, but they often lack context about your project. That’s where the Salesforce DX MCP Server comes in.
In this guide, I’ll show you how to install and use the Salesforce DX MCP Server inside Visual Studio Code (VS Code)so you can give AI agents direct access to your Salesforce orgs.
What is MCP?
The Model Context Protocol (MCP) is an open-source project from Anthropic. It standardizes how applications provide context to large language models (LLMs).
Instead of your AI assistant “guessing” what’s in your Salesforce project, MCP gives it structured tools to securely access real project data.
With MCP, AI agents can:
- Query your Salesforce orgs
- Deploy and retrieve metadata
- Run unit tests
- Assign permission sets
- And much more
This makes your AI assistant smarter, more accurate, and actually useful in your Salesforce workflow.
Installing MCP in VS Code
There are two easy ways to install MCP in Visual Studio Code:
- Visit the official MCP download page
- Or install it directly inside the editor via the Command Palette
MCP servers can run locally or remotely. In this tutorial, we’ll keep it simple and run the Salesforce DX MCP Server locally – source code available from github at https://github.com/salesforcecli/mcp
Salesforce DX MCP Server Overview
The Salesforce DX MCP Server is a specialized MCP implementation designed for Salesforce developers.
- It uses the same OAuth flow as the Salesforce CLI (SFDX), so setup is seamless if you already work with SFDX.
- It’s currently available in beta, with new tools rolling out frequently.
Current Toolset (Beta)
Here are the MCP commands you can try today:
- Core:
sf-get-username
- Orgs:
sf-list-all-orgs
- Data:
sf-query-org
- Users:
sf-assign-permission-set
- Metadata:
sf-deploy-metadata
,sf-retrieve-metadata
- Testing:
sf-testing-agents
,sf-test-apex
Step-by-Step Setup in VS Code
Here’s how to get started with the Salesforce DX MCP Server:
Code snippet from Salesforce official Github repo – check for more information https://github.com/salesforcecli/mcp
{
"servers": {
"Salesforce DX": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG", "--toolsets", "all"]
}
}
}
- Open VS Code
- Create a new Salesforce DX (SFDX) project
- Authenticate your org
- Then add the MCP Server
- Open the Command Palette (
CMD+Shift+P
on Mac orCTRL+Shift+P
on Windows) - Use the MCP setup wizard or create a
mcp.json
file inside your.vscode
folder - Paste the code above, save and hit Start on the context menu
- If you’re on GitHub Copilot Enterprise, confirm with your admin that MCP is enabled (some enterprise setups restrict it)
- Once running, open the AI chat and try commands like:
- “How many users are admins?”
- “How many orgs are authenticated?”
- “Retrieve all Apex classes from this org”
- “Run all unit tests”
That’s it — your AI assistant now has real Salesforce context.
Why Salesforce DX MCP Matters
The Salesforce DX MCP Server makes it possible to combine Salesforce development with AI-powered productivity. Instead of manually checking metadata, running queries, or handling org management, you can let AI agents perform these tasks securely with full project awareness.
This is still early days — the toolset is in beta — but it’s clear that MCP will play a huge role in the future of Salesforce AI development.
Conclusion
The Salesforce DX MCP Server is a game-changer for developers looking to bring AI into their Salesforce workflow. By running it in VS Code, you can give AI assistants direct, secure access to your org and metadata, making them far more useful than before.
For a full walkthrough, check out my video tutorial here:
If you have a specific use case for MCP that you’d like me to try, drop a comment — I’ll be covering more advanced setups soon.