cd /news/developer-tools/connecting-ai-agents-to-salesforce-w… · home topics developer-tools article
[ARTICLE · art-96488] src=blog.stackademic.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Connecting AI Agents to Salesforce with MCP: A Practical Guide

Salesforce released the Salesforce DX MCP Server in Developer Preview on May 30, 2025, to improve AI-based development tools by providing accurate Salesforce CLI commands. The server, which runs locally via NPX/NPM with the @salesforce/mcp package and is open source on GitHub, offers tools focused on developer outcomes rather than wrapping individual CLI commands. It addresses issues where AI agents like Cursor and Claude Desktop often used outdated or incorrect commands, and it integrates with Agentforce, which was released on September 12, 2024, and supports over 60 tools.

read5 min views1 publishedAug 14, 2026

Model Context Protocol (MCP) was first introduced by Anthropic in November 2024 as an open source standard for connecting LLMs/AI Agents to data systems, whether cloud-based or local — such as data sources (e.g., local files, databases), tools (e.g., search engines, calculators), and even workflows (e.g., specialized prompts) — without having to build custom integrations manually.

MCP works like USB-C, serving as a bridge for AI applications. Just as USB-C provides a standard way to connect electronic devices, MCP provides a standard way to connect AI applications with external systems.

In this article, we’ll explore how MCP works, particularly within the Salesforce environment.

Agentforce itself was released on September 12, 2024, marketed by Salesforce for use cases such as customer service, sales development, employee support, deep research, coaching, product recommendations, and appointment scheduling. Agentforce introduces Agentforce Vibes as an AI-powered cloud IDE that’s already supported by several AI models such as Claude, GPT, xGen, and others.

To access it, open Setup Menu from top of the right page:

Agentforce can be considered one of Salesforce’s powerful features, since it can be accessed directly through your org without needing a separate IDE — enabling Agentforce to offer 60+ tools specific to development, flexibility with any AI model, and automatic integration via MCP.

On the other hand, Agentforce Vibes definitely has a dependency on the Salesforce ecosystem, making it less flexible compared to common IDEs like VS Code or Claude Desktop, since many of its premium features are still tied to specific licenses and Salesforce Editions.

Actually, we can also manually add an MCP server to our own org through Setup -> Agentforce Registry -> Registered MCP Server.

By registering an MCP server in the registry, Agentforce can easily be connected to third-party tools or databases. So this is essentially about giving Agentforce “hands” so it can call other systems (SAP, internal databases, third-party APIs, etc.) without writing custom Apex or middleware.

What if we want to connect it to another IDE like VS Code without having to set it up in the Agentforce Registry?

Fortunately, several Salesforce contributors have successfully developed MCP Servers for use in other IDEs like Claude Desktop, VSCode, Cursor, and others.

In this article, we’ll focus on implementing the Salesforce MCP Server on OpenCode.

Salesforce recently released the Salesforce DX MCP Server in Developer Preview (May 30, 2025) to address problems commonly faced by AI-based development tools such as Cursor, Claude Desktop, and Agentforce for Developers. Until now, these AI agents have often used the wrong Salesforce CLI commands or flags because their training data was outdated, resulting in slow, trial-and-error, and inconsistent outcomes.

To address this, Salesforce developed the DX MCP Server, which runs locally (via NPX/NPM with the @salesforce/mcppackage) and is open source on GitHub. What sets it apart is that this server doesn't simply wrap individual CLI commands one by one — instead, it provides a set of tools directly focused on the outcomes developers actually need.

To get started, developers need to install the Salesforce CLI and the Salesforce Extension Pack in VS Code. The Salesforce DX MCP Server was first introduced by Vivek Chawla in his article on the Salesforce Developers Blog:

Level Up Your Developer Tools with Salesforce DX MCP

Details on how you can implement, clone this repository:

GitHub - salesforcecli/mcp: MCP Server for interacting with Salesforce instances

The repository above is the actual technical implementation of what was announced in the blog post, and since June 2025, its scope has grown far broader, expanding from just basic CLI tools into an ecosystem of MCP tools covering metadata, data, testing, DevOps Center, mobile development, as well as code analysis and LWC expert guidance.

And here’s an example of its implementation on OpenCode. You need to authorize the target org first: sf org login web

{  "$schema": "https://opencode.ai/config.json",  "mcp": {    "salesforce-dx": {      "type": "local",      "command": ["npx", "-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG"],      "enabled": true    }  }}

just running through npx -y @salesforce/mcp with flags like--orgs, --toolsets, --tools, and --allow-non-ga-tools.

With this MCP server installed, the AI agent can directly:

In addition, there’s also a third-party MCP as an alternative to the Salesforce DX MCP Server that connects Claude with Salesforce, enabling natural language interaction to query, modify, and manage Salesforce data and metadata. It’s simpler and lighter than the official Salesforce MCP server, making it suitable for those who want quick access to data, objects, and Apex code through Claude without having to manage as many toolsets as the official version.

The main focus of mcp-server-salesforce is more centered on direct data & development operations, such as:

Here’s an example configuration for it on OpenCode:

{  "$schema": "https://opencode.ai/config.json",  "mcp": {    "salesforce-crud": {      "type": "local",      "command": ["npx", "-y", "@tsmztech/mcp-server-salesforce"],      "environment": {        "SALESFORCE_CONNECTION_TYPE": "Salesforce_CLI",        "SALESFORCE_INSTANCE_URL": "https://your_instance_url.salesforce.com"      },      "enabled": true    }  }}

mcp-server-salesforce also supports 3 authentication methods — Username/Password, OAuth 2.0 Client Credentials Flow, and Salesforce CLI (using the token from an already logged-in sf) — with a more concise scope focused directly on data.

GitHub - tsmztech/mcp-server-salesforce: Salesforce MCP Server

In conclusion, all of this is part of Salesforce’s effort to make MCP the “USB-C for AI” across their entire platform — one purpose being to help developers/AI coding tools interact quickly and accurately with a Salesforce org when building applications, whether through Salesforce’s official channels or through external IDEs like OpenCode.

Connecting AI Agents to Salesforce with MCP: A Practical Guide was originally published in Stackademic on Medium, where people are continuing the conversation by highlighting and responding to this story.

── more in #developer-tools 4 stories · sorted by recency
── more on @salesforce 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/connecting-ai-agents…] indexed:0 read:5min 2026-08-14 ·