Salesforce MCP Server
Provides tools for interacting with Salesforce, including listing objects, describing object fields, and executing SOQL queries against a Salesforce instance.
Click on "Deploy 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 MCP Serverdescribe the Account object fields"
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 MCP Server
An MCP (Model Context Protocol) server implementation for Salesforce integration, enabling AI assistants to interact with Salesforce data through standardized tools.
Features
This MCP server provides three powerful tools for Salesforce integration:
list_objects: List all available Salesforce objects with their metadata
describe_object: Get detailed field information for a specific Salesforce object
execute_soql_query: Execute SOQL queries against your Salesforce instance
Related MCP server: MCP Salesforce Server
Prerequisites
Python 3.13+
A Salesforce account with API access
Salesforce security token (see setup instructions below)
Installation
Clone this repository:
git clone <repository-url>
cd mcp-salesforceCreate and activate a virtual environment using uv:
uv venv
source .venv/bin/activate # On Unix/macOS
# or
.venv\Scripts\activate # On WindowsInstall dependencies:
uv pip install -e .Configuration
Copy the example environment file:
cp .env.example .envEdit
.envand add your Salesforce credentials:
SALESFORCE_USERNAME=your_username@example.com
SALESFORCE_PASSWORD=your_password
SALESFORCE_SECURITY_TOKEN=your_security_tokenGetting Your Salesforce Security Token
Log in to Salesforce
Go to Setup > Personal Setup > My Personal Information > Reset My Security Token
Click Reset Security Token
Check your email for the new security token
Usage
Running the Server
Start the MCP server using one of the following methods:
# Method 1: Run directly with Python
python main.py
# Method 2: Use the installed command
mcp-salesforce
# Method 3: Run with uv (recommended)
uv run mcp-salesforceTesting with MCP Inspector
The MCP Inspector is a powerful tool for testing and debugging your MCP server. It provides an interactive interface to explore available tools and test them with different parameters.
Method 1: Using uv run with mcp-salesforce command (recommended)
npx @modelcontextprotocol/inspector uv run mcp-salesforceMethod 2: Using uv run with Python directly
npx @modelcontextprotocol/inspector uv run python main.pyThis will:
Start the MCP Inspector web interface
Launch your Salesforce MCP server
Open a browser window where you can:
View all available tools
Test each tool with custom parameters
See the JSON responses
Debug any issues
Note: Make sure your .env file is configured with valid Salesforce credentials before running the inspector.
Available Tools
1. list_objects
Lists all available Salesforce objects in your org.
Returns:
Dictionary containing:
objects: Array of object metadata, each with:name: API name of the objectlabel: Display labelcustom: Whether it's a custom objectqueryable: Whether it can be queried via SOQLsearchable: Whether it's searchablecreateable: Whether new records can be createdupdateable: Whether records can be updateddeletable: Whether records can be deleted
2. describe_object
Get all fields for a specific Salesforce object.
Parameters:
object_name(string): The API name of the Salesforce object (e.g., 'Account', 'Contact', 'CustomObject__c')
Returns:
Dictionary containing:
name: Object API namefields: Array of field definitions with:name: Field API namelabel: Field display labeltype: Data type (string, number, date, picklist, etc.)length,precision,scale: Size constraintsrequired: Whether the field is requiredunique: Whether values must be uniquecreateable,updateable: Field permissionscalculated: Whether it's a formula fielddefaultValue: Default value for the fieldpicklistValues: Available values (for picklist fields)referenceTo: Referenced object (for lookup/master-detail fields)
3. execute_soql_query
Execute SOQL (Salesforce Object Query Language) queries.
Parameters:
query(string): The SOQL query string (e.g., 'SELECT Id, Name FROM Account LIMIT 10')
Returns:
Dictionary containing:
query: The executed SOQL query stringrows: Array of records with queried fieldsrow_count: Total number of records returnedcolumns: Array of column names in the result set
Important SOQL Rules:
CANNOT use SELECT * - You MUST specify column names explicitly
Aggregate queries CANNOT use LIMIT - Queries using COUNT, SUM, AVG, MIN, MAX cannot have LIMIT clause
Example Queries:
-- Get first 10 accounts
SELECT Id, Name, Industry FROM Account LIMIT 10
-- Get contacts with filters
SELECT Id, FirstName, LastName, Email FROM Contact WHERE Email != null LIMIT 20
-- Join query (using relationship)
SELECT Id, Name, Owner.Name FROM Account WHERE CreatedDate = TODAYDevelopment
Project Structure
mcp-salesforce/
├── main.py # Main MCP server implementation
├── pyproject.toml # Project configuration and dependencies
├── .env.example # Example environment variables
├── .env # Your actual credentials (git-ignored)
└── README.md # This fileDependencies
fastmcp: Framework for building MCP servers
simple-salesforce: Python client for Salesforce REST API
python-dotenv: Load environment variables from .env files
Adding to Claude Desktop
To use this MCP server with Claude Desktop, add the following to your Claude Desktop configuration:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"salesforce": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-salesforce",
"run",
"mcp-salesforce"
]
}
}
}Replace /absolute/path/to/mcp-salesforce with the actual path to your project directory.
Alternative configuration using Python directly:
{
"mcpServers": {
"salesforce": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-salesforce",
"run",
"python",
"main.py"
]
}
}
}Error Handling
The server includes comprehensive error handling:
Missing Credentials: Clear error message if environment variables are not set
Authentication Errors: Salesforce API authentication failures are reported
Invalid Queries: SOQL syntax errors are returned with helpful messages
API Limits: Respects Salesforce API rate limits
Security Notes
Never commit your
.envfile to version controlKeep your Salesforce security token secure
Consider using OAuth 2.0 for production deployments
Regularly rotate your security token
License
[Add your license here]
Contributing
[Add contribution guidelines here]
Support
For issues and questions:
Check the simple-salesforce documentation
Review Salesforce API documentation
Open an issue in this repository
Available Tools
4 toolsdescribe_objectA
Get all fields for a specific Salesforce object.
Args: object_name: The API name of the Salesforce object (e.g., 'Account', 'Contact')
Returns: Dictionary containing object name and list of field definitions.
| Name | Required | Description | Default |
|---|---|---|---|
| object_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries burden. It discloses the return type (dictionary of fields) and that it's a read operation ('Get'), but doesn't mention permissions, API limits, or side effects. For a simple describe tool, this is adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sections (Args, Returns) after a one-line summary. Every sentence adds value; no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Simple tool with one parameter and an output schema. Description covers purpose, parameter, and return format, which is complete for this scope.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema provides no description for object_name (0% coverage). The description fully compensates by explaining it's the API name and providing examples ('Account', 'Contact').
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States 'Get all fields for a specific Salesforce object' – a specific verb ('get'), resource ('fields'), and scope ('specific Salesforce object'). Clearly distinct from siblings like list_objects or execute_soql_query.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implied usage: when you need field definitions for an object. No explicit when-to-use or alternatives are mentioned, but the purpose is straightforward.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
execute_soql_queryA
Execute a SOQL query against Salesforce.
Args: query: The SOQL query string (e.g., 'SELECT Id, Name FROM Account LIMIT 10')
Returns: Dictionary containing query, rows, row_count, and columns.
IMPORTANT: Before constructing SOQL queries, use the get_soql_help() tool to understand: - Basic SOQL syntax and structure - How to write WHERE clauses and filters - Relationship queries (child-to-parent and parent-to-child) - Aggregate functions and GROUP BY - Common patterns and best practices
Important SOQL Rules: 1. CANNOT use SELECT * - You MUST specify column names explicitly 2. Aggregate queries (using COUNT, SUM, AVG, etc.) CANNOT use LIMIT
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly describes the return format (dictionary with query, rows, row_count, columns) and important SOQL rules (no SELECT *, aggregate queries can't use LIMIT), which are critical behavioral constraints. It stops short of explicitly stating read-only semantics, but the nature of a SOQL query execution makes this reasonably inferable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is longer than strictly necessary but is well-structured with clear sections (Args, Returns, Important, Reference, Rules). Every section adds meaningful information, though the content could be tightened slightly without losing value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity and the absence of annotations, the description covers essential aspects: return structure, critical rules, and a reference link. It also leverages the output schema for return details. It lacks explicit error-handling or permission requirements, but for a query execution tool, this is largely sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema only defines 'query' as a string with no description, leaving the description to fully compensate. The description explains the parameter with a concrete example ('SELECT Id, Name FROM Account LIMIT 10') and adds crucial constraints on valid query construction, thereby providing complete parameter semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Execute a SOQL query against Salesforce.' This is a specific verb+resource pairing that distinguishes it from siblings like list_objects, describe_object, and get_soql_help, which serve different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly instructs users to consult get_soql_help() before constructing queries, which provides valuable context on when to use this tool versus learning/helper tools. However, it does not explicitly state when NOT to use this tool (e.g., for metadata exploration), leaving some ambiguity.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_soql_helpA
Get comprehensive help documentation for SOQL (Salesforce Object Query Language).
Returns: Dictionary containing SOQL syntax guide, examples, best practices, and common patterns.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It discloses the return type (Dictionary) and content (syntax guide, examples, best practices) and provides a reference. It does not explicitly state read-only behavior, but the nature of a help tool makes side effects unlikely.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, front-loaded with the purpose, and includes return info and a reference link—all in three sentences with no waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple help tool with no parameters and an output schema, the description provides purpose, return details, and a reference. It is complete enough, though it could benefit from an explicit 'read-only' note.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so the schema covers everything. Per rubric, a zero-parameter tool gets a baseline of 4; the description adds no parameter details, which is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool provides comprehensive help documentation for SOQL, with a specific verb ('Get') and resource (SOQL help documentation). It distinguishes itself from sibling tools like execute_soql_query and describe_object.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage (when you need SOQL help) but does not explicitly state when to use this tool versus alternatives. It lacks direct exclusions or alternatives, so the guidance is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_objectsA
List all available Salesforce objects.
Returns: List of dictionaries containing object metadata including name, label, whether it's custom, and other attributes.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full transparency burden. It implies a read-only operation ('List') and describes the return shape, but does not disclose potential large result sets, permission needs, or other behavioral traits. It is not misleading, so it avoids a lower score.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and front-loaded: a single action sentence followed by a brief return format summary. Every sentence earns its place with no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple zero-parameter tool with an output schema, the description sufficiently covers the core behavior and return format. It could be enhanced with usage context (e.g., referencing sibling tools), but it is complete enough for basic operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has zero parameters, so the 0-param baseline of 4 applies. The description adds no parameter-related information because there are no parameters to explain, and the schema coverage is trivially 100%.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with 'List all available Salesforce objects,' a specific verb+resource that clearly states the tool's function. It distinguishes from siblings like describe_object (which describes a specific object) and execute_soql_query (which runs queries).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for enumerating all objects but provides no explicit 'when to use' guidance or contrasts with alternatives. It does not mention that describe_object is for specific object details.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
describe_object - First observed
execute_soql_query - First observed
get_soql_help - First observed
list_objects
TDQS
Scored across 4 tools
Each tool targets a distinct responsibility: listing objects, describing an object, providing SOQL help, and executing a query. There is no overlap in purpose or confusion about which tool to use.
All tool names follow a consistent verb_noun pattern in snake_case (list_objects, describe_object, get_soql_help, execute_soql_query). This is uniform and predictable.
Four tools is well within the ideal range and each tool serves a clear, non-redundant function. The count feels appropriate for the server's focused scope of metadata access and SOQL execution.
The server lacks any record-level CRUD operations (create, update, delete) or a direct 'get record' tool, which are expected from a Salesforce MCP server. While it covers schema discovery and querying, significant functional gaps remain for real-world automation.
Maintenance
Related MCP Connectors
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Run SOQL queries against your Salesforce org to retrieve records and insights. Explore objects, fi…
Run SOQL queries to explore and retrieve Salesforce data. Inspect records, fields, and relationshi…
Plan Salesforce deploys, open pull requests and trigger pipelines from your AI client.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to securely interact with Salesforce CRM data through SOQL queries, CRUD operations, and metadata exploration. Supports connecting to Salesforce objects like Accounts, Contacts, and Opportunities via OAuth 2.0 authentication.82MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Salesforce through a secure interface for performing CRUD operations, executing SOQL queries, and managing schema discovery. It features a smart learning system that analyzes custom objects and fields to provide intelligent assistance tailored to specific Salesforce configurations.1429 npm17BSD 2-Clause "Simplified"
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to interact with Salesforce organizations, allowing them to execute Apex code, query data, describe objects, and manage org connections through natural language.600 npm31MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Salesforce orgs through natural language commands, supporting org management, SOQL queries, metadata operations, testing, and more.1-