simple-salesforce-mcp
simple-salesforce-mcp
一个轻量级的 Salesforce MCP 服务器。它通过 stdio 直接与 Salesforce REST API 通信,仅有两个运行时依赖(mcp、httpx)——旨在作为官方 @salesforce/mcp DX 服务器的快速冷启动替代品,后者的依赖树对于沙盒环境来说过于庞大。
工具
工具 | 是否写入? | 备注 |
| 否 | 带分页( |
| 否 | 跨对象的全文搜索(参数化搜索 API) |
| 否 | 按 Id 获取单条记录,可选字段列表 |
| 是 | 创建一条记录 |
| 是,受 confirm 门控 | 必须包含字面量 |
| 是,受 confirm 门控 | 必须包含字面量 |
| 否 | 精简的对象元数据(字段、类型、必填、下拉列表) |
| 否 | 组织对象,默认过滤系统噪音 |
| 否 | 当前用户、组织、实例 URL、API 版本 |
每个工具都带有 MCP 注解(readOnlyHint / destructiveHint / idempotentHint)。
update_record 和 delete_record 拒绝执行,除非调用包含 confirm: true,
并且拒绝消息会指示模型先将确切的更改展示给用户并获得批准。
SOQL 本身无法修改数据,因此该逃生通道保持只读。
Related MCP server: Salesforce MCP Server
身份验证
服务器本身不执行 OAuth 流程;它使用现有的访问令牌,该令牌在每次工具调用时解析(因此外部进程可以随时轮换令牌):
Salesforce CLI 认证存储,位于
$HOME下:~/.sf/config.json→{"target-org": "<username>"}(或旧版~/.sfdx/sfdx-config.json→{"defaultusername": ...})~/.sfdx/<username>.json→{"accessToken": "...", "instanceUrl": "https://..."}
这是
sf org login写入的格式,也是 JustParent 平台在沙盒中生成的格式(平台会在每次调用前刷新访问令牌)。这些文件中的刷新令牌和客户端密钥会被忽略——绝不会读入内存、存储或记录。环境变量(备用,用于本地/独立使用):
SALESFORCE_ACCESS_TOKEN和SALESFORCE_INSTANCE_URL。
当令牌被拒绝(HTTP 401 / INVALID_SESSION_ID)时,服务器会重新读取认证存储一次并重试,然后报告连接需要重新建立。
REST API 版本默认为 62.0;可通过 SALESFORCE_API_VERSION 覆盖。
运行
# Standalone with env vars (get a token via: sf org display --json)
SALESFORCE_ACCESS_TOKEN=... \
SALESFORCE_INSTANCE_URL=https://yourorg.my.salesforce.com \
uvx --from git+https://github.com/JustParent/simple-salesforce-mcp simple-salesforce-mcpClaude Desktop / 通用 MCP 客户端配置:
{
"mcpServers": {
"salesforce": {
"command": "uvx",
"args": ["--from", "git+https://github.com/JustParent/simple-salesforce-mcp", "simple-salesforce-mcp"],
"env": {
"SALESFORCE_ACCESS_TOKEN": "...",
"SALESFORCE_INSTANCE_URL": "https://yourorg.my.salesforce.com"
}
}
}
}冒烟测试(无需网络,打印版本、凭据状态和工具;退出码为 0):
uvx --from . simple-salesforce-mcp --test开发
uv run pytest # unit tests, no network needed
uv run ruff check . # lint
uv run ruff format . # format (--check to verify only)
uv run mypy # type check (src and tests)
uv run simple-salesforce-mcp --test
npx @modelcontextprotocol/inspector uv run simple-salesforce-mcp # interactiveCI(.github/workflows/tests.yml)在每次推送和拉取请求时运行:针对 Python 3.10–3.13 的测试套件、ruff lint 和格式检查以及 mypy,还有一个打包任务,它会以沙盒的方式安装该包(uvx --from .),以捕获打包问题。
安全说明
仅使用访问令牌:服务器从不请求、读取或持久化刷新令牌。
破坏性操作(update/delete)受显式
confirm=true参数门控, 并带有面向模型的指引,要求先获得用户批准。SOQL 分页游标(
next_url)会被验证为/services/data/...路径, 对象/记录标识符在放入 URL 之前也会经过验证。响应有大小上限,并带有明确的截断提示。
Available Tools
9 toolscreate_recordA
Create a new Salesforce record. Use describe_object first to find the required fields and valid picklist values.
Inputs: data (required), object_type (required).
delete_recordADestructiveIdempotent
Permanently delete a Salesforce record. Requires confirm=true: first present the deletion to the user and get their approval.
Inputs: confirm (required), record_id (required), object_type (required).
describe_objectARead-onlyIdempotent
Get a Salesforce object's fields: API names, types, required flags, and picklist values. Use before writing SOQL or creating/updating records.
Inputs: object_type (required), detail.
get_org_infoARead-onlyIdempotent
Current Salesforce user, org id/name/type, instance URL, and API version in use. Call this first to establish context.
Inputs: no named parameters.
get_recordARead-onlyIdempotent
Fetch a single Salesforce record by Id.
Inputs: record_id (required), object_type (required), fields.
list_objectsARead-onlyIdempotent
List the org's Salesforce objects (API name and label). System noise (Share/History/Feed/ChangeEvent tables, non-queryable objects) is excluded by default.
Inputs: filter, include_system.
run_soql_queryARead-onlyIdempotent
Run a raw SOQL query against the Salesforce org. Read-only — SOQL cannot modify data. Use this as the escape hatch for anything the other tools don't cover: filtering, joins via relationship fields, aggregates, ORDER BY. Always include a LIMIT for exploratory queries. If a field or object name errors, check the exact API names with describe_object.
Inputs: query, next_url.
search_recordsARead-onlyIdempotent
Full-text search across Salesforce records (name, email, phone, and other searchable fields). Good for 'find the record for X' when you don't know the object or Id. For precise filtering use run_soql_query instead.
Inputs: search_term (required), limit, fields, object_types.
update_recordADestructiveIdempotent
Update fields on an existing Salesforce record. Requires confirm=true: first present the exact change to the user and get their approval.
Inputs: data (required), confirm (required), record_id (required), object_type (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct operation: SOQL query, full-text search, record CRUD by Id, object metadata, and org context. The descriptions explicitly contrast run_soql_query with search_records, and get_record with run_soql_query, leaving no ambiguity.
All tool names follow a clear verb_noun pattern in snake_case: run_soql_query, search_records, get_record, create_record, update_record, delete_record, describe_object, list_objects, get_org_info. The naming is perfectly uniform and predictable.
Nine tools is a well-scoped size for a Salesforce MCP server, covering query, search, CRUD, schema introspection, and org context. Every tool has a clear purpose with no redundant or filler tools.
The set provides complete CRUD lifecycle coverage (create, get, update, delete), plus two read/search mechanisms, object metadata discovery, and org context. It covers the full range of common Salesforce interactions an agent would need, with no glaring dead ends.
Maintenance
Related MCP Connectors
One OAuth connector for your team's remote MCP servers, with Tool Packs, guardrails and logs.
Unified MCP Server is a remote MCP connector for AI agents and vertical AI products that provides access to 22,000+ authorized SaaS tools across 400+ integrations and 24 categories directly inside LLMs (Claude, GPT, Gemini, Cohere). Tools operate only on explicitly authorized customer connections, enabling agents to safely read and write against live third-party systems.
Hosted MCP server for AI-driven data ops. Create apps, manage schemas, and CRUD structured data.
One MCP URL for all your connectors — scoped writes, enforced constraints, and a full audit trail.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA focused MCP server for Salesforce CRM that exposes read/write access to standard CRM objects via six tools, designed for multi-tenant gateway deployments.Apache 2.0
- FlicenseBqualityDmaintenanceA customizable MCP server for integrating Salesforce APIs with GenAI applications, supporting SOQL queries, record CRUD, metadata access, and more.138-
- AlicenseAqualityCmaintenanceEnables SOQL queries, SOSL search, and record CRUD operations on a single Salesforce org via MCP, with optional read-only mode.9645 npm1MIT
- AlicenseAqualityDmaintenanceEnables AI agents to interact with Salesforce through MCP, supporting queries, records, metadata, and bulk operations with flexible OAuth authentication.16MIT