by lciesielski
Integrates with Salesforce to send emails and deploy Apex code through MCP tools, providing a quick-start reference for JWT‑based authentication and server setup.
A sample project that demonstrates how to connect a Node.js MCP server to a Salesforce org, enabling actions such as sending emails and deploying Apex code using the Model Context Protocol.
npm install
or yarn install
.utils/credentials.js
file that exports getSalesforceCredentials()
with login URL, username, Connected App client ID, and the private key for JWT Bearer Flow.claude_desktop_config.json
(or create your own) to point to the correct credential paths.node server.js
.utils/credentials.js
file.Q: Do I need a Salesforce Connected App? A: Yes, a Connected App with JWT authentication enabled is required.
Q: Which Salesforce environments are supported?
A: Both production (login.salesforce.com
) and sandbox (test.salesforce.com
) URLs are supported.
Q: Can I use environment variables instead of a file for credentials?
A: Absolutely – the getSalesforceCredentials
function can be modified to read from process.env
.
Q: Is there a Docker setup? A: The repository does not include Docker configuration; you can containerize the Node.js app yourself if needed.
Q: How do I add more MCP endpoints?
A: Extend server.js
with additional route handlers that call Salesforce APIs using the authenticated client.
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.
Install Dependencies:
npm install
# or
yarn install
Configure Salesforce Credentials:
credentials.js
file inside a utils
folder (./utils/credentials.js
).getSalesforceCredentials()
which returns your Salesforce connection details necessary for JWT Bearer Flow authentication.utils/credentials.js
Example:
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
};
}
Configuration File:
claude_desktop_config.json
file that can be used as a template for configuring your MCP server.node server.js
https://github.com/user-attachments/assets/08c8015a-bc57-4c5e-9f3d-4a9d9d310f4c
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.