salesforce-mcp

salesforce-mcp

Provides read-only access to Salesforce orgs via MCP, enabling SOQL queries, sObject descriptions, and object listing using OAuth 2.0 Client Credentials.

Category
访问服务器

README

Salesforce MCP Server (Read-Only)

An MCP server that provides read-only access to your Salesforce org: run SOQL queries, describe sObjects, and list all objects. Authentication uses the OAuth 2.0 Client Credentials flow. No writes or DML are allowed -- only SELECT queries and describe/list APIs.

Supports two transport modes:

  • stdio -- for local use with Claude Desktop
  • Streamable HTTP -- for remote deployment (Docker, Azure Container Apps, managed Claude agents)

Requirements

  • Python 3.10+
  • A Salesforce Connected App configured for the Client Credentials flow

Connected App Setup (Salesforce)

  1. In Salesforce: Setup > App Manager > New Connected App.
  2. Enable OAuth Settings.
  3. Under Selected OAuth Scopes, add Access and manage your data (api).
  4. Enable Client Credentials Flow.
  5. Save and note your Consumer Key and Consumer Secret.
  6. Under Manage > Edit Policies, set the Client Credentials run-as user.

Environment Variables

Variable Required Description
SALESFORCE_CLIENT_ID Yes Connected App Consumer Key
SALESFORCE_CLIENT_SECRET Yes Connected App Consumer Secret
SALESFORCE_LOGIN_HOST No login.salesforce.com (default) or your My Domain host
MCP_HOST No Server bind address (default: 0.0.0.0)
MCP_PORT No Server port (default: 8765)
MCP_API_KEY No API key for Bearer token auth on the /mcp endpoint. When unset, auth is disabled.
MCP_ALLOWED_HOSTS No Comma-separated allowed Host headers, or * to disable DNS rebinding protection (recommended for cloud deployments with API key auth).
MCP_TRANSPORT No Transport mode when no CLI arg is given (stdio or streamable-http, default: stdio).

Running Locally (stdio)

pip install .
python -m salesforce_mcp

This starts the server in stdio mode, suitable for Claude Desktop.

Claude Desktop Configuration

{
  "mcpServers": {
    "salesforce": {
      "command": "python",
      "args": ["-m", "salesforce_mcp"],
      "env": {
        "SALESFORCE_CLIENT_ID": "<your_consumer_key>",
        "SALESFORCE_CLIENT_SECRET": "<your_consumer_secret>",
        "SALESFORCE_LOGIN_HOST": "<your_login_host>"
      }
    }
  }
}

Running Locally (Streamable HTTP)

python -m salesforce_mcp streamable-http

The server starts on http://0.0.0.0:8765/mcp with a health check at /health.

Running with Docker

docker compose up --build

Pass credentials via a .env file in the project root. The Dockerfile runs the server in Streamable HTTP mode by default.

Deploying to Azure Container Apps

  1. Build and push the Docker image to your Azure Container Registry:

    az acr login --name <your_acr>
    docker build --platform linux/amd64 -t <your_acr>.azurecr.io/salesforce-mcp:latest .
    docker push <your_acr>.azurecr.io/salesforce-mcp:latest
    
  2. Create the container app:

    az containerapp create \
      --name salesforce-mcp \
      --resource-group <your_rg> \
      --environment <your_cae> \
      --image <your_acr>.azurecr.io/salesforce-mcp:latest \
      --registry-server <your_acr>.azurecr.io \
      --target-port 8765 \
      --ingress external \
      --min-replicas 0 \
      --max-replicas 3 \
      --cpu 0.25 \
      --memory 0.5Gi \
      --env-vars \
        SALESFORCE_CLIENT_ID=secretref:salesforce-client-id \
        SALESFORCE_CLIENT_SECRET=secretref:salesforce-client-secret \
        SALESFORCE_LOGIN_HOST=<your_login_host> \
        MCP_HOST=0.0.0.0 \
        MCP_PORT=8765 \
        MCP_API_KEY=secretref:mcp-api-key \
        MCP_ALLOWED_HOSTS="*" \
      --secrets \
        salesforce-client-id="<your_client_id>" \
        salesforce-client-secret="<your_client_secret>" \
        mcp-api-key="<your_api_key>"
    
  3. Connect your MCP client to the deployed endpoint:

    {
      "mcpServers": {
        "salesforce": {
          "type": "streamable-http",
          "url": "https://<your_fqdn>/mcp",
          "headers": {
            "Authorization": "Bearer <your_api_key>"
          }
        }
      }
    }
    

API Key Authentication

When MCP_API_KEY is set, all requests to /mcp must include an Authorization: Bearer <key> header. Requests without a valid key receive a 401 Unauthorized response.

The /health endpoint is always unauthenticated so that platform health probes (Azure, Docker, etc.) work without credentials.

When MCP_API_KEY is not set, all requests pass through without auth -- suitable for local development.

Tools (Read-Only)

Tool Description
run_soql Execute a SOQL SELECT query. INSERT/UPDATE/DELETE/UPSERT/EXECUTE are rejected.
describe_sobject Describe one sObject: fields, labels, types, relationships.
list_objects List all sObjects in the org: name, label, custom flag.

License

MIT.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选