Sponsored by Deepsite.site

Salesforce MCP Server

Created By
suraj200288 months ago
MCP Server for Salesforce Operations
Content

Salesforce MCP Server

An MCP (Model Context Protocol) server implementation that integrates Claude/VS Code with Salesforce, enabling natural language interactions with your Salesforce data and metadata. This server allows Claude/Github Copilot to query, modify, and manage your Salesforce objects and records using everyday language.

Features

  • 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 and complex filters
  • Picklist Value Retrieval: Get all values for any picklist field
  • Field Type Filtering: Find fields of specific types across objects
  • Relationship Exploration: Analyze parent-child relationships between objects
  • Enhanced API Metadata: Access complete object metadata through direct API calls
  • Debug Log Management: Configure and retrieve debug logs for Salesforce users
  • Validation Rules Management: Get details about validation rules on objects

Prerequisites

  1. To run the server in a container, you will need to have Docker installed.
  2. Once Docker is installed, you will also need to ensure Docker is running.
  3. Pull the image suraj20028/salesforce-mcp-server from docker hub using the command:
    docker pull suraj20028/salesforce-mcp-server
    
  4. You will need Salesforce OAuth2 credentials:
    • For OAuth 2.0 Client Credentials Flow: Client ID, Client Secret, and Instance URL
  5. As this Project will use OAuth2 auth method, make sure the following are done:

Enable the client credentials flow for your connected app. Under API (Enable OAuth Settings), select Enable Client Credentials Flow. Select an execution user for the flow under Manage Connected Apps

Installation

Usage with VS Code

For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P (or Cmd + Shift + P on macOS) and typing Preferences: Open User Settings (JSON).

Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.

Note that the mcp key is not needed in the .vscode/mcp.json file.

"mcp": {
  "inputs": [
    {
      "type": "promptString",
      "id": "client_id",
      "description": "Salesforce Client ID",
      "password": false
    },
    {
      "type": "promptString",
      "id": "client_secret",
      "description": "Salesforce Client Secret",
      "password": false
    },
    {
      "type": "promptString",
      "id": "username",
      "description": "Salesforce Username",
      "password": false
    },
    {
      "type": "promptString",
      "id": "password",
      "description": "Salesforce Password",
      "password": false
    },
    {
      "type": "promptString",
      "id": "domain_url",
      "description": "Salesforce Domain URL <https://yourdomain.my.salesforce.com> ",
      "password": false
    }
  ],
  "servers": {
    "salesforce": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "SALESFORCE_CLIENT_ID",
        "-e", "SALESFORCE_CLIENT_SECRET",
        "-e", "SALESFORCE_USERNAME",
        "-e", "SALESFORCE_PASSWORD",
        "-e", "SALESFORCE_DOMAIN_URL",
        "suraj20028/salesforce-mcp-server"
      ],
      "env": {
        "SALESFORCE_CLIENT_ID": "${input:client_id}",
        "SALESFORCE_CLIENT_SECRET": "${input:client_secret}",
        "SALESFORCE_USERNAME": "${input:username}",
        "SALESFORCE_PASSWORD": "${input:password}",
        "SALESFORCE_DOMAIN_URL": "${input:domain_url}",
      }
    }
  }
}

More about using MCP server tools in VS Code's agent mode documentation.

Tools

Tool NameDescriptionParameters
search_objectsSearch for standard and custom objects by partial name matchesquery: The search string for object names
describe_objectGet detailed schema information for a Salesforce objectobjectName: The API name of the object
describe_object_with_apiGet extended object metadata using direct REST API callsobjectName: The API name of the object, raw: (Optional) Return raw JSON
describe_relationship_fieldsExplore parent-child relationships between objectsobjectName: The API name of the object
query_recordsQuery records with support for relationships and filtersobject: Object to query, fields: Fields to return, where: (Optional) WHERE conditions, limit: (Optional) Number of records to return
get_fields_by_typeFind fields of specific data types in an objectobjectName: The API name of the object, fieldType: Data type to filter by
get_picklist_valuesRetrieve all values for a picklist fieldobjectName: The API name of the object, fieldName: The picklist field name
get_validation_rulesGet details about validation rules on an objectobjectName: The API name of the object
manage_debug_logsConfigure and retrieve debug logs for usersaction: Action to perform (enable, disable, retrieve), userId: User ID, logLevel: (Optional) Debug log level

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"

Working with Fields by Type

"Show me all picklist fields on the Lead object"
"Get all reference fields on Opportunity"
"Find all required fields on Account"

Getting Picklist Values

"What are the possible values for Lead Status?"
"Show me all Industry options for Accounts"
"List all Case Priority values"

Exploring Relationships

"Show me all relationships for the Account object"
"What objects are related to Opportunity?"
"Describe the parent-child relations for Contact"

Managing Debug Logs

"Enable debug logs for user@example.com"
"Retrieve recent logs for an admin user"
"Disable debug logs for a specific user"
"Configure log level to DEBUG for a user"

Checking Validation Rules

"Show me all validation rules on Opportunity"
"Get details about Account validation rules"
"What validation rules exist for custom objects?"

Development

Project Structure

salesforce-mcp-server/
├── server.py             # MCP server implementation
├── sf_connection.py      # Salesforce authentication
├── tools/
│   ├── __init__.py       # Tools package initialization
│   ├── search_objects.py # Object search functionality
│   ├── describe_object.py # Object schema retrieval
│   ├── query_records.py  # SOQL query functionality
│   └── ...               # Other tool modules

Adding New Tools

  1. Create a new Python file in the tools directory
  2. Implement your function with proper docstrings and error handling
  3. Import and register the function in the MCP server

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Issues and Support

If you encounter any issues or need support, please file an issue on the GitHub repository.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Amap Maps高德地图官方 MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
Playwright McpPlaywright MCP server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor
Serper MCP ServerA Serper MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
DeepChatYour AI Partner on Desktop