Salesforce MCP Server
Provides tools for querying Salesforce data via SOQL/SOSL, managing records (create, read, update, delete, upsert), executing Apex code and tests, and deploying/retrieving metadata components.
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., "@Salesforce MCP Server Show me the Account object details"
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 comprehensive Model Context Protocol (MCP) server that provides seamless Salesforce integration for AI development tools like Claude Desktop, Cline, and other MCP-compatible clients.
π Features
17 Comprehensive Tools
π Query & Search Tools
execute-soql- Execute SOQL queries with auto-bulk switching and paginationexecute-sosl- Multi-object search with result aggregationdescribe-sobject- SObject metadata with intelligent caching
β‘ Apex Development Tools
execute-apex- Anonymous Apex execution with debug log capturerun-apex-tests- Apex test execution with coverage reportingget-apex-logs- Debug log retrieval with filtering
π Data Management Tools
create-record- Single/bulk record creation with auto-bulk switchingget-record- Record retrieval with field selectionupdate-record- Single/bulk record updates with validationdelete-record- Single/bulk record deletionupsert-record- External ID-based upsert operations
π§ Metadata Tools (Component-Based)
list-metadata-types- Discover metadata typesdeploy-metadata- Deploy individual metadata components (e.g., ApexClass, CustomObject) from files or JSONdeploy-bundle- Deploy a metadata bundle (e.g., LWC) from a directory pathretrieve-metadata- Retrieve individual metadata components, with an option to save to a filecheck-deploy-status- Check the status of a deployment
π Connection Tools
test-connection- Connection validation and health monitoring
Key Capabilities
π Auto-Bulk Switching - Intelligent API selection for optimal performance
π Dual Authentication - OAuth2 and Username/Password support
β‘ Smart Caching - 1-hour TTL for SObject metadata
π‘οΈ Type Safety - Full TypeScript implementation with runtime validation
π Comprehensive Logging - Detailed debugging and monitoring
π Raw Error Exposure - Preserve exact Salesforce errors for debugging
Related MCP server: Salesforce MCP Server
π Installation
To use with Desktop APP, such as Claude Desktop, Cline, Cursor, and so on, add the MCP server config below.
On macOS / Linux systems:
{
"mcp.servers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"@jjar/salesforce-mcp-server"
],
"env": {
"SF_USERNAME": "your-username@company.com",
"SF_PASSWORD": "your-password",
"SF_SECURITY_TOKEN": "",
"SF_LOGIN_URL": "https://login.salesforce.com"
},
"disabled": false,
"alwaysAllow": [
"test-connection",
"execute-soql",
"describe-sobject",
"get-record",
"get-apex-logs",
"list-metadata-types"
]
}
}
}{
"mcp.servers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"@jjar/salesforce-mcp-server"
],
"env": {
"SF_CLIENT_ID": "your-oauth2-client-id",
"SF_CLIENT_SECRET": "your-oauth2-client-secret",
"SF_REFRESH_TOKEN": "your-refresh-token",
"SF_INSTANCE_URL": "https://yourorg.my.salesforce.com"
},
"disabled": false,
"alwaysAllow": [
"test-connection",
"execute-soql",
"describe-sobject",
"get-record",
"get-apex-logs",
"list-metadata-types"
]
}
}
}On Windows systems:
{
"mcp.servers": {
"salesforce": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@jjar/salesforce-mcp-server"
],
"env": {
"SF_USERNAME": "your-username@company.com",
"SF_PASSWORD": "your-password",
"SF_SECURITY_TOKEN": "",
"SF_LOGIN_URL": "https://login.salesforce.com"
},
"disabled": false,
"alwaysAllow": [
"test-connection",
"execute-soql",
"describe-sobject",
"get-record",
"get-apex-logs",
"list-metadata-types"
]
}
}
}{
"mcp.servers": {
"salesforce": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@jjar/salesforce-mcp-server"
],
"env": {
"SF_CLIENT_ID": "your-oauth2-client-id",
"SF_CLIENT_SECRET": "your-oauth2-client-secret",
"SF_REFRESH_TOKEN": "your-refresh-token",
"SF_INSTANCE_URL": "https://yourorg.my.salesforce.com"
},
"disabled": false,
"alwaysAllow": [
"test-connection",
"execute-soql",
"describe-sobject",
"get-record",
"get-apex-logs",
"list-metadata-types"
]
}
}
}Configuration File Locations
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonmacOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonLinux:
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
β οΈ Important: After adding or modifying the MCP server configuration, you must restart VS Code for the changes to take effect.
Windows:
%USERPROFILE%\.cursor\mcp.jsonmacOS:
~/.cursor/mcp.jsonLinux:
~/.cursor/mcp.json
Tool Safety Levels
β
Safe for Auto-Approval (alwaysAllow)
test-connection- Connection validation (read-only)execute-soql- SOQL queries (read-only)describe-sobject- Metadata inspection (read-only)get-record- Single record retrieval (read-only)get-apex-logs- Debug log access (read-only)list-metadata-types- Metadata type discovery (read-only)
β οΈ Requires Manual Approval
create-record,update-record,delete-record,upsert-record- Data modificationdeploy-metadata- Metadata deploymentexecute-apex,run-apex-tests- Code executionexecute-sosl- Search operations (can be resource-intensive)retrieve-metadata- Metadata retrieval (can be large)
Authentication
Username/Password Authentication
Obtain your security token from Salesforce Setup β Personal Information β Reset Security Token (only required if your IP is not trusted)
Set environment variables as shown in the configuration section
Use
https://login.salesforce.comfor production orhttps://test.salesforce.comfor sandboxes
π‘ Security Token: Only add the security token if Salesforce requires it for your connection. If not leave
SF_SECURITY_TOKENempty.
OAuth2 Authentication
Create a Connected App in Salesforce Setup
Configure OAuth settings and obtain client credentials
Generate a refresh token using the OAuth2 flow
Set environment variables as shown in the configuration section
ποΈ Architecture
Core Components
Authentication Manager - Dual OAuth2/Username-Password support
Connection Manager - Singleton pattern with health monitoring
Tool Classes - Organized by functionality (Query, Apex, Data, Metadata)
Error Handler - Comprehensive error formatting with context
Cache Manager - TTL-based caching for performance optimization
Performance Features
Auto-Bulk Switching - Automatically uses Bulk API for large operations
Intelligent Caching - SObject metadata cached for 1 hour
Connection Reuse - Single connection across all operations
Polling Optimization - Efficient monitoring of long-running operations
π§ͺ Testing
# Test individual tools
node tests/test-query-tools.js
node tests/test-data-tools.js
node tests/test-apex-tools.js
node tests/test-metadata-tools.jsπ€ Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
π Related Projects
Model Context Protocol - The protocol this server implements
jsforce - Salesforce API library used in this project
Claude Desktop - AI assistant that supports MCP servers
Cline - VS Code extension for AI-assisted development
π¨βπ» Author
JarosΕaw Jaworski
π€ Development Credits
Part of this implementation was developed with assistance from Claude Sonnet 4 using the Cline VS Code extension, demonstrating the power of AI-assisted development in creating comprehensive developer tools.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
Available Tools
17 toolscheck-deploy-statusA
Check the status of a deployment
Inputs: deployId (required).
create-recordB
Create single or multiple records with auto-bulk switching
Inputs: sobjectType (required), recordData (required), options.
delete-recordA
Delete records by ID(s) with auto-bulk switching
Inputs: sobjectType (required), recordIds (required), options.
deploy-bundleC
Deploy a metadata bundle (e.g., LWC) from a directory path
Inputs: bundlePath (required), options.
deploy-metadataC
Deploy metadata components to Salesforce org
Inputs: components (required), options.
describe-sobjectA
Describe SObject metadata with 1-hour caching
Inputs: sobjectType (required), useCache.
execute-apexB
Execute anonymous Apex code with debug log capture
Inputs: apexCode (required), captureDebugLogs.
execute-soqlB
Execute SOQL query with auto-bulk switching for large result sets
Inputs: query (required), useBulk.
execute-soslB
Execute SOSL search with multi-object support
Inputs: searchQuery (required).
get-apex-logsB
Get debug logs with filtering and parsing options
Inputs: limit, userId, startTime, operation.
get-recordB
Retrieve a record by ID with optional field selection
Inputs: sobjectType (required), recordId (required), fields.
list-metadata-typesB
List available metadata types in the org for discovery
Inputs: apiVersion.
retrieve-metadataB
Retrieve metadata components from Salesforce org
Inputs: components (required), options.
run-apex-testsC
Run Apex tests with coverage and detailed results
Inputs: testClasses, testMethods, includeCoverage.
test-connectionA
Test Salesforce connection and return organization info
Inputs: no named parameters.
update-recordB
Update single or multiple records with auto-bulk switching
Inputs: sobjectType (required), recordData (required), options.
upsert-recordB
Upsert records using external ID with auto-bulk switching
Inputs: sobjectType (required), externalIdField (required), recordData (required), options.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 17 tools
Each tool targets a distinct Salesforce operation (record CRUD, queries, metadata, Apex, deployment, connection). Descriptions clearly differentiate between similar tools like deploy-bundle vs deploy-metadata.
All tool names follow a consistent verb-noun pattern with hyphens (e.g., create-record, execute-soql, deploy-metadata). No mixing of conventions.
17 tools cover the core Salesforce development workflow without being excessive. Each tool addresses a specific need and the count is well-proportioned for the domain.
The tool set covers record CRUD, SOQL/SOSL queries, Apex execution and testing, metadata operations, deployment, and connection verification. No obvious gaps for standard Salesforce development tasks.
Maintenance
Related MCP Connectors
Create contacts, move deals, send proposals and invoices, read your inbox, from Claude or ChatGPT.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Connect your team's living knowledge base β docs, data, issues, CRM β to Claude and ChatGPT.
Read and write Sage Intacct from Claude or ChatGPT. Write tools are flagged for approval.
Related MCP Servers
- AlicenseAqualityDmaintenanceExposes Salesforce CLI functionality to LLM tools like Claude Desktop, allowing AI agents to execute Salesforce commands, manage orgs, deploy code, and query data through natural language.562 npm36ISC
- AlicenseNot gradedqualityDmaintenanceIntegrates Claude with Salesforce to enable natural language querying, modification, and management of Salesforce records and metadata. It supports comprehensive operations including object/field management, SOSL searches, and Apex code execution.2,615 npm1MIT
- AlicenseAqualityDmaintenanceIntegrates Claude with Salesforce for natural language interactions with Salesforce data and metadata, enabling querying, modifying, and managing objects and records.2020 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Salesforce orgs through natural language commands, supporting org management, SOQL queries, metadata operations, testing, and more.1MIT