Salesforce MCP 服务器是一款借助自然语言处理(NLP)技术,实现与 Salesforce 数据交互的工具。它提供了智能对象搜索、架构信息检索、数据查询等一系列实用功能,能有效提升与 Salesforce 数据交互的效率。
要使用 Salesforce MCP 服务器,需先满足以下先决条件,再根据自身需求选择合适的安装与配置方式。
git clone https://github.com/your-username/salesforce-mcp-server.git
cd salesforce-mcp-server
docker-compose up --build
pip install -r requirements.txt
python server.py
# 搜索与 Account 相关的对象
search_objects("Account")
# 显示处理客户关系的对象
search_objects("Customer Service")
# 列出订单管理可用的对象
search_objects("Order Management")
# 获取 Account 对象的字段
describe_object("Account")
# 展示 Case 状态的下拉值
describe_picklist_values("Case", "Status")
# 查看 Opportunity 的关系字段
describe_relationship_fields("Opportunity")
# 检索本月创建的所有 Account 记录
query_records("Account", ["Id", "Name", "Industry"],
where="createdDate >= LAST_N_DAYS:30",
limit=10)
# 显示高优先级的 Case 及其相关 Contact
query_records("Case", ["Id", "Subject", "Priority", "ContactId"],
where="Priority = 'High'",
fields=["Account.Name"])
# 列出 Lead 对象上的所有下拉字段
get_fields_by_type("Lead", "Picklist")
# 获取 Opportunity 上的所有引用字段
get_fields_by_type("Opportunity", "Lookup")
# 查找 Account 对象上所有必填字段
get_fields_by_type("Account", "Required")
# 启用特定用户的调试日志
manage_debug_logs(action="enable", user_id="user@example.com")
# 检索管理员用户的最近日志
manage_debug_logs(action="retrieve", user_id="admin@company.com")
# 禁用指定用户的所有日志记录
manage_debug_logs(action="disable", user_id="developer@organization.com")
# 展示 Opportunity 对象上的所有验证规则
get_validation_rules("Opportunity")
# 了解 Account 对象的约束条件
get_validation_rules("Account")
# 列出自定义对象的所有验证规则
get_validation_rules("Custom_Object__c")
salesforce-mcp-server/
├── server.py # 主服务器文件
├── config.py # 配置管理模块
├── routes/ # 路由定义和处理函数
│ ├── objects.py # 对象相关路由
│ └── queries.py # 查询相关路由
└── utils/ # 工具函数库
├── decorators.py # 请求处理装饰器
├── auth.py # 认证模块
└── db_connection.py # 数据库连接池管理
pip install -r requirements.txt
.env 文件中添加以下内容:SALESFORCE_USERNAME=your_username@example.com
SALESFORCE_PASSWORD=your_password
SALESFORCE_SECURITY_TOKEN=your_token
python server.py --mode debug
routes/ 目录下添加新的 Python 文件,继承自 BaseRoute 类。pytest tests/
欢迎社区贡献!请遵循以下步骤:
git checkout -b feature/your-feature-namegit add . && git commit -m '你的提交信息'git push origin feature/your-feature-name本项目遵循 MIT 许可证。查看 LICENSE 文件获取详细信息。
如有任何问题,请通过以下方式联系: