Salesforce MCP Server Documentation
Introduction​
The Salesforce MCP (Model Context Protocol) Server enables Answer Agent to interact with Salesforce data and metadata through natural language. This integration allows you to query, modify, and manage your Salesforce objects and records using conversational language.
Setting Up Salesforce Credentials​
OAuth 2.0 Client Credentials Flow​
-
Create a Connected App in Salesforce:
- Navigate to Setup > App Manager > New Connected App
- Fill in the required fields (Name, Email, etc.)
- Enable OAuth Settings
- Select "Enable OAuth Settings"
- Set a callback URL (can be
https://localhost:8080/callbackif not using one) - Under "Selected OAuth Scopes", add:
- Access and manage your data (api)
- Access your basic information (id, profile, email, address, phone)
- Perform requests on your behalf at any time (refresh_token, offline_access)
- Save the application
-
Get Client Credentials:
- After saving, navigate to Manage > Edit Policies
- Set "OAuth Policies" > "Permitted Users" to "Admin approved users are pre-authorized"
- Under "IP Relaxation", select "Relax IP restrictions"
- Save the changes
- Navigate to the Manage Consumer Details button to view your Client ID and Client Secret
- Note down your Salesforce instance URL (e.g.,
https://your-domain.my.salesforce.com)
-
Required Credentials:
- Client ID: From the connected app
- Client Secret: From the connected app
- Instance URL: Your exact Salesforce instance URL (e.g.,
https://your-domain.my.salesforce.com)
Configuration in Answer Agent​
Add your Salesforce credentials to Answer Agent's configuration:
For OAuth 2.0 Client Credentials Flow:​
{
"SALESFORCE_CONNECTION_TYPE": "OAuth_2.0_Client_Credentials",
"SALESFORCE_CLIENT_ID": "your_client_id",
"SALESFORCE_CLIENT_SECRET": "your_client_secret",
"SALESFORCE_INSTANCE_URL": "https://your-domain.my.salesforce.com"
}
Available Tools​
1. salesforce_search_objects​
Description: Search for Salesforce standard and custom objects by name pattern.
Schema:
{
"searchPattern": "string" // Search pattern to find objects
}
Use Cases:
- Developers: Find API names of objects to use in code
- Publishers: Discover available objects for content creation
2. salesforce_describe_object​
Description: Get detailed schema metadata including all fields, relationships, and field properties of any Salesforce object.
Schema:
{
"objectName": "string" // API name of the object (e.g., 'Account', 'Contact', 'Custom_Object__c')
}
Use Cases:
- Developers: Understand field types and relationships for integration development
- Publishers: Research data structures for documentation creation
3. salesforce_query_records​
Description: Query records from any Salesforce object using SOQL, including relationship queries.
Schema:
{
"objectName": "string", // API name of the object to query
"fields": ["string"], // List of fields to retrieve, including relationship fields
"whereClause": "string", // Optional WHERE clause
"orderBy": "string", // Optional ORDER BY clause
"limit": number // Optional maximum number of records to return
}
Use Cases:
- Developers: Test queries and validate data access patterns
- Publishers: Extract real data examples for documentation
4. salesforce_dml_records​
Description: Perform data manipulation operations on Salesforce records (insert, update, delete, upsert).
Schema:
{
"operation": "string", // "insert", "update", "delete", or "upsert"
"objectName": "string", // API name of the object
"records": [{}], // Array of records to process
"externalIdField": "string" // Optional external ID field name for upsert operations
}
Use Cases:
- Developers: Test data manipulation operations and validate business logic
- Publishers: Create sample data for demos or documentation
5. salesforce_manage_object​
Description: Create new custom objects or modify existing ones in Salesforce.
Schema:
{
"operation": "string", // "create" or "update"
"objectName": "string", // API name for the object (without __c suffix)
"label": "string", // Label for the object
"pluralLabel": "string", // Plural label for the object
"description": "string", // Optional description
"nameFieldLabel": "string", // Optional label for the name field
"nameFieldType": "string", // Optional type of the name field ("Text" or "AutoNumber")
"nameFieldFormat": "string", // Optional display format for AutoNumber field
"sharingModel": "string" // Optional sharing model ("ReadWrite", "Read", "Private", "ControlledByParent")
}
Use Cases:
- Developers: Create custom objects for application development
- Publishers: Set up demonstration environments for tutorials
6. salesforce_manage_field​
Description: Create new custom fields or modify existing fields on any Salesforce object.
Schema:
{
"operation": "string", // "create" or "update"
"objectName": "string", // API name of the object to add/modify the field
"fieldName": "string", // API name for the field (without __c suffix)
"label": "string", // Optional label for the field
"type": "string", // Field type (required for create)
"required": boolean, // Optional whether the field is required
"unique": boolean, // Optional whether the field value must be unique
"externalId": boolean, // Optional whether the field is an external ID
"length": number, // Optional length for text fields
"precision": number, // Optional precision for numeric fields
"scale": number, // Optional scale for numeric fields
"referenceTo": "string", // Optional API name of the object to reference
"relationshipLabel": "string", // Optional label for the relationship
"relationshipName": "string", // Optional API name for the relationship
"deleteConstraint": "string", // Optional delete constraint for Lookup fields
"picklistValues": [{ "label": "string", "isDefault": boolean }], // Optional values for Picklist fields
"description": "string" // Optional description of the field
}
Use Cases:
- Developers: Add custom fields to objects for application functionality
- Publishers: Create demo fields for tutorial environments
7. salesforce_search_all​
Description: Search across multiple Salesforce objects using SOSL (Salesforce Object Search Language).
Schema:
{
"searchTerm": "string", // Text to search for (supports wildcards * and ?)
"searchIn": "string", // Optional which fields to search in
"objects": [{
"name": "string", // API name of the object
"fields": ["string"], // Fields to return for this object
"where": "string", // Optional WHERE clause for this object
"orderBy": "string", // Optional ORDER BY clause for this object
"limit": number // Optional maximum number of records to return
}],
"withClauses": [{
"type": "string", // WITH clause type
"value": "string", // Optional value for the WITH clause
"fields": ["string"] // Optional fields for SNIPPET clause
}],
"updateable": boolean, // Optional return only updateable records
"viewable": boolean // Optional return only viewable records
}
Use Cases:
- Developers: Find records across multiple objects for integration testing
- Publishers: Gather comprehensive data examples across the platform
8. salesforce_read_apex​
Description: Read Apex classes from Salesforce.
Schema:
{
"className": "string", // Optional name of a specific Apex class to read
"namePattern": "string", // Optional pattern to match Apex class names
"includeMetadata": boolean // Optional whether to include metadata about the Apex classes
}
Use Cases:
- Developers: Review existing code for debugging or enhancement
- Publishers: Extract code examples for documentation
9. salesforce_write_apex​
Description: Create or update Apex classes in Salesforce.
Schema:
{
"operation": "string", // "create" or "update"
"className": "string", // Name of the Apex class to create or update
"apiVersion": "string", // Optional API version for the Apex class
"body": "string" // Full body of the Apex class
}
Use Cases:
- Developers: Deploy code changes or create new classes
- Publishers: Create example implementations for tutorials