home / mcp / agentforce mcp server
Provides tools to authenticate, create agent sessions, and exchange messages with Salesforce Agentforce agents via MCP.
Configuration
View docs{
"mcpServers": {
"xlengelle-sf-agentforce-mcp-xlengelle": {
"command": "python",
"args": [
"/path/to/your/agentforce_mcp_server.py"
],
"env": {
"SALESFORCE_ORG_ID": "YOUR_ORG_ID",
"SALESFORCE_AGENT_ID": "YOUR_AGENT_ID",
"SALESFORCE_CLIENT_ID": "YOUR_CLIENT_ID",
"SALESFORCE_SERVER_URL": "your_salesforce_domain.my.salesforce.com",
"SALESFORCE_CLIENT_SECRET": "YOUR_CLIENT_SECRET"
}
}
}
}This MCP server provides tools to interact with the Salesforce Agentforce API. It enables authentication, session creation, and message exchange with Agentforce agents, and it can be run locally or wired into a desktop integration for seamless agent communication.
You will run the Agentforce MCP server locally and connect your MCP client or Claude Desktop integration to it. Start by launching the server, authenticate a client, create a session with a specific Agentforce agent, and then exchange messages. The server handles authentication, session state, and message sequencing for you, so you can focus on building your workflow around Agentforce agents.
Prerequisites: ensure you have Python 3.10 or higher installed.
Install the required dependencies from the project’s requirements file.
Make the MCP server script executable and prepare the environment.
The recommended setup includes these commands executed in your terminal:
pip install -r requirements.txt
cp .env.example .env
chmod +x agentforce_mcp_server.pyConfigure the server through environment variables. Create a local environment file and fill in your Salesforce credentials as shown below.
SALESFORCE_ORG_ID="your_org_id_here"
SALESFORCE_AGENT_ID="your_agent_id_here"
SALESFORCE_CLIENT_ID="your_client_id_here"
SALESFORCE_CLIENT_SECRET="your_client_secret_here"
SALESFORCE_SERVER_URL="your_server_url_here"Start the MCP server so it listens for client connections.
python agentforce_mcp_server.pyIf you use Claude Desktop, wire the MCP server into Claude by updating the Claude desktop configuration to point to your local Python process and the server script.
Keep your Salesforce credentials secure. Do not commit your .env file to version control. The server stores authentication state per client email and logs API interactions for debugging.
Authenticates with the Agentforce API using a client email.
Creates a session with the configured Agentforce agent.
Sends a message to the Agentforce agent and returns the response.
Gets the status of the current session, including authentication status, session ID, and sequence ID.
Performs the full flow from authentication to session creation and message exchange in a single call.