salesforce-mcp-server
0
The Salesforce MCP Server is designed to facilitate interaction between Salesforce data and the Claude Desktop application by implementing a Model Context Protocol server. It allows for querying account information from a Salesforce organization, enhancing data accessibility and integration.
Salesforce MCP Server
This project implements a Model Context Protocol (MCP) server that integrates with Salesforce, allowing Claude Desktop to interact with Salesforce data. Currently, it supports querying Account information from a Salesforce organization.
Prerequisites
- Node.js v16 or later
- Salesforce CLI (sf)
- Claude Desktop application
- Access to a Salesforce organization (sandbox or production)
Installation
- Clone the repository:
git clone [repository-url]
cd salesforce-mcp-server
- Install dependencies:
npm install
- Create a
.env
file in the project root:
SF_LOGIN_URL=https://test.salesforce.com
SF_API_VERSION=59.0
SF_ORG_ALIAS=your-sandbox-alias
- Authenticate with Salesforce:
# Login to your sandbox
sf org login web --alias your-sandbox-alias --instance-url https://test.salesforce.com
Configuration
Configure Claude Desktop
- Open the Claude Desktop configuration file:
# On Windows
code "%APPDATA%\Claude\claude_desktop_config.json"
# On macOS
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
- Add the following configuration:
{
"mcpServers": {
"salesforce": {
"command": "npm",
"args": ["run", "dev"],
"cwd": "path/to/your/salesforce-mcp-server"
}
}
}
Replace path/to/your/salesforce-mcp-server
with the actual path to your project directory.
Running the Server
- Start the server:
npm run dev
- Open Claude Desktop
- Look for the "⚡" button in the bottom right corner
- Click it to access Salesforce data through the MCP server
Available Features
Resources
accounts/list
: Returns a list of Salesforce accounts
Tools
refresh_accounts
: Manually refresh the account data
Development
Project Structure
salesforce-mcp-server/
├── src/
│ └── index.ts # Main server implementation
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .env # Environment variables
└── README.md # This file
Scripts
npm run dev
: Start the server in development modenpm run build
: Build the TypeScript codenpm start
: Run the built versionnpm run clean
: Clean the build directory
Troubleshooting
Common Issues
-
Connection Issues:
- Verify Salesforce authentication with
sf org display
- Check Claude Desktop configuration path is correct
- Ensure .env file has correct values
- Verify Salesforce authentication with
-
Authentication Issues:
- Re-authenticate with Salesforce using
sf org login web
- Verify your org alias in .env matches the authenticated org
- Re-authenticate with Salesforce using
-
Server Issues:
- Check Claude Desktop logs:
# On Windows type "%APPDATA%\Claude\logs\claude\mcp.log" # On macOS tail -f ~/Library/Logs/Claude/mcp.log
- Check Claude Desktop logs:
License
[Your License]
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request