Integrate Salesforce with MCP Tools
MCP server that connects to Salesforce via JWT authentication, enabling email sending and Apex code deployment through Model Context Protocol tools.
Maintainer of this project? Claim this page to edit the listing.
1.0.0Add to Favorites
Why it matters
Connect your MCP environment to Salesforce to automate tasks like sending emails and deploying Apex code, streamlining your development and communication processes.
Outcomes
What it gets done
Send emails via Salesforce
Deploy Apex code to Salesforce
Authenticate using JWT Bearer Flow
Manage Salesforce credentials securely
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-mcp-salesforce | bash Capabilities
Tools your agent gets
Send emails through Salesforce
Deploy Apex code to Salesforce organization
Overview
mcp-salesforce MCP Server
A Node.js-based MCP server that integrates with Salesforce using JWT Bearer Flow authentication. It provides MCP tools for sending emails and deploying Apex code. Requires a Salesforce Connected App configured for JWT authentication and a credentials file with connection details. Use this connector when you need to interact with Salesforce features like email sending and Apex code deployment through the Model Context Protocol. Best suited for developers who want a basic example of Salesforce MCP integration and have a Salesforce org with Connected App capabilities.
What it does
This project provides a basic example of integrating with Salesforce using the Model Context Protocol (MCP). It exposes Salesforce features-sending emails and deploying Apex code-as MCP tools.
Install dependencies and run the server:
npm install
# or
yarn install
Then start the MCP server:
node server.js
You must create a utils/credentials.js file that exports a getSalesforceCredentials() function returning your Salesforce Connected App JWT authentication details (loginUrl, username, clientId, privateKey). The server uses JWT Bearer Flow to authenticate with your Salesforce org and exposes tools for email and Apex operations.
Source README
Salesforce MCP Sample Integration
This project provides a basic example of integrating with Salesforce using the Model Context Protocol (MCP). It allows interaction with Salesforce features like sending emails and deploying Apex code through MCP tools.
Prerequisites
- Node.js and npm (or yarn) installed.
- A Salesforce org where you can create a Connected App.
Setup
Install Dependencies:
npm install # or yarn installConfigure Salesforce Credentials:
- You MUST create a
credentials.jsfile inside autilsfolder (./utils/credentials.js). - This file needs to export a function
getSalesforceCredentials()which returns your Salesforce connection details necessary for JWT Bearer Flow authentication. - Important: Ensure you have a Connected App configured in Salesforce for JWT authentication, allowing the appropriate scopes and pre-authorizing the relevant user profile.
utils/credentials.jsExample:import fs from 'fs'; import path from 'path'; // You might load these from environment variables, a config file, etc. export function getSalesforceCredentials() { // --- IMPLEMENT YOUR LOGIC HERE to securely load credentials --- const loginUrl = "YOUR_SALESFORCE_LOGIN_URL"; // e.g., https://login.salesforce.com or https://yourdomain.my.salesforce.com const username = "YOUR_SALESFORCE_USERNAME"; const clientId = "YOUR_CONNECTED_APP_CONSUMER_KEY"; // Load your private key used to sign the JWT assertion // Ensure the key is formatted correctly, including BEGIN/END lines. const privateKey = fs.readFileSync(path.resolve(__dirname, 'path/to/your/server.key'), 'utf8'); // Example: const privateKey = process.env.SF_PRIVATE_KEY; if (!loginUrl || !username || !clientId || !privateKey) { throw new Error("Missing required Salesforce credentials in utils/credentials.js"); } return { loginUrl, username, clientId, privateKey }; }- You MUST create a
Configuration File:
- The repository includes a sample
claude_desktop_config.jsonfile that can be used as a template for configuring your MCP server. - Update the paths and credentials in this file according to your environment setup.
- The repository includes a sample
Running the Server
node server.js
Demo
https://github.com/user-attachments/assets/08c8015a-bc57-4c5e-9f3d-4a9d9d310f4c
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.