Skip to main content
Glama
Salesforce MCP Server

Salesforce MCP Server

by usama-dtc

Salesforce MCP 服务器

一个 MCP(模型上下文协议)服务器实现,将 Claude 与 Salesforce 集成,从而实现与 Salesforce 数据和元数据的自然语言交互。此服务器允许 Claude 使用日常语言查询、修改和管理您的 Salesforce 对象和记录。

特征

  • 对象和字段管理:使用自然语言创建和修改自定义对象和字段

  • 智能对象搜索:使用部分名称匹配查找 Salesforce 对象

  • 详细架构信息:获取任何对象的全面字段和关系详细信息

  • 灵活的数据查询:使用关系支持和复杂过滤器查询记录

  • 数据操作:轻松插入、更新、删除和插入记录

  • 跨对象搜索:使用 SOSL 跨多个对象进行搜索

  • 直观的错误处理:使用 Salesforce 特定的错误详细信息提供清晰的反馈

Related MCP server: Salesforce MCP Server

安装

npm install -g @surajadsul02/mcp-server-salesforce

设置

Salesforce 身份验证

您可以使用以下两种方法之一向 Salesforce 进行身份验证:

1.用户名/密码验证

  1. 设置您的 Salesforce 凭据

  2. 获取您的安全令牌(从 Salesforce 设置重置)

  3. 按照配置部分所示配置环境变量

2. 使用消费者密钥/秘密进行 OAuth2 身份验证

  1. 在 Salesforce 中设置连接的应用程序

  2. 获取消费者密钥和消费者秘密

  3. 按照配置部分所示配置环境变量

IDE 集成

光标 IDE 设置

  1. 全局安装包:

npm install -g @surajadsul02/mcp-server-salesforce
  1. 在 Cursor IDE .cursor/mcp.json中配置 MCP 服务器:

使用 env 命令
{
  "mcpServers": {
    "salesforce": {
      "command": "env",
      "args": [
        "SALESFORCE_USERNAME=your.actual.email@example.com",
        "SALESFORCE_PASSWORD=YourActualPassword123",
        "SALESFORCE_TOKEN=YourActualSecurityToken123",
        "SALESFORCE_INSTANCE_URL=https://login.salesforce.com",
        "npx",
        "-y",
        "@surajadsul02/mcp-server-salesforce"
      ]
    }
  }
}
用于 Cursor 中的 OAuth2 身份验证
{
  "mcpServers": {
    "salesforce": {
      "command": "env",
      "args": [
        "SALESFORCE_USERNAME=your.actual.email@example.com",
        "SALESFORCE_PASSWORD=YourActualPassword123",
        "SALESFORCE_TOKEN=YourActualSecurityToken123",
        "SALESFORCE_INSTANCE_URL=https://login.salesforce.com",
        "SALESFORCE_CONSUMER_KEY=YourConsumerKey",
        "SALESFORCE_CONSUMER_SECRET=YourConsumerSecret",
        "npx",
        "-y",
        "@surajadsul02/mcp-server-salesforce"
      ]
    }
  }
}

Claude 桌面设置

  1. 全局安装包(如果尚未安装):

npm install -g @surajadsul02/mcp-server-salesforce
  1. 添加到您的claude_desktop_config.json :

用于用户名/密码验证
{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": ["-y", "@surajadsul02/mcp-server-salesforce"],
      "env": {
        "SALESFORCE_USERNAME": "your_username",
        "SALESFORCE_PASSWORD": "your_password",
        "SALESFORCE_TOKEN": "your_security_token",
        "SALESFORCE_INSTANCE_URL": "https://login.salesforce.com"
      }
    }
  }
}
对于 OAuth2 身份验证
{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": ["-y", "@surajadsul02/mcp-server-salesforce"],
      "env": {
        "SALESFORCE_USERNAME": "your_username",
        "SALESFORCE_PASSWORD": "your_password",
        "SALESFORCE_CONSUMER_KEY": "your_consumer_key",
        "SALESFORCE_CONSUMER_SECRET": "your_consumer_secret",
        "SALESFORCE_INSTANCE_URL": "https://login.salesforce.com"
      }
    }
  }
}
  1. 配置文件位置:

    • macOS: ~/Library/Application Support/Claude Desktop/claude_desktop_config.json

    • Windows: %APPDATA%\Claude Desktop\claude_desktop_config.json

    • Linux: ~/.config/Claude Desktop/claude_desktop_config.json

必需的环境变量

对于用户名/密码验证:

  • SALESFORCE_USERNAME :您的 Salesforce 用户名/电子邮件

  • SALESFORCE_PASSWORD :您的 Salesforce 密码

  • SALESFORCE_TOKEN :您的 Salesforce 安全令牌

  • SALESFORCE_INSTANCE_URL :您的 Salesforce 实例 URL(可选,默认值: https://login.salesforce.com )

对于 OAuth2 身份验证:

  • SALESFORCE_USERNAME :您的 Salesforce 用户名/电子邮件

  • SALESFORCE_PASSWORD :您的 Salesforce 密码

  • SALESFORCE_CONSUMER_KEY :您连接的应用程序的消费者密钥

  • SALESFORCE_CONSUMER_SECRET :您连接的应用程序的消费者秘密

  • SALESFORCE_INSTANCE_URL :您的 Salesforce 实例 URL(可选,默认值: https://login.salesforce.com )

示例用法

搜索对象

"Find all objects related to Accounts"
"Show me objects that handle customer service"
"What objects are available for order management?"

获取架构信息

"What fields are available in the Account object?"
"Show me the picklist values for Case Status"
"Describe the relationship fields in Opportunity"

查询记录

"Get all Accounts created this month"
"Show me high-priority Cases with their related Contacts"
"Find all Opportunities over $100k"

管理自定义对象

"Create a Customer Feedback object"
"Add a Rating field to the Feedback object"
"Update sharing settings for the Service Request object"

跨对象搜索

"Search for 'cloud' in Accounts and Opportunities"
"Find mentions of 'network issue' in Cases and Knowledge Articles"
"Search for customer name across all relevant objects"

发展

从源代码构建

# Clone the repository
git clone https://github.com/surajadsul02/mcp-server-salesforce.git

# Navigate to directory
cd mcp-server-salesforce

# Install dependencies
npm install

# Build the project
npm run build

故障排除

  1. 身份验证错误

    • 验证您的凭证是否正确

    • 对于用户名/密码验证:确保安全令牌正确

    • 对于 OAuth2:验证消费者密钥和秘密

  2. 连接问题

    • 检查您的 Salesforce 实例 URL

    • 验证网络连接

    • 确保正确的 API 访问权限

  3. Cursor IDE 集成

    • 配置更改后重新启动 Cursor IDE

    • 检查开发者工具(帮助 > 切换开发者工具)中的错误消息

    • 验证软件包是否已全局安装

  4. Claude 桌面集成

    • 验证配置文件位置

    • 检查文件权限

    • 配置更改后重新启动 Claude Desktop

    • 确保环境变量设置正确

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

问题与支持

如果您遇到任何问题或需要支持,请在 GitHub 存储库上提交问题。

Available Tools

8 tools
salesforce_describe_objectA

Get detailed schema metadata including all fields, relationships, and field properties of any Salesforce object. Examples: 'Account' shows all Account fields including custom fields; 'Case' shows all Case fields including relationships to Account, Contact etc.

NameRequiredDescriptionDefault
objectNameYesAPI name of the object (e.g., 'Account', 'Contact', 'Custom_Object__c')
salesforce_dml_recordsA

Perform data manipulation operations on Salesforce records:

  • insert: Create new records

  • update: Modify existing records (requires Id)

  • delete: Remove records (requires Id)

  • upsert: Insert or update based on external ID field Examples: Insert new Accounts, Update Case status, Delete old records, Upsert based on custom external ID

NameRequiredDescriptionDefault
operationYesType of DML operation to perform
objectNameYesAPI name of the object
recordsYesArray of records to process
externalIdFieldNoExternal ID field name for upsert operations
salesforce_manage_fieldA

Create new custom fields or modify existing fields on any Salesforce object:

  • Field Types: Text, Number, Date, Lookup, Master-Detail, Picklist etc.

  • Properties: Required, Unique, External ID, Length, Scale etc.

  • Relationships: Create lookups and master-detail relationships Examples: Add Rating__c picklist to Account, Create Account lookup on Custom Object Note: Changes affect metadata and require proper permissions

NameRequiredDescriptionDefault
operationYesWhether to create new field or update existing
objectNameYesAPI name of the object to add/modify the field
fieldNameYesAPI name for the field (without __c suffix)
labelNoLabel for the field
typeNoField type (required for create)
requiredNoWhether the field is required
uniqueNoWhether the field value must be unique
externalIdNoWhether the field is an external ID
lengthNoLength for text fields
precisionNoPrecision for numeric fields
scaleNoScale for numeric fields
referenceToNoAPI name of the object to reference (for Lookup/MasterDetail)
relationshipLabelNoLabel for the relationship (for Lookup/MasterDetail)
relationshipNameNoAPI name for the relationship (for Lookup/MasterDetail)
deleteConstraintNoDelete constraint for Lookup fields
picklistValuesNoValues for Picklist/MultiselectPicklist fields
descriptionNoDescription of the field
salesforce_manage_objectA

Create new custom objects or modify existing ones in Salesforce:

  • Create: New custom objects with fields, relationships, and settings

  • Update: Modify existing object settings, labels, sharing model Examples: Create Customer_Feedback__c object, Update object sharing settings Note: Changes affect metadata and require proper permissions

NameRequiredDescriptionDefault
operationYesWhether to create new object or update existing
objectNameYesAPI name for the object (without __c suffix)
labelNoLabel for the object
pluralLabelNoPlural label for the object
descriptionNoDescription of the object
nameFieldLabelNoLabel for the name field
nameFieldTypeNoType of the name field
nameFieldFormatNoDisplay format for AutoNumber field (e.g., 'A-{0000}')
sharingModelNoSharing model for the object
salesforce_query_recordsA

Query records from any Salesforce object using SOQL, including relationship queries.

Examples:

  1. Parent-to-child query (e.g., Account with Contacts):

    • objectName: "Account"

    • fields: ["Name", "(SELECT Id, FirstName, LastName FROM Contacts)"]

  2. Child-to-parent query (e.g., Contact with Account details):

    • objectName: "Contact"

    • fields: ["FirstName", "LastName", "Account.Name", "Account.Industry"]

  3. Multiple level query (e.g., Contact -> Account -> Owner):

    • objectName: "Contact"

    • fields: ["Name", "Account.Name", "Account.Owner.Name"]

  4. Related object filtering:

    • objectName: "Contact"

    • fields: ["Name", "Account.Name"]

    • whereClause: "Account.Industry = 'Technology'"

Note: When using relationship fields:

  • Use dot notation for parent relationships (e.g., "Account.Name")

  • Use subqueries in parentheses for child relationships (e.g., "(SELECT Id FROM Contacts)")

  • Custom relationship fields end in "__r" (e.g., "CustomObject__r.Name")

NameRequiredDescriptionDefault
objectNameYesAPI name of the object to query
fieldsYesList of fields to retrieve, including relationship fields
whereClauseNoWHERE clause, can include conditions on related objects
orderByNoORDER BY clause, can include fields from related objects
limitNoMaximum number of records to return
salesforce_search_allA

Search across multiple Salesforce objects using SOSL (Salesforce Object Search Language).

Examples:

  1. Basic search across all objects: { "searchTerm": "John", "objects": [ { "name": "Account", "fields": ["Name"], "limit": 10 }, { "name": "Contact", "fields": ["FirstName", "LastName", "Email"] } ] }

  2. Advanced search with filters: { "searchTerm": "Cloud*", "searchIn": "NAME FIELDS", "objects": [ { "name": "Account", "fields": ["Name", "Industry"], "orderBy": "Name DESC", "where": "Industry = 'Technology'" } ], "withClauses": [ { "type": "NETWORK", "value": "ALL NETWORKS" }, { "type": "SNIPPET", "fields": ["Description"] } ] }

Notes:

  • Use * and ? for wildcards in search terms

  • Each object can have its own WHERE, ORDER BY, and LIMIT clauses

  • Support for WITH clauses: DATA CATEGORY, DIVISION, METADATA, NETWORK, PRICEBOOKID, SNIPPET, SECURITY_ENFORCED

  • "updateable" and "viewable" options control record access filtering

NameRequiredDescriptionDefault
searchTermYesText to search for (supports wildcards * and ?)
searchInNoWhich fields to search in
objectsYesList of objects to search and their return fields
withClausesNoAdditional WITH clauses for the search
updateableNoReturn only updateable records
viewableNoReturn only viewable records
salesforce_search_objectsA

Search for Salesforce standard and custom objects by name pattern. Examples: 'Account' will find Account, AccountHistory; 'Order' will find WorkOrder, ServiceOrder__c etc.

NameRequiredDescriptionDefault
searchPatternYesSearch pattern to find objects (e.g., 'Account Coverage' will find objects like 'AccountCoverage__c')
salesforce_upload_report_xmlA

Upload XML to generate or update reports in Salesforce.

Examples:

  1. Create a new report:

    • reportName: "Monthly Sales Summary"

    • folderId: "00l5e000000XXXXX" (optional - uploads to user's private reports by default)

    • xmlContent: "<Report xmlns=..."

    • isDeveloperName: false

  2. Update existing report:

    • reportId: "00O5e000000XXXXX"

    • xmlContent: "<Report xmlns=..."

Note: XML must follow Salesforce report metadata format. For custom report types, ensure the report type exists in your org before uploading.

NameRequiredDescriptionDefault
reportNameNoName for the new report (required for new reports)
reportIdNoReport ID to update an existing report
folderIdNoFolder ID where the report should be saved (optional)
xmlContentYesXML content for the report in Salesforce report metadata format
isDeveloperNameNoIf true, reportName is treated as the API name instead of the display name

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 8 tool updates
    • First observedsalesforce_describe_object
    • First observedsalesforce_dml_records
    • First observedsalesforce_manage_field
    • First observedsalesforce_manage_object
    • First observedsalesforce_query_records
    • First observedsalesforce_search_all
    • First observedsalesforce_search_objects
    • First observedsalesforce_upload_report_xml

TDQS

A4/5.0

Scored across 8 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: describe_object for metadata, dml_records for data manipulation, manage_field/object for schema changes, query_records for SOQL queries, search_all for SOSL searches, search_objects for object discovery, and upload_report_xml for report management. The descriptions reinforce these boundaries, making tool selection unambiguous.

Naming Consistency5/5

All tools follow a consistent snake_case pattern with a 'salesforce_' prefix and descriptive verb_noun combinations (e.g., salesforce_describe_object, salesforce_query_records). This uniformity makes the tool set predictable and easy to navigate, with no deviations in naming style.

Tool Count5/5

With 8 tools, the server is well-scoped for Salesforce operations, covering key areas like data access, metadata management, and reporting. Each tool serves a specific, non-redundant function, making the count appropriate for the domain without being overwhelming or insufficient.

Completeness4/5

The tool set provides comprehensive coverage for core Salesforce workflows, including CRUD operations, schema management, querying, and reporting. A minor gap exists in lacking a dedicated tool for handling Salesforce-specific features like Apex code or flows, but agents can work around this using existing tools for most common tasks.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    An MCP server implementation that integrates Claude with Salesforce, enabling natural language interactions with Salesforce data and metadata for querying, modifying, and managing objects and records.
    15
    2,670 npm
    164
    MIT
  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    An MCP server implementation that integrates Claude/VS Code with Salesforce, enabling natural language interactions with your Salesforce data and metadata.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides comprehensive access to Salesforce Tooling API for metadata management, SOQL queries, code analysis, and debugging through Claude and other AI assistants.
    84 npm
    5
    MIT