How to Connect Salesforce to MCP for AI Agents
Integrate Salesforce CRM with AI agents via MCP. Query leads, manage opportunities, and automate workflows through the AnythingMCP dashboard.
Supercharge Salesforce with AI Agents
Salesforce holds your most valuable customer data — leads, opportunities, accounts, cases, and custom objects. By connecting Salesforce to MCP, AI agents can read CRM data, update records, and automate sales workflows through natural language.
Connection Methods
| Method | API | Best For | |---|---|---| | REST API | Salesforce REST | Standard CRUD operations | | SOQL | Query API | Complex data queries | | Bulk API | Bulk 2.0 | Large data operations |
Step-by-Step Guide
Step 1: Deploy AnythingMCP
git clone https://github.com/HelpCode-ai/anythingmcp.git
cd anythingmcp && docker compose up -d
Step 2: Create a REST Connector
Open the AnythingMCP dashboard at http://localhost:3000 and create a new REST connector. Set the base URL to your Salesforce org's REST API endpoint (e.g., https://yourorg.my.salesforce.com/services/data/v59.0).
Step 3: Configure Salesforce OAuth
In the connector settings, configure OAuth 2.0 authentication with your Salesforce Connected App credentials. AnythingMCP handles token refresh automatically.
Step 4: Import and Customize Tools
You can import your Salesforce API definition or manually configure endpoints in the dashboard. Customize tool names and descriptions for clarity.
Step 5: Test and Connect
Test each tool in the dashboard, then configure your MCP client:
{
"mcpServers": {
"salesforce": {
"url": "http://localhost:4000/mcp"
}
}
}
AI Agent Use Cases
- "Show me all open opportunities over $50k closing this month"
- "Create a lead for John Smith from Acme Corp, phone 555-0123"
- "Move the TechCorp deal to Negotiation stage"
- "How many support cases did we open last week?"
- "What's the pipeline value for Q2?"
Best Practices
- Use Connected App with OAuth 2.0 Client Credentials flow
- API call limits — Salesforce has daily API limits; cache frequently accessed data
- Field-level security — The connected user's profile determines visible fields
- Use SOQL for queries — More efficient than fetching all records
- Sandbox first — Test in a Salesforce sandbox before production
Next Steps
- HubSpot to MCP Guide — Alternative CRM integration
- REST to MCP Guide — General REST integration