mcpField
S
Salesforce MCP Server

Salesforce MCP Server

本地服务
github.com/SurajAdsul数据与分析1585 周前更新

关于 Salesforce MCP Server

通过自然语言检查和管理 Salesforce 数据及元数据的 MCP 服务,支持架构发现、记录操作和跨对象搜索。

主要功能

  1. 01搜索 Salesforce 对象
  2. 02查看字段与关系
  3. 03按条件查询记录
  4. 04插入、更新、删除和上插记录
  5. 05使用 SOSL 跨对象搜索
  6. 06创建和修改自定义对象与字段

适用场景

  1. 01查找对象并检查其架构
  2. 02按条件获取关联记录
  3. 03在工作流中更新 Salesforce 记录
  4. 04搜索多个对象中的匹配内容

MCP 相关

向 MCP 客户端提供 Salesforce 对象、架构、查询、记录管理和 SOSL 搜索能力。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"salesforce-surajadsul": {
"command": "npx",
"args": [
"-y",
"@surajadsul02/mcp-server-salesforce"
],
"env": {
"SALESFORCE_USERNAME": "<SALESFORCE_USERNAME>",
"SALESFORCE_PASSWORD": "<SALESFORCE_PASSWORD>",
"SALESFORCE_TOKEN": "<SALESFORCE_TOKEN>",
"SALESFORCE_INSTANCE_URL": "<SALESFORCE_INSTANCE_URL>"
}
}
}
}
启动命令npx -y @surajadsul02/mcp-server-salesforce
需要配置的环境变量
SALESFORCE_USERNAME
SALESFORCE_PASSWORD密钥
SALESFORCE_TOKEN密钥
SALESFORCE_INSTANCE_URL

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@surajadsul02/mcp-server-salesforce

工具

7

收录的工具列表 · 更新于 3 周前

参数类型必填说明
searchPatternstring是用于查找对象的搜索模式(例如,'Account Coverage' 将找到类似 'AccountCoverage__c' 的对象)

详细介绍

Salesforce MCP Server

一个将 Claude 与 Salesforce 集成的 MCP(Model Context Protocol)服务实现,让你能够通过自然语言与 Salesforce 数据和元数据交互。此服务支持 Claude 使用日常语言查询、修改和管理 Salesforce 对象与记录。

Salesforce Server MCP 服务

功能

  • 对象和字段管理:使用自然语言创建和修改自定义对象及字段
  • 智能对象搜索:通过部分名称匹配查找 Salesforce 对象
  • 详细架构信息:获取任意对象的完整字段和关系详情
  • 灵活的数据查询:支持关系和复杂筛选条件的记录查询
  • 数据操作:轻松插入、更新、删除和更新插入记录
  • 跨对象搜索:使用 SOSL 跨多个对象搜索
  • 直观的错误处理:提供清晰的反馈以及 Salesforce 专属错误详情

安装

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

设置

Salesforce 身份验证

你可以通过以下两种方式之一进行 Salesforce 身份验证:

1. 用户名/密码身份验证
  1. 设置 Salesforce 凭据
  2. 获取安全令牌(在 Salesforce 设置中重置)
  3. 按照配置部分中的说明设置环境变量
2. 使用 Consumer Key/Secret 进行 OAuth2 身份验证
  1. 在 Salesforce 中设置 Connected App
  2. 获取 Consumer Key 和 Consumer Secret
  3. 按照配置部分中的说明设置环境变量
IDE 集成
Cursor IDE 设置
  1. 全局安装软件包:
npm install -g @surajadsul02/mcp-server-salesforce
  1. 在 Cursor IDE 的 .cursor/mcp.json 中配置 MCP 服务:
使用 env 命令
{
  "mcpServers": {
    "salesforce": {
      "command": "env",
      "args": [
        "[email protected]",
        "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": [
        "[email protected]",
        "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 Desktop 设置
  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:Connected App 的 Consumer Key
  • SALESFORCE_CONSUMER_SECRET:Connected App 的 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
    • 在开发者工具(Help > Toggle Developer Tools)中查看错误消息
    • 确认已全局安装该软件包
  4. Claude Desktop 集成

    • 确认配置文件的位置
    • 检查文件权限
    • 配置更改后重启 Claude Desktop
    • 确保已正确设置环境变量

贡献

欢迎贡献!欢迎提交 Pull Request。

许可证

本项目采用 MIT 许可证授权,详情请参阅 LICENSE 文件。

问题与支持

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

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。