mcp-server-salesforce
Provides secure access to Salesforce data and operations, including searching, querying, reading records, and optionally creating, updating, and deleting records across objects like Accounts, Contacts, Leads, Opportunities, Cases, and Activities.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-salesforceshow me my top 5 open opportunities"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Salesforce MCP Server
A Model Context Protocol (MCP) server that provides AI agents with secure access to Salesforce data and operations. Built for sales, marketing, and executive teams to interact with their Salesforce CRM through natural language.
Features
Core Capabilities
š Search & Query: Search records across multiple objects, execute SOQL queries, and perform global searches
š Read Operations: Retrieve specific records and navigate relationships
š Security-First: Starts in read-only mode by default for safe testing
š Secure Authentication: OAuth 2.0 integration with proper token management
ā” Error Handling: Comprehensive error handling with detailed feedback
Safety Features
Read-Only by Default: Server starts in safe read-only mode
Configurable Write Access: Enable write operations only when ready with
SALESFORCE_READ_ONLY_MODE=falseClear Operation Indicators: Write tools clearly marked in descriptions
Supported Salesforce Objects
Accounts: Company and organization records
Contacts: Individual contact information
Leads: Prospective customer records
Opportunities: Sales pipeline and deals
Cases: Customer service and support tickets
Activities: Tasks and events
Related MCP server: MCP Salesforce Server
Quick Start
š For complete setup instructions, see SETUP.md
This includes:
Salesforce Connected App configuration
Claude Desktop integration
Step-by-step screenshots and troubleshooting
Installation Options
Option 1: NPX from GitHub
npx github:tomnagengast/mcp-server-salesforceOption 2: Clone and Build
git clone https://github.com/tomnagengast/mcp-server-salesforce.git
cd mcp-server-salesforce
npm install
npm run buildConfiguration: See SETUP.md for complete setup instructions including Salesforce Connected App configuration.
Configuration
Environment Variables
Create a .env file with the following configuration:
# Salesforce Configuration
SALESFORCE_LOGIN_URL=https://login.salesforce.com
SALESFORCE_CLIENT_ID=your_connected_app_client_id
SALESFORCE_CLIENT_SECRET=your_connected_app_client_secret
SALESFORCE_USERNAME=your_salesforce_username
SALESFORCE_PASSWORD=your_salesforce_password
SALESFORCE_SECURITY_TOKEN=your_security_token
# For Sandbox (optional)
# SALESFORCE_LOGIN_URL=https://test.salesforce.com
# Server Configuration
PORT=3000
LOG_LEVEL=info
# Security - Server starts in READ-ONLY mode by default
SALESFORCE_READ_ONLY_MODE=trueš Security Note: The server starts in read-only mode by default. Set
SALESFORCE_READ_ONLY_MODE=falseonly when you're comfortable with write operations.
Claude Desktop Integration
Add this to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
For NPX installation:
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": ["github:tomnagengast/mcp-server-salesforce"],
"env": {
"SALESFORCE_CLIENT_ID": "your_client_id",
"SALESFORCE_CLIENT_SECRET": "your_client_secret",
"SALESFORCE_USERNAME": "your_username",
"SALESFORCE_PASSWORD": "your_password",
"SALESFORCE_SECURITY_TOKEN": "your_token",
"SALESFORCE_READ_ONLY_MODE": "true"
}
}
}
}For local installation:
{
"mcpServers": {
"salesforce": {
"command": "node",
"args": ["/path/to/your/mcp-server-salesforce/dist/index.js"],
"cwd": "/path/to/your/mcp-server-salesforce"
}
}
}See SETUP.md for complete integration instructions.
Usage
Running the Server
# Development mode with hot reload
npm run dev
# Production mode
npm run startAvailable Tools
Search Tools
search_records - Search across multiple Salesforce objects
{
"query": "Acme Corp",
"objects": ["Account", "Contact", "Lead"],
"limit": 20
}soql_query - Execute custom SOQL queries
{
"query": "SELECT Id, Name, Email FROM Contact WHERE Account.Name = 'Acme Corp'"
}global_search - Global search across all objects
{
"searchTerm": "john@example.com",
"limit": 20
}Read Operations (Always Available)
get_record - Retrieve a specific record
{
"objectType": "Account",
"recordId": "001XXXXXXXXXX",
"fields": ["Name", "Type", "Industry"]
}get_related_records - Get related records
{
"objectType": "Account",
"recordId": "001XXXXXXXXXX",
"relationship": "Contacts",
"limit": 20
}get_record_history - View field history
{
"objectType": "Opportunity",
"recordId": "006XXXXXXXXXX",
"limit": 20
}Write Operations (Requires SALESFORCE_READ_ONLY_MODE=false)
ā ļø These operations modify your Salesforce data. Only enable when you're comfortable with the server's behavior.
create_record - Create a new record
{
"objectType": "Contact",
"data": {
"FirstName": "John",
"LastName": "Doe",
"Email": "john@example.com"
}
}update_record - Update an existing record
{
"objectType": "Account",
"recordId": "001XXXXXXXXXX",
"data": {
"Phone": "+1-555-0123"
}
}delete_record - Delete a record
{
"objectType": "Lead",
"recordId": "00QXXXXXXXXXX"
}Enabling Write Operations
When you're ready to enable write operations:
Update environment:
# In your .env file SALESFORCE_READ_ONLY_MODE=falseOr in Claude Desktop config:
{ "mcpServers": { "salesforce": { "command": "node", "args": ["/path/to/your/mcp-server-salesforce/dist/index.js"], "env": { "SALESFORCE_READ_ONLY_MODE": "false", // ... other env vars } } } }Restart the server and Claude Desktop
Use Cases
Sales Team
Pipeline Management: "Show me all opportunities closing this quarter"
Account Research: "Find all contacts at Acme Corp with their recent activities"
Lead Follow-up: "Find all leads from yesterday's trade show" (read-only) or "Create tasks for all leads from yesterday's trade show" (write mode)
Marketing Team
Campaign Analysis: "Show ROI for Q4 digital campaigns"
Lead Scoring: "Find high-score leads that haven't been contacted"
Content Performance: "Which campaigns generated the most qualified leads?"
Executive Team
Revenue Forecasting: "What's our pipeline by region for next quarter?"
Performance Metrics: "Show top performers by closed revenue this month"
Customer Health: "List top 20 accounts and their recent engagement"
Development
Scripts
npm run build # Build TypeScript
npm run dev # Development with hot reload
npm run start # Start production server
npm run lint # Run ESLint
npm run test # Run tests (when implemented)Project Structure
src/
āāā auth/ # Salesforce authentication
āāā tools/ # MCP tool implementations
ā āāā search-tools.ts # Search and query tools
ā āāā crud-tools.ts # CRUD operations
ā āāā relationship-tools.ts # Relationship navigation
āāā types/ # TypeScript type definitions
āāā utils/ # Utilities and helpers
ā āāā config.ts # Configuration management
ā āāā logger.ts # Logging utilities
ā āāā error-handler.ts # Error handling
āāā index.ts # Main server entry pointSecurity
OAuth 2.0: Secure authentication with Salesforce
Permission Respect: All operations respect Salesforce user permissions
Input Validation: SOQL injection prevention and input sanitization
Error Handling: Secure error messages without sensitive data exposure
Troubleshooting
Common Issues
Authentication Failed
Verify your Salesforce credentials
Check if your IP is allowlisted in Salesforce
Ensure the security token is current
Permission Denied
Verify user has appropriate object permissions
Check field-level security settings
Ensure profile has API access enabled
API Limits
Monitor API usage in Salesforce Setup
Implement rate limiting if needed
Consider using bulk operations for large datasets
Contributing
Fork the repository
Create a feature branch
Make your changes
Run tests and linting
Submit a pull request
License
MIT License - see LICENSE file for details.
Available Tools
6 toolsget_recordB
Retrieve a specific Salesforce record by ID
| Name | Required | Description | Default |
|---|---|---|---|
| fields | No | Fields to retrieve (optional, defaults to common fields) | |
| recordId | Yes | Salesforce record ID | |
| objectType | Yes | Salesforce object type (e.g., Account, Contact) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It only states 'retrieve', implying a read operation, but does not confirm non-destructiveness, authentication needs, rate limits, or error conditions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence of 8 words, front-loaded with the key action and resource. Every word is necessary, with zero redundancy or irrelevance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and no annotations, the description is incomplete. It does not specify the return format (e.g., full record object, specific fields), error handling, or what happens if the ID is invalid.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so all parameters have descriptions. The tool description adds no additional meaning beyond what the schema already provides, meeting the baseline expectation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves a specific Salesforce record by ID, using a specific verb and resource. It distinguishes itself from sibling tools like search_records, soql_query, and global_search by focusing on single-record retrieval by ID.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool vs alternatives (e.g., search_records for filtering, soql_query for complex queries). No when-not-to-use or exclusion criteria are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_record_historyB
Get the field history for a record
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of history records | |
| recordId | Yes | Record ID | |
| objectType | Yes | Object type |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so the description must disclose behavior. It does not mention that the tool is read-only, any required permissions, or the scope of history returned. The limit parameter is documented in schema but not explained in behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is concise and to the point. It is not verbose, but could benefit from a bit more context without being overly long.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of an output schema and annotations, the description is minimally complete. It does not describe the return format, pagination, or what 'field history' includes. The schema covers the parameters, but the overall behavior is under-specified.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% for all three parameters, so the description adds no extra meaning. The descriptions in the schema already cover objectType, recordId, and limit. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Get' and the resource 'field history for a record', which distinguishes it from sibling tools like get_record (current data) or search_records (search).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives such as get_record or search_records. The context of history retrieval is implied but not explicitly compared.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
global_searchB
Perform a global search across all Salesforce objects
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of records to return | |
| searchTerm | Yes | Term to search for |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must disclose behavior but only states 'global search'. No information on scope, limits, or response format. Minimal transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, no filler. Efficiently conveys the core action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema and no behavioral details. Agent lacks information on return type, sorting, or limitations, which are essential for a search tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with descriptions for both parameters. The description adds no new param info beyond the schema, meeting the baseline.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Perform a global search') and the resource ('all Salesforce objects'), distinct from siblings like search_records which likely target specific objects.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives like search_records or soql_query. The agent must infer usage from sibling names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_recordsC
Search for Salesforce records across multiple objects
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of records to return | |
| query | Yes | Search query string | |
| objects | No | Object types to search (e.g., Account, Contact, Lead) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description should disclose behavioral traits. The minimal description does not mention whether the search is read-only, performance implications, or query syntax details.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, concise and front-loaded. It earns its place but could be expanded slightly without losing conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema and no annotations, the description is incomplete. It does not explain return format, pagination, or error handling, which is required given the complexity of searching across multiple objects.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents parameters adequately. The description adds no additional meaning beyond the schema, meeting the baseline.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches across multiple objects, which is a specific verb+resource. However, it does not differentiate from sibling tools like soql_query or global_search, which also search.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives like soql_query or global_search. The description lacks context on preferred use cases or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
soql_queryB
Execute a SOQL query against Salesforce (read-only)
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SOQL query string (SELECT statements only) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description bears full responsibility. It only discloses that the operation is read-only, but lacks details on performance limits, row limits, error handling, or idempotency, leaving significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is concise and to the point, with no wasted words. It is front-loaded with the key action and resource. However, slightly more structure could improve readability.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of an output schema and annotations, the description should provide more context about return format, error cases, and query restrictions (e.g., object or row limits). The current description is too minimal for a tool that may have complex behavior.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description repeats the parameter info (SOQL query string, SELECT statements) from the schema without adding new semantic value, contributing no extra clarity beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Execute', the resource 'SOQL query', and the target 'Salesforce', with the read-only constraint. It effectively distinguishes this tool from siblings like search_records and global_search by specifying it's for SOQL queries.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for SOQL queries but does not explicitly state when to use this tool over alternatives, such as for complex queries versus simple record retrieval. There is no mention of exclusions or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v1.0.0- First observed
get_record - First observed
get_record_history - First observed
get_related_records - First observed
global_search - First observed
search_records - First observed
soql_query
TDQS
Scored across 6 tools
Tools like search_records and global_search have overlapping purposes, both searching across objects. Their descriptions do not clearly differentiate them, causing potential confusion for an agent.
Most tool names follow a verb_noun pattern (e.g., get_record, search_records), but global_search is noun_verb, and soql_query is a slight deviation. Overall, the pattern is mostly consistent.
With 6 tools, the server is well-scoped for read-only Salesforce operations. Each tool serves a clear purpose without redundancy, and the count is appropriate for the domain.
The tool set covers only read operations (queries and retrievals). Missing create, update, delete, and metadata discovery tools create significant gaps for typical Salesforce workflows.
Maintenance
Related MCP Connectors
CRM, relationship intelligence, and multi-agent orchestration for AI agents.
- ElaichiOAuthai.elaichi
Governed AI agents for the software your company already runs. 400+ connectors, one endpoint.
- mcp-serverOAuthcom.make
Give your AI agents the tools to build, manage, and run automation workflows.
Full LinkedIn access for AI agents: leads, messaging, and campaigns with safe limits built in.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to securely interact with Salesforce CRM data through SOQL queries, CRUD operations, and metadata exploration. Supports connecting to Salesforce objects like Accounts, Contacts, and Opportunities via OAuth 2.0 authentication.82MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Salesforce through a secure interface for performing CRUD operations, executing SOQL queries, and managing schema discovery. It features a smart learning system that analyzes custom objects and fields to provide intelligent assistance tailored to specific Salesforce configurations.1450 npm17BSD 2-Clause "Simplified"
- AlicenseAqualityBmaintenanceEnables interaction with Salesforce orgs to perform operations like querying data with SOQL, managing records, and executing Apex code. It provides configurable access levels and support for both standard and Tooling APIs via natural language interfaces.11MIT
- AlicenseBqualityAmaintenanceEnables AI-powered interaction with Salesforce, providing opportunity intelligence, engagement analysis, business case generation, and standard CRUD operations through natural language.1850 npm5MIT