Salesforce CLI MCP Server
Provides tools for managing Salesforce orgs, executing SOQL queries, deploying and retrieving metadata, running Apex tests, importing data, and creating packages via the Salesforce CLI.
Click on "Install 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 CLI MCP Serverlist my authorized Salesforce orgs"
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 CLI MCP Server
A Model Context Protocol (MCP) server that integrates with the Salesforce CLI, allowing AI assistants to interact with Salesforce orgs through natural language commands. Now with Web UI!
🆕 New Features
🌐 Web UI: Interactive web interface for easy Salesforce CLI operations
🔗 HTTP Server: RESTful API endpoints alongside MCP protocol
📊 Real-time Status: Live server health monitoring
🎯 Quick Actions: One-click shortcuts for common operations
📋 Copy Results: Easy result copying and formatting
Features
Org Management: List and manage authorized Salesforce orgs
Data Operations: Execute SOQL queries and import data
Metadata Operations: Deploy and retrieve metadata
Testing: Run Apex tests
Package Management: Create and manage Salesforce packages
Custom Commands: Execute any Salesforce CLI command
Web Interface: User-friendly web UI for all operations
HTTP API: RESTful endpoints for programmatic access
Prerequisites
Before using this MCP server, ensure you have:
Salesforce CLI installed: Install Salesforce CLI
Node.js (version 18 or higher)
At least one authorized Salesforce org
Quick Start
1. Clone the repository
git clone https://github.com/timaw513-emergenit/salesforce-cli-mcp-server.git
cd salesforce-cli-mcp-server2. Install dependencies
npm install3. Build the project
npm run build4. Choose your mode
Option A: Web UI Mode (Recommended)
Start the server with web interface:
npm run webThen open your browser to: http://localhost:3000
Option B: STDIO Mode (for MCP clients)
Configure your MCP client as shown below.
🌐 Web UI Usage
The web interface provides an intuitive way to interact with your Salesforce orgs:
Features:
🚀 Interactive Forms: Fill out forms for each Salesforce CLI command
📊 Quick Actions: One-click shortcuts for common tasks
📋 Live Results: Real-time command execution with formatted output
📱 Responsive Design: Works on desktop, tablet, and mobile
🔄 Status Monitoring: Real-time server health indicators
Available Operations:
List Orgs: View all authorized Salesforce orgs
Execute SOQL: Run queries with syntax highlighting
Custom Commands: Execute any Salesforce CLI command
Deploy/Retrieve: Metadata operations with progress tracking
Run Tests: Execute Apex tests with detailed results
Quick Actions:
List Orgs: Instantly view all authorized orgs
Query Accounts: Pre-filled SOQL query for Account records
Org Info: Display current org details
API Endpoints
When running in HTTP mode, the server provides these endpoints:
Core Endpoints:
GET /- Web UI interfaceGET /health- Health checkGET /api/status- Detailed server statusGET /api/tools- Available tools listPOST /api/execute- Execute Salesforce CLI commandsPOST /mcp- MCP protocol endpoint
Example API Usage:
# Execute a SOQL query
curl -X POST http://localhost:3000/api/execute \
-H "Content-Type: application/json" \
-d '{"command": "data query --json --query \"SELECT Id, Name FROM Account LIMIT 5\""}'
# List all orgs
curl -X POST http://localhost:3000/api/execute \
-H "Content-Type: application/json" \
-d '{"command": "org list --json"}'
# Check server health
curl http://localhost:3000/healthMCP Client Configuration
For Claude Desktop
Add this configuration to your Claude Desktop MCP settings file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
STDIO Mode:
{
"mcpServers": {
"salesforce-cli": {
"command": "node",
"args": ["/absolute/path/to/salesforce-cli-mcp-server/build/index.js"]
}
}
}HTTP Mode:
{
"mcpServers": {
"salesforce-cli-http": {
"command": "curl",
"args": ["-X", "POST", "http://localhost:3000/mcp"]
}
}
}For VS Code with MCP Extension
Create a .vscode/mcp.json file in your project root:
{
"servers": {
"Salesforce CLI": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/salesforce-cli-mcp-server/build/index.js"]
}
}
}Available Commands
NPM Scripts
# Development
npm run build # Build TypeScript
npm run dev # Watch mode for development
npm run clean # Clean build directory
# Running
npm run start # Start in STDIO mode
npm run http # Start HTTP server (with Web UI)
npm run web # Alias for http mode
npm run ui # Alias for http mode
# Testing
npm run inspector # Run MCP Inspector
npm run test # Build and run inspectorAvailable Tools
1. sf_org_list
List all authorized Salesforce orgs.
2. sf_data_query
Execute a SOQL query against a Salesforce org.
3. sf_project_deploy
Deploy metadata to a Salesforce org.
4. sf_project_retrieve
Retrieve metadata from a Salesforce org.
5. sf_apex_test_run
Run Apex tests in a Salesforce org.
6. sf_data_import
Import data from a CSV file into a Salesforce org.
7. sf_package_create
Create a new Salesforce package.
8. sf_custom_command
Execute any Salesforce CLI command.
Usage Examples
Via Web UI
Open http://localhost:3000
Select a tool from the sidebar
Fill out the form parameters
Click "Execute" and view results
Via Natural Language (MCP clients)
Once configured, you can use natural language with your AI assistant:
Org Management
"List all my Salesforce orgs"
"Show me the connection status of all orgs"
Data Queries
"Query all accounts in my org"
"Get all contacts where the email contains 'example.com'"
"Run this SOQL query: SELECT Id, Name FROM Account LIMIT 10"
Metadata Operations
"Deploy all metadata to my sandbox"
"Retrieve the Account object metadata"
"Deploy only the AccountController class"
Testing
"Run all Apex tests in my org"
"Run tests for the AccountTest class"
Data Import
"Import the accounts.csv file as Account records"
Custom Commands
"Run the command: org display --target-org myorg"
Development
Testing
Use the MCP Inspector to test your server:
npm run inspectorDevelopment Mode
Run in development mode with auto-rebuild:
npm run devWeb UI Development
For web UI development, start the HTTP server and make changes to files in the public/ directory:
npm run webThe server will serve static files from the public/ directory automatically.
Security Considerations
This MCP server executes Salesforce CLI commands directly on your system. Ensure that:
You trust the AI assistant you're using
You have proper backup procedures in place
You understand the implications of the commands being executed
You review any destructive operations before confirming
The HTTP server (if used) is only accessible from trusted networks
Troubleshooting
Common Issues
"Command not found: sf"
Ensure Salesforce CLI is installed and in your PATH
"No orgs found"
Make sure you have authorized at least one Salesforce org using
sf org login web
"Permission denied"
Ensure the build files have execute permissions:
chmod +x build/*.js
"Module not found"
Run
npm installto install dependenciesRun
npm run buildto compile TypeScript
"Port already in use"
Change the port:
MCP_PORT=3001 npm run web
Web UI not loading
Ensure you've run
npm run buildfirstCheck that
public/index.htmlexistsVerify server is running:
curl http://localhost:3000/health
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
License
MIT License - see LICENSE file for details.
🌟 Now with Web UI! Access your Salesforce CLI through a beautiful, intuitive web interface at http://localhost:3000
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/timaw513-emergenit/salesforce-cli-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server