Salesforce CLI Connect MCP
A Model Context Protocol (MCP) server that provides a user-friendly setup wizard for connecting Claude Desktop to Salesforce via the Salesforce CLI.
Overview
This MCP server acts as a setup assistant that guides non-technical users through connecting to Salesforce. It handles:
- ✅ Checking for Salesforce CLI installation
- ✅ Installing Salesforce CLI if needed
- ✅ Opening browser for secure OAuth authentication
- ✅ Verifying the connection
- ✅ Providing clear restart instructions
No technical knowledge required - users simply ask Claude to "Help me connect to Salesforce" and the setup wizard guides them through the entire process.
Features
- Automatic Installation: Installs Salesforce CLI if not already present
- Browser-Based Login: Secure OAuth flow through your default browser
- No Plain-Text Credentials: All credentials stored securely via Salesforce CLI
- Individual User Authentication: Each user authenticates with their own Salesforce account
- Configurable: Supports any Salesforce instance URL
- Cross-Platform: Works on Windows, macOS, and Linux
For IT Administrators
Quick Start
- Install the package globally (optional):
npm install -g @digitalrupix/connect-to-salesforce-mcp
-
Deploy the Claude Desktop configuration to users' machines at:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- Mac:
-
Configuration file:
{
"mcpServers": {
"connect-to-salesforce": {
"command": "npx",
"args": ["-y", "@digitalrupix/connect-to-salesforce-mcp"],
"env": {
"SALESFORCE_INSTANCE_URL": "https://your-org.my.salesforce.com",
"SALESFORCE_ORG_ALIAS": "mcp-server-connect"
}
},
"salesforce": {
"command": "npx",
"args": ["-y", "@tsmztech/mcp-server-salesforce"],
"env": {
"SALESFORCE_CONNECTION_TYPE": "Salesforce_CLI",
"SALESFORCE_INSTANCE_URL": "https://your-org.my.salesforce.com"
}
}
}
}
- Instruct users to:
- Open Claude Desktop
- Type: "Help me set up Salesforce" or "Connect to Salesforce"
- Follow the on-screen instructions
- Restart Claude Desktop when prompted
That's it! No manual CLI commands or config file editing required by end users.
Configuration Options
| Environment Variable | Required | Default | Description |
|---|---|---|---|
SALESFORCE_INSTANCE_URL | Yes | https://login.salesforce.com | Your Salesforce instance URL |
SALESFORCE_ORG_ALIAS | No | mcp-server-connect | Alias for the authenticated org |
Important Notes
- Both MCP servers (connect-to-salesforce and salesforce) should use the same
SALESFORCE_INSTANCE_URL - The org alias must match between the setup MCP and the Salesforce MCP configuration
- Users need Node.js and npm installed on their machines
For End Users
Setup Instructions
- Open Claude Desktop
- Ask Claude: "Help me set up Salesforce" or "Connect to Salesforce"
- Claude will guide you through the setup process
- A browser window will open for you to log in to Salesforce
- After successful login, completely close and reopen Claude Desktop
- You're ready to use Salesforce with Claude!
What Gets Installed
- Salesforce CLI: A command-line tool that securely stores your Salesforce credentials
- Org Connection: Your connection is saved with the alias
mcp-server-connect(or custom alias set by IT)
How to Restart Claude Desktop
- Mac: Press
Cmd+Qto quit, then reopen Claude Desktop - Windows: Right-click the Claude icon in the taskbar → "Close window", then reopen
- Linux: Select "Quit" from the menu, then reopen
Using Salesforce with Claude
After setup, you can ask Claude things like:
- "How many accounts are in my Salesforce org?"
- "Show me all opportunities created this month"
- "Find contacts named John"
- "Create a new account for Acme Corp"
- "Update the status of case 00012345"
Technical Details
Requirements
- Node.js 18.0.0 or higher
- NPM (comes with Node.js)
- Claude Desktop
- Active Salesforce account with appropriate permissions
How It Works
- The MCP server checks if Salesforce CLI is installed
- If not installed, it automatically installs via npm
- Runs
sf org login webwhich opens your browser for secure OAuth authentication - Verifies the connection by checking org status
- Stores credentials securely via Salesforce CLI (not in plain text)
Authentication Method
This tool uses Salesforce CLI OAuth (browser-based authentication):
- Opens your default browser to Salesforce login page
- Uses OAuth 2.0 authorization code flow
- Credentials are stored securely by Salesforce CLI
- Each user authenticates with their own account
- No passwords stored in config files
Security
- ✅ Credentials never stored in plain text
- ✅ Authentication uses Salesforce's OAuth flow
- ✅ Credentials managed by Salesforce CLI's secure storage
- ✅ Each user authenticates with their own Salesforce account
- ✅ No shared service accounts
Troubleshooting
"Setup Failed" Message
If setup fails, try these steps:
- Close Claude Desktop completely
- Open your terminal/command prompt
- Run:
npm install -g @salesforce/cli - Run:
sf org login web --instance-url https://your-org.my.salesforce.com --alias mcp-server-connect - Restart Claude Desktop
Browser Doesn't Open
- Check your default browser settings
- Try running the manual command above in step 4
- Ensure pop-ups are not blocked
- Contact your IT administrator if issues persist
Connection Not Working After Restart
- Make sure you completely quit Claude Desktop (not just closed the window)
- Verify the org alias by running:
sf org list - You should see
mcp-server-connectin the list - Check that the instance URL in your config matches your Salesforce org
"Invalid JSON" Error
This usually means there's a version mismatch. Try:
- Update Salesforce CLI:
npm install -g @salesforce/cli@latest - Restart Claude Desktop
- Run the setup again
Permission Errors During Installation
On some systems, you may need administrator privileges:
- Windows: Run Command Prompt as Administrator
- Mac/Linux: Use
sudo npm install -g @salesforce/cli
Development
Local Testing
# Clone the repository
git clone https://github.com/jake-hebert/connect-to-salesforce-mcp.git
cd connect-to-salesforce-mcp
# Install dependencies
npm install
# Test locally by adding to Claude Desktop config:
{
"mcpServers": {
"connect-to-salesforce-local": {
"command": "node",
"args": ["/absolute/path/to/index.js"],
"env": {
"SALESFORCE_INSTANCE_URL": "https://your-org.my.salesforce.com",
"SALESFORCE_ORG_ALIAS": "mcp-server-connect"
}
}
}
}
Publishing Updates
# Update version in package.json
npm version patch # or minor, major
# Publish to npm
npm publish --access public
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For technical support:
- Contact your IT administrator
- File an issue on the GitHub repository
- Check the Salesforce MCP documentation
Related Projects
- Salesforce MCP Server - The main MCP server for Salesforce operations
- Model Context Protocol - Documentation for the MCP standard
License
MIT
Changelog
v1.0.0
- Initial release
- Automatic Salesforce CLI installation
- Browser-based OAuth authentication
- Connection verification
- Cross-platform support (Windows, macOS, Linux)
