codefriar/sf-mcp 是从 https://github.com/codefriar/sf-mcp. 导入的 MCP 服务器候选
概览
codefriar/sf-mcp 是从 https://github.com/codefriar/sf-mcp. 导入的 MCP 服务器候选
概述(AI 翻译)
模型上下文协议(MCP)服务器,用于为Claude Desktop等LLM工具提供Salesforce的CLI功能。
概述
该MCP服务器封装了Salesforce的CLI(sf)命令行工具,并将其命令作为MCP工具和资源暴露,使基于LLM的代理能够:
- 查看关于 Salesforce CLI 主题和命令的帮助信息
- 以适当参数执行 Salesforce CLI 命令
- 在AI工作流程中利用Salesforce CLI功能
要求
- Node.js 18+和NPM
- Salesforce CLI(
sf)安装并配置 - 您在CLI中配置的Salesforce组织凭证
安装
用途
启动服务器
MCP 服务器使用 stdio 传输,可与 MCP 客户端使用 比如MCP Inspector或Claude Desktop。
在 Claude Desktop 中配置
要在 Claude Desktop 的 .claude.json 配置中配置该 MCP:
直接使用 npm 软件包:
发展
可用工具和资源
该 MCP 服务器作为 MCP 工具提供 Salesforce CLI 命令。它自动发现并注册 Salesforce CLI 中所有可用命令,并具体实现最常用的命令。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Salesforce CLI MCP Server
Model Context Protocol (MCP) server for providing Salesforce CLI functionality to LLM tools like Claude Desktop.
Overview
This MCP server wraps the Salesforce CLI (sf) command-line tool and exposes its commands as MCP tools and resources, allowing LLM-powered agents to:
- View help information about Salesforce CLI topics and commands
- Execute Salesforce CLI commands with appropriate parameters
- Leverage Salesforce CLI capabilities in AI workflows
Requirements
- Node.js 18+ and npm
- Salesforce CLI (
sf) installed and configured - Your Salesforce org credentials configured in the CLI
Installation
# Clone the repository
git clone
cd sfMcp
# Install dependencies
npm install
Usage
Starting the server
# Basic usage
npm start
# With project roots
npm start /path/to/project1 /path/to/project2
# or using the convenience script
npm run with-roots /path/to/project1 /path/to/project2
# As an npx package with roots
npx -y codefriar/sf-mcp /path/to/project1 /path/to/project2
The MCP server uses stdio transport, which can be used with MCP clients like the MCP Inspector or Claude Desktop.
Configuring in Claude Desktop
To configure this MCP in Claude Desktop’s .claude.json configuration:
{
"tools": {
"salesforce": {
"command": "/path/to/node",
"args": [
"/path/to/sf-mcp/build/index.js",
"/path/to/project1",
"/path/to/project2"
]
}
}
}
Using the npm package directly:
{
"tools": {
"salesforce": {
"command": "/path/to/npx",
"args": [
"-y",
"codefriar/sf-mcp",
"/path/to/project1",
"/path/to/project2"
]
}
}
}
Development
# Watch mode (recompiles on file changes)
npm run dev
# In another terminal
npm start [optional project roots...]
Available Tools and Resources
This MCP server provides Salesforce CLI commands as MCP tools. It automatically discovers and registers all available commands from the Salesforce CLI, and also specifically implements the most commonly used commands.
Core Tools
sf_version- Get the Salesforce CLI version informationsf_help- Get help information for Salesforce CLI commandssf_cache_clear- Clear the command discovery cachesf_cache_refresh- Refresh the command discovery cache
Project Directory Management (Roots)
For commands that require a Salesforce project context (like deployments), you must specify the project directory. The MCP supports multiple project directories (roots) similar to the filesystem MCP.
Configuration Methods
Method 1: Via Command Line Arguments
# Start the MCP with project roots
npm start /path/to/project1 /path/to/project2
# or
npx -y codefriar/sf-mcp /path/to/project1 /path/to/project2
安装
npx -y codefriar/sf-mcp /path/to/project1 /path/to/project2