@acquis-consulting/acquis-salesforce-mcp
v1.0.5
Published
Salesforce MCP Server - Exposes Salesforce operations as tools to AI assistants
Readme
Salesforce MCP Server
An MCP (Model Context Protocol) server implementation that integrates Claude with Salesforce, enabling natural language interactions with your Salesforce data and metadata. This server allows Claude to query, modify, and manage your Salesforce objects and records using everyday language.
Features
- Object and Field Management: Create and modify custom objects and fields using natural language
- Smart Object Search: Find Salesforce objects using partial name matches
- Detailed Schema Information: Get comprehensive field and relationship details for any object
- Flexible Data Queries: Query records with relationship support, complex filters, and aggregate functions
- Data Manipulation: Insert, update, delete, and upsert records with ease
- Cross-Object Search: Search across multiple objects using SOSL
- Apex Code Management: Read, create, and update Apex classes and triggers
- Anonymous Apex Execution: Run Apex code on-the-fly with debug log support
- Debug Log Management: Enable, disable, and retrieve debug logs per user
- Metadata Exploration: Discover, list, read, and write metadata definitions (validation rules, flows, custom labels, etc.)
- Tooling API Access: Query metadata objects like validation rules, flows, and Lightning components
- Field Level Security: Grant, revoke, and view field permissions per profile
- Intuitive Error Handling: Clear feedback with Salesforce-specific error details
- Switchable Authentication: Supports username/password, OAuth 2.0 client credentials, and Salesforce CLI authentication
Tools
salesforce_search_objects
Search for standard and custom objects:
- Search by partial name matches
- Finds both standard and custom objects
- Example: "Find objects related to Account" will find Account, AccountHistory, etc.
salesforce_describe_object
Get detailed object schema information:
- Field definitions and properties
- Relationship details
- Picklist values
- Example: "Show me all fields in the Account object"
salesforce_query_records
Query records with relationship support:
- Parent-to-child subqueries
- Child-to-parent dot notation
- Complex WHERE conditions
- Example: "Get all Accounts with their related Contacts"
- Note: For queries with GROUP BY or aggregate functions, use salesforce_aggregate_query
salesforce_aggregate_query
Execute aggregate queries with GROUP BY:
- GROUP BY single or multiple fields
- Aggregate functions: COUNT, COUNT_DISTINCT, SUM, AVG, MIN, MAX
- HAVING clauses for filtering grouped results
- Date/time grouping functions
- Example: "Count opportunities by stage" or "Find accounts with more than 10 opportunities"
salesforce_dml
Perform data operations:
- Insert new records
- Update existing records
- Delete records
- Upsert using external IDs
- Example: "Update status of multiple accounts"
salesforce_manage_object
Create and modify custom objects:
- Create new custom objects (auto-appends
__c) - Update object properties
- Configure sharing and deployment settings
- Example: "Create a Customer Feedback object"
salesforce_manage_field
Manage object fields:
- Add new custom fields with type-specific handling
- Modify field properties
- Create relationships (Lookup, Master-Detail)
- Automatically grants Field Level Security to System Administrator by default
- Use
grantAccessToparameter to specify different profiles - Example: "Add a Rating picklist field to Account"
salesforce_manage_field_permissions
Manage Field Level Security (Field Permissions):
- Grant or revoke read/edit access to fields for specific profiles
- View current field permissions
- Bulk update permissions for multiple profiles
- Example: "Grant System Administrator access to Custom_Field__c on Account"
salesforce_search
Search across multiple objects using SOSL:
- Per-object WHERE, ORDER BY, and LIMIT clauses
- WITH clauses: SNIPPET, DATA CATEGORY, METADATA, SECURITY_ENFORCED
- Wildcard support and configurable search scopes
- Example: "Search for 'cloud' in Accounts and Opportunities"
salesforce_read_apex_class
Read Apex classes:
- Get full source code of specific classes
- List classes matching name patterns (supports wildcards)
- View class metadata (API version, status, etc.)
- Example: "Show me the AccountController class" or "Find all classes matching Account*"
salesforce_write_apex_class
Create and update Apex classes:
- Create new Apex classes via Tooling API
- Update existing class implementations
- Validates class/interface/enum definitions
- Example: "Create a new Apex utility class for handling date operations"
salesforce_read_apex_trigger
Read Apex triggers:
- Get full source code of specific triggers
- List triggers matching name patterns
- View trigger metadata including associated object
- Example: "Show me the AccountTrigger" or "Find all triggers for Contact object"
salesforce_write_apex_trigger
Create and update Apex triggers:
- Create new Apex triggers for specific objects via Tooling API
- Update existing trigger implementations
- Validates trigger definitions and object associations
- Example: "Create a new trigger for the Opportunity object"
salesforce_execute_anonymous
Execute anonymous Apex code:
- Run Apex code without creating a permanent class
- View compilation and execution results with line/column errors
- Automatic debug log retrieval post-execution
- Configurable log levels
- Example: "Execute Apex code to calculate account metrics"
salesforce_debug_logs
Manage debug logs for Salesforce users:
- Enable debug logs with custom log levels and expiration
- Disable active debug log configurations
- Retrieve and view recent debug logs
- Smart user lookup by email or name
- Log levels: NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST
- Example: "Enable debug logs for [email protected]"
salesforce_list_metadata_types
Discover all metadata types available in your Salesforce org:
- Lists every metadata type (CustomObject, ValidationRule, Flow, ApexClass, etc.)
- Shows child types and folder requirements for each type
- Essential starting point for org analysis
- Example: "What metadata types are available in this org?"
salesforce_list_metadata
List metadata components of a given type:
- Discover all validation rules, flows, approval processes, custom labels, triggers, and more
- Returns summary info (fullName, id, created/modified dates) for every component
- Supports folder-based types (Report, Dashboard, EmailTemplate) via folder parameter
- Example: "List all validation rules" or "Show me all flows in the org"
salesforce_read_metadata
Read full metadata definitions for specific components:
- Retrieve complete definitions including formulas, logic, field mappings, and configurations
- Specify components by their full API names (e.g. "Account.My_Rule")
- Automatically batches large requests to handle orgs with hundreds of components
- Example: "Read the full definition of the Account.VR_HCS_or_GPO validation rule"
salesforce_metadata_import
Create, update, or upsert Salesforce metadata components:
- Supports create, update, and upsert operations
- Works with any metadata type (CustomObject, ValidationRule, Flow, CustomLabel, etc.)
- Batch support for multiple components in a single call
- Use
salesforce_get_metadata_type_schemafirst to understand the required payload structure - Example: "Create a new custom label" or "Update a validation rule definition"
salesforce_tooling_query
Query Salesforce Tooling API objects using SOQL:
- Access metadata objects not available through the standard API
- Query validation rules, flow definitions, workflow rules
- Query Apex classes, triggers, Visualforce pages, Lightning components
- Example: "Get all validation rules for the Account object"
Setup
Salesforce Authentication
You can connect to Salesforce using one of three authentication methods:
1. Username/Password Authentication (Default)
- Set up your Salesforce credentials
- Get your security token (Reset from Salesforce Settings)
2. OAuth 2.0 Client Credentials Flow
- Create a Connected App in Salesforce
- Enable OAuth settings and select "Client Credentials Flow"
- Set appropriate scopes (typically "api" is sufficient)
- Save the Client ID and Client Secret
- Important: Note your instance URL (e.g.,
https://your-domain.my.salesforce.com) as it's required for authentication
3. Salesforce CLI Authentication (Recommended for local/dev)
- Install and authenticate Salesforce CLI (
sf) - Make sure your org is authenticated and accessible via
sf org display --json - The server will automatically retrieve the access token and instance URL using the CLI
Usage with Claude Desktop
Add to your claude_desktop_config.json:
For Salesforce CLI Authentication:
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": ["-y", "acquis-salesforce-mcp"],
"env": {
"SALESFORCE_CONNECTION_TYPE": "sfdx_cli"
}
}
}
}For Username/Password Authentication:
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": ["-y", "acquis-salesforce-mcp"],
"env": {
"SALESFORCE_CONNECTION_TYPE": "username_password",
"SALESFORCE_USERNAME": "your_username",
"SALESFORCE_PASSWORD": "your_password",
"SALESFORCE_TOKEN": "your_security_token",
"SALESFORCE_INSTANCE_URL": "https://login.salesforce.com"
}
}
}
}For OAuth 2.0 Client Credentials Flow:
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": ["-y", "acquis-salesforce-mcp"],
"env": {
"SALESFORCE_CONNECTION_TYPE": "oauth2_client_credentials",
"SALESFORCE_CLIENT_ID": "your_client_id",
"SALESFORCE_CLIENT_SECRET": "your_client_secret",
"SALESFORCE_INSTANCE_URL": "https://your-domain.my.salesforce.com"
}
}
}
}Run locally using Claude Desktop:
{
"mcpServers": {
"salesforce": {
"command": "node",
"args": ["/path-to-repo/acquis-salesforce-mcp/dist/index.js"],
"env": {
"SALESFORCE_CONNECTION_TYPE": "sfdx_cli"
}
}
}
}Note: For OAuth 2.0 Client Credentials Flow, the
SALESFORCE_INSTANCE_URLmust be your exact Salesforce instance URL (e.g.,https://your-domain.my.salesforce.com). The token endpoint will be constructed as<instance_url>/services/oauth2/token.
Example Usage
Searching Objects
"Find all objects related to Accounts"
"Show me objects that handle customer service"
"What objects are available for order management?"Getting Schema Information
"What fields are available in the Account object?"
"Show me the picklist values for Case Status"
"Describe the relationship fields in Opportunity"Querying Records
"Get all Accounts created this month"
"Show me high-priority Cases with their related Contacts"
"Find all Opportunities over $100k"Aggregate Queries
"Count opportunities by stage"
"Show me the total revenue by account"
"Find accounts with more than 10 opportunities"
"Calculate average deal size by sales rep and quarter"Managing Custom Objects and Fields
"Create a Customer Feedback object"
"Add a Rating field to the Feedback object"
"Create a Status picklist field on Custom_Object__c"
"Create a Revenue currency field on Account and grant access to Sales User profile"Managing Field Permissions
"Grant System Administrator access to Custom_Field__c on Account"
"Give read-only access to Rating__c field for Sales User profile"
"View which profiles have access to the Custom_Field__c"Searching Across Objects
"Search for 'cloud' in Accounts and Opportunities"
"Find mentions of 'network issue' in Cases and Knowledge Articles"Managing Apex Code
"Show me all Apex classes with 'Controller' in the name"
"Get the full code for the AccountService class"
"Create a new Apex utility class for handling date operations"
"Update the LeadConverter class to add a new method"Managing Apex Triggers
"List all triggers for the Account object"
"Show me the code for the ContactTrigger"
"Create a new trigger for the Opportunity object"Executing Anonymous Apex
"Execute Apex code to calculate account metrics"
"Run a script to update related records"Managing Debug Logs
"Enable debug logs for [email protected]"
"Retrieve recent logs for an admin user"
"Disable debug logs for a specific user"Exploring Metadata
"What metadata types are available in this org?"
"List all validation rules in the org"
"Show me all flows"
"Read the full definition of Account validation rules"
"List all custom labels"Writing Metadata
"Create a new custom label called WelcomeMessage"
"Update the validation rule formula on Account"
"Upsert a set of custom labels"Querying Tooling API
"Get all validation rules for the Account object"
"Find all active flow definitions"
"Show me Apex classes modified today"
"List all Lightning Web Components"Development
Building from Source
# Clone the repository
git clone https://github.com/mkona-acquis/acquis-salesforce-mcp.git
cd acquis-salesforce-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Watch mode for development
npm run watch