Skip to main content

Salesforce MCP Server that provides API integration tools through the Model Context Protocol

Project description

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 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. You will need Salesforce OAuth2 credentials:
    • For OAuth 2.0 Client Credentials Flow: Client ID, Client Secret, and Instance URL

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
    }
  ],
  "servers": {
    "salesforce": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "SALESFORCE_CLIENT_ID",
        "-e", "SALESFORCE_CLIENT_SECRET",
        "-e", "SALESFORCE_USERNAME",
        "-e", "SALESFORCE_PASSWORD",
        "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}"
      }
    }
  }
}

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

Usage with Claude Desktop

Add the following to your claude_desktop_config.json:

For OAuth 2.0 Client Credentials Flow:

{
  "mcpServers": {
    "salesforce": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SALESFORCE_CONNECTION_TYPE=OAuth_2.0_Client_Credentials",
        "-e",
        "SALESFORCE_CLIENT_ID",
        "-e",
        "SALESFORCE_CLIENT_SECRET",
        "-e",
        "SALESFORCE_INSTANCE_URL",
        "ghcr.io/yourusername/salesforce-mcp-server"
      ],
      "env": {
        "SALESFORCE_CONNECTION_TYPE": "OAuth_2.0_Client_Credentials",
        "SALESFORCE_CLIENT_ID": "your_client_id",
        "SALESFORCE_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Tools

Tool Name Description Parameters
search_objects Search for standard and custom objects by partial name matches query: The search string for object names
describe_object Get detailed schema information for a Salesforce object objectName: The API name of the object
describe_object_with_api Get extended object metadata using direct REST API calls objectName: The API name of the object, raw: (Optional) Return raw JSON
describe_relationship_fields Explore parent-child relationships between objects objectName: The API name of the object
query_records Query records with support for relationships and filters object: Object to query, fields: Fields to return, where: (Optional) WHERE conditions, limit: (Optional) Number of records to return
get_fields_by_type Find fields of specific data types in an object objectName: The API name of the object, fieldType: Data type to filter by
get_picklist_values Retrieve all values for a picklist field objectName: The API name of the object, fieldName: The picklist field name
get_validation_rules Get details about validation rules on an object objectName: The API name of the object
manage_debug_logs Configure and retrieve debug logs for users action: 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

mcp-server-demo/
├── 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

salesforce_mcp_server_h-0.1.1.tar.gz (47.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

salesforce_mcp_server_h-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file salesforce_mcp_server_h-0.1.1.tar.gz.

File metadata

File hashes

Hashes for salesforce_mcp_server_h-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f3972ab4c0d039f747e1b425f91a5ab89de0acdf95637769880721dd34eff02d
MD5 7957c1e25e7a4a32c0c12bd9594fac5e
BLAKE2b-256 0238a4f0569ae4314bc0cac1806f728d6d57e1ed79c379635368e5c4fbf876fe

See more details on using hashes here.

File details

Details for the file salesforce_mcp_server_h-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for salesforce_mcp_server_h-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f9f42e90dd52e1d6df018726f02cf67aea90b98dd1ed280157ac765fb1411f6
MD5 87f6a1236c491d5c4d09c3ef3a16d776
BLAKE2b-256 4373f488af30764c8c740138941515d272dfc7da88c0c35eb18cd79804f95e53

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page