Salesforce MCP Server

Salesforce MCP Server

A TypeScript implementation of a Model Context Protocol server that enables LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and CRUD operations.

Category
访问服务器

README

MCP Salesforce TypeScript Connector

A TypeScript implementation of a Model Context Protocol (MCP) server for Salesforce integration, allowing LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and CRUD operations.

Features

  • 🔐 Simplified Password Authentication: Secure OAuth 2.0 Resource Owner Password Credentials Flow
  • 📊 SOQL & SOSL: Execute queries and searches against Salesforce
  • 🔍 Metadata Access: Retrieve object fields, labels, and types
  • ✏️ CRUD Operations: Create, read, update, and delete records
  • 🛠️ Tooling API: Execute Tooling API requests
  • ⚡ Apex REST: Execute Apex REST requests
  • 🌐 REST API: Make direct REST API calls to Salesforce
  • 🐳 Docker Ready: No hardcoded values, fully configurable via environment variables
  • 🔄 Token Refresh: Automatic token refresh for long-running sessions

Available Tools

  • authenticate_password - Authenticate using username/password with OAuth
  • run_soql_query - Execute SOQL queries
  • run_sosl_search - Execute SOSL searches
  • get_object_fields - Get metadata for Salesforce objects
  • get_record - Retrieve specific records by ID
  • create_record - Create new records
  • update_record - Update existing records
  • delete_record - Delete records
  • tooling_execute - Execute Tooling API requests
  • apex_execute - Execute Apex REST requests
  • restful - Make direct REST API calls

Quick Start with Docker

Prerequisites

  1. Create a Connected App in Salesforce:

    • Go to Setup → Apps → App Manager → New Connected App
    • Fill in basic information (App Name, API Name, Contact Email)
    • Enable OAuth Settings
    • Set callback URL: http://localhost:8080/callback (required but not used)
    • Select OAuth Scopes:
      • Access your basic information (id, profile, email, address, phone)
      • Perform requests on your behalf at any time (refresh_token, offline_access)
      • Access and manage your data (api)
    • Save and note down the Consumer Key and Consumer Secret
  2. Get your Security Token:

    • Go to Setup → My Personal Information → Reset Security Token
    • Check your email for the new security token

Using the Docker Image

Pull and run the latest Docker image:

# Pull the image
docker pull steffensbola/salesforce-mcp-ts:latest

# Run with your credentials
docker run -p 3000:3000 \
  -e SALESFORCE_CLIENT_ID=your_consumer_key \
  -e SALESFORCE_CLIENT_SECRET=your_consumer_secret \
  -e SALESFORCE_USERNAME=your_username@domain.com \
  -e SALESFORCE_PASSWORD=your_password \
  -e SALESFORCE_SECURITY_TOKEN=your_security_token \
  -e SALESFORCE_SANDBOX=true \
  steffensbola/salesforce-mcp-ts:latest

MCP Configuration

VS Code using Docker image

Add to your .vscode/mcp.json:

{
  "servers": {
    "salesforce": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e", "SALESFORCE_CLIENT_ID=your_consumer_key",
        "-e", "SALESFORCE_CLIENT_SECRET=your_consumer_secret",
        "-e", "SALESFORCE_USERNAME=your_username@domain.com",
        "-e", "SALESFORCE_PASSWORD=your_password",
        "-e", "SALESFORCE_SECURITY_TOKEN=your_token",
        "-e", "SALESFORCE_SANDBOX=true",
        "steffensbola/salesforce-mcp-ts:latest"
      ]
    }
  }
}

You can also use volumes to mount a config file instead of passing environment variables:

{
  "servers": {
    "salesforce": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-v", "${workspaceFolder}/.env:/app/.env",
        "steffensbola/salesforce-mcp-ts:latest"
      ]
    }
  }
}

Claude Desktop using Docker image

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "salesforce": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e", "SALESFORCE_CLIENT_ID=your_consumer_key",
        "-e", "SALESFORCE_CLIENT_SECRET=your_consumer_secret",
        "-e", "SALESFORCE_USERNAME=your_username@domain.com",
        "-e", "SALESFORCE_PASSWORD=your_password",
        "-e", "SALESFORCE_SECURITY_TOKEN=your_token",
        "-e", "SALESFORCE_SANDBOX=true",
        "steffensbola/salesforce-mcp-ts:latest"
      ]
    }
  }
}

Environment Variables

The server requires the following environment variables:

Required (OAuth Authentication)

  • SALESFORCE_CLIENT_ID - Consumer Key from your Connected App
  • SALESFORCE_CLIENT_SECRET - Consumer Secret from your Connected App
  • SALESFORCE_USERNAME - Your Salesforce username
  • SALESFORCE_PASSWORD - Your Salesforce password
  • SALESFORCE_SECURITY_TOKEN - Your Salesforce security token

Optional

  • SALESFORCE_SANDBOX - Set to "true" for sandbox, "false" for production (default: "false")

Alternative (Direct Token Authentication)

Instead of username/password, you can use:

  • SALESFORCE_ACCESS_TOKEN - Direct access token
  • SALESFORCE_INSTANCE_URL - Salesforce instance URL (e.g., https://your-instance.my.salesforce.com)

Backward Compatibility

The server also supports alternative variable names:

  • SF_CONSUMER_KEY / SF_CONSUMER_SECRET
  • SF_USERNAME / SF_PASSWORD / SF_SECURITY_TOKEN

Using Docker Compose

  1. Create a .env file with your environment variables:
SALESFORCE_CLIENT_ID=your_consumer_key
SALESFORCE_CLIENT_SECRET=your_consumer_secret
SALESFORCE_USERNAME=your_username@domain.com
SALESFORCE_PASSWORD=your_password
SALESFORCE_SECURITY_TOKEN=your_token
SALESFORCE_SANDBOX=true
DOCKER_HUB_USERNAME=steffensbola
  1. Run using Docker Compose:
docker-compose up -d

Examples

Using the Tools

Once connected, you can use the tools through your MCP client:

Authentication:

Please authenticate with Salesforce using my credentials

Query Data:

Run this SOQL query: SELECT Id, Name, Industry FROM Account WHERE Industry = 'Technology' LIMIT 10

Search:

Search for contacts named "John" using SOSL

Get Metadata:

Get all the fields for the Contact object

Create Record:

Create a new Account with Name "Test Company" and Industry "Technology"

Troubleshooting

Common Issues

  1. Authentication Failed

    • Verify credentials are correct
    • Check Connected App OAuth scopes include "Access and manage your data (api)"
    • Ensure security token is current (reset if needed)
    • Verify sandbox setting matches your org type
  2. Container Won't Start

    • Ensure both CLIENT_ID and CLIENT_SECRET are provided
    • Check that all required environment variables are set
    • Verify Docker has access to pull the image
  3. Network Errors

    • Check internet connection
    • Verify Salesforce service status
    • Check firewall settings allow outbound HTTPS connections

Debug Mode

For verbose logging, add the debug environment variable:

docker run -e DEBUG=true \
  -e SALESFORCE_CLIENT_ID=... \
  # ... other variables
  steffensbola/salesforce-mcp-ts:latest

Contributing

See CONTRIBUTING.md for information about:

  • Project architecture and development setup
  • Running from source code
  • Contributing guidelines and pull request process

License

MIT License - see LICENSE file for details.

Links

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选