Provides containerized deployment with Docker, making it easy to run the MCP server in isolated environments with proper configuration through environment variables.
Supports configuration through environment variables loaded from .env files, allowing secure storage of Salesforce credentials and connection parameters.
Enables interaction with Salesforce data through SOQL queries, SOSL searches, and CRUD operations. Provides tools for accessing metadata, executing Tooling API requests, making Apex REST calls, and performing direct REST API calls to Salesforce.
Implements the Model Context Protocol server in TypeScript, providing type safety and modern JavaScript features for the Salesforce connector implementation.
MCP Salesforce TypeScript Connector
A TypeScript implementation of a Model Context Protocol (MCP) server for Salesforce integration, allowing LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and CRUD operations.
Features
- 🔐 Simplified Password Authentication: Secure OAuth 2.0 Resource Owner Password Credentials Flow
- 📊 SOQL & SOSL: Execute queries and searches against Salesforce
- 🔍 Metadata Access: Retrieve object fields, labels, and types
- ✏️ CRUD Operations: Create, read, update, and delete records
- 🛠️ Tooling API: Execute Tooling API requests
- ⚡ Apex REST: Execute Apex REST requests
- 🌐 REST API: Make direct REST API calls to Salesforce
- 🐳 Docker Ready: No hardcoded values, fully configurable via environment variables
- 🔄 Token Refresh: Automatic token refresh for long-running sessions
Available Tools
authenticate_password
- Authenticate using username/password with OAuthrun_soql_query
- Execute SOQL queriesrun_sosl_search
- Execute SOSL searchesget_object_fields
- Get metadata for Salesforce objectsget_record
- Retrieve specific records by IDcreate_record
- Create new recordsupdate_record
- Update existing recordsdelete_record
- Delete recordstooling_execute
- Execute Tooling API requestsapex_execute
- Execute Apex REST requestsrestful
- Make direct REST API calls
Quick Start with Docker
Prerequisites
- Create a Connected App in Salesforce:
- Go to Setup → Apps → App Manager → New Connected App
- Fill in basic information (App Name, API Name, Contact Email)
- Enable OAuth Settings
- Set callback URL:
http://localhost:8080/callback
(required but not used) - Select OAuth Scopes:
- Access your basic information (id, profile, email, address, phone)
- Perform requests on your behalf at any time (refresh_token, offline_access)
- Access and manage your data (api)
- Save and note down the Consumer Key and Consumer Secret
- Get your Security Token:
- Go to Setup → My Personal Information → Reset Security Token
- Check your email for the new security token
Using the Docker Image
Pull and run the latest Docker image:
MCP Configuration
VS Code using Docker image
Add to your .vscode/mcp.json
:
You can also use volumes to mount a config file instead of passing environment variables:
Claude Desktop using Docker image
Add to your claude_desktop_config.json
:
Environment Variables
The server requires the following environment variables:
Required (OAuth Authentication)
SALESFORCE_CLIENT_ID
- Consumer Key from your Connected AppSALESFORCE_CLIENT_SECRET
- Consumer Secret from your Connected AppSALESFORCE_USERNAME
- Your Salesforce usernameSALESFORCE_PASSWORD
- Your Salesforce passwordSALESFORCE_SECURITY_TOKEN
- Your Salesforce security token
Optional
SALESFORCE_SANDBOX
- Set to"true"
for sandbox,"false"
for production (default:"false"
)
Alternative (Direct Token Authentication)
Instead of username/password, you can use:
SALESFORCE_ACCESS_TOKEN
- Direct access tokenSALESFORCE_INSTANCE_URL
- Salesforce instance URL (e.g.,https://your-instance.my.salesforce.com
)
Backward Compatibility
The server also supports alternative variable names:
SF_CONSUMER_KEY
/SF_CONSUMER_SECRET
SF_USERNAME
/SF_PASSWORD
/SF_SECURITY_TOKEN
Using Docker Compose
- Create a
.env
file with your environment variables:
- Run using Docker Compose:
Examples
Using the Tools
Once connected, you can use the tools through your MCP client:
Authentication:
Query Data:
Search:
Get Metadata:
Create Record:
Troubleshooting
Common Issues
- Authentication Failed
- Verify credentials are correct
- Check Connected App OAuth scopes include "Access and manage your data (api)"
- Ensure security token is current (reset if needed)
- Verify sandbox setting matches your org type
- Container Won't Start
- Ensure both CLIENT_ID and CLIENT_SECRET are provided
- Check that all required environment variables are set
- Verify Docker has access to pull the image
- Network Errors
- Check internet connection
- Verify Salesforce service status
- Check firewall settings allow outbound HTTPS connections
Debug Mode
For verbose logging, add the debug environment variable:
Contributing
See CONTRIBUTING.md for information about:
- Project architecture and development setup
- Running from source code
- Contributing guidelines and pull request process
License
MIT License - see LICENSE file for details.
Links
This server cannot be installed
A TypeScript implementation of a Model Context Protocol server that enables LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and CRUD operations.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that enables LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and various API operations including record management.Last updated -1077PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.Last updated -7331MIT License
- -securityFlicense-qualityA Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.Last updated -9TypeScript
- -securityFlicense-qualityA Model Context Protocol server that allows execution of SOQL queries and interaction with Salesforce data through a standardized interface.Last updated -JavaScript