MCP Salesforce Revenue Cloud

MCP Salesforce Revenue Cloud

Provides AI assistants with direct access to Salesforce Revenue Cloud data and operations, enabling retrieval of products, price books, quotes, orders, and execution of custom SOQL queries through natural language.

Category
访问服务器

README

MCP Salesforce Revenue Cloud

Overview

This is a Model Context Protocol (MCP) server that provides AI assistants like Claude with direct access to Salesforce Revenue Cloud data and operations. Built with FastMCP, it exposes Salesforce functionality through standardized MCP tools that can be invoked by any MCP-compatible client.

Features

  • MCP Server: Standards-compliant Model Context Protocol server using FastMCP
  • Salesforce Revenue Cloud Integration: Direct access to Products, Price Books, Quotes, and Orders
  • Custom SOQL Queries: Execute arbitrary SOQL queries through the MCP protocol
  • AI Assistant Ready: Works seamlessly with Claude Desktop and other MCP clients
  • Secure Authentication: Uses Salesforce Session ID for authentication

Available MCP Tools

  • get_products(product_family) - Fetch products, optionally filtered by family/category
  • get_price_books() - Retrieve price books from Salesforce
  • get_quotes(limit) - Get quotes with configurable result limit
  • get_orders(limit) - Fetch orders with configurable result limit
  • query_salesforce(soql) - Execute custom SOQL queries

Prerequisites

Before you begin, ensure you have the following:

  • Python 3.8 or higher
  • Access to a Salesforce instance with API enabled
  • A valid Salesforce Session ID (see Configuration section for how to obtain)
  • Claude Desktop or another MCP-compatible client (optional, for testing)
  • pip for installing Python packages

Setup and Installation

  1. Clone the repository:

    git clone https://github.com/Bittersea1803/mcp_salesforce_revenue_cloud.git
    cd mcp_salesforce_revenue_cloud
    
  2. Create and activate a virtual environment:

    python -m venv .venv
    # On Windows
    .\.venv\Scripts\activate
    # On macOS/Linux
    source .venv/bin/activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Set up environment variables: Copy the example environment file and configure your credentials:

    cp .env.example .env
    # Edit .env and add your Salesforce Session ID and Domain URL
    
  5. Test the installation:

    # Test MCP server structure (no Salesforce connection required)
    python test_mcp_server.py
    
    # Test Salesforce authentication (requires valid credentials)
    python salesforce_auth.py
    

Quick Start

Once you have configured your .env file with valid Salesforce credentials:

# Run the MCP server
python server.py

The server will start and listen for MCP protocol connections. To use it with Claude Desktop, see the "Using with Claude Desktop" section below.

Configuration

Environment Variables

Create a .env file in the project root with the following content:

# .env - Environment variables

# Salesforce Session ID (see below for how to obtain)
SALESFORCE_SESSION_ID="your_session_id_here"

# Salesforce Domain URL
SALESFORCE_DOMAIN_URL="https://your-instance.my.salesforce.com"

How to obtain a Salesforce Session ID:

  1. Log into your Salesforce org in a web browser
  2. Open Developer Console (Setup → Developer Console)
  3. Execute this Anonymous Apex code:
    System.debug('Session ID: ' + UserInfo.getSessionId());
    
  4. Copy the Session ID from the debug log
  5. Paste it into your .env file

Important Notes:

  • Session IDs expire after a period of inactivity (typically 2-8 hours depending on your org settings)
  • For SALESFORCE_DOMAIN_URL, use your actual Salesforce instance URL (e.g., https://mycompany.my.salesforce.com)
  • Ensure the .env file is added to your .gitignore to prevent committing credentials

Usage

Running the MCP Server

To run the MCP server directly:

python server.py

Or using the FastMCP CLI:

fastmcp run server.py

The server will start and listen for MCP protocol connections.

Using with Claude Desktop

To use this MCP server with Claude Desktop, add the following configuration to your Claude Desktop config file:

Location of config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "salesforce-revenue-cloud": {
      "command": "python",
      "args": [
        "/absolute/path/to/mcp_salesforce_revenue_cloud/server.py"
      ],
      "env": {
        "SALESFORCE_SESSION_ID": "your_session_id_here",
        "SALESFORCE_DOMAIN_URL": "https://your-instance.my.salesforce.com"
      }
    }
  }
}

Replace:

  • /absolute/path/to/mcp_salesforce_revenue_cloud/server.py with the actual path to server.py
  • your_session_id_here with your Salesforce Session ID
  • https://your-instance.my.salesforce.com with your Salesforce instance URL

After saving the config, restart Claude Desktop. The Salesforce Revenue Cloud tools will be available for Claude to use.

Example Queries

Once connected, you can ask Claude:

  • "Show me all products in Salesforce"
  • "Get products in the Solar Panels family"
  • "What price books are available?"
  • "Show me the latest quotes"
  • "Query Salesforce for SELECT Id, Name FROM Account LIMIT 5"

Project Structure

mcp_salesforce_revenue_cloud/
├── server.py                  # Main MCP server (FastMCP)
├── salesforce_auth.py         # Salesforce authentication module
├── requirements.txt           # Python package dependencies
├── .env                       # Environment variables (DO NOT COMMIT)
├── .gitignore                 # Specifies intentionally untracked files
├── README.md                  # This file
│
# Legacy Flask application (for reference)
├── app.py                     # Old Flask web application
├── handlers.py                # Old handler functions
├── intents_config.yaml        # Old intent definitions
└── templates/                 # Old HTML templates

Development

Testing Salesforce Connection

You can test the Salesforce authentication separately:

python salesforce_auth.py

This will verify your Session ID and display your API usage.

Adding New Tools

To add a new MCP tool, add a function decorated with @mcp.tool() in server.py:

@mcp.tool()
def my_new_tool(param: str) -> str:
    """
    Description of what this tool does.
    
    Args:
        param: Description of the parameter
    
    Returns:
        JSON string with results
    """
    client = get_sf_client()
    # Your implementation here
    return json.dumps({"status": "success", "data": result})

Contributing

Contributions are welcome! If you'd like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin feature/your-feature-name).
  6. Open a Pull Request.

Please ensure your code adheres to any existing coding standards and includes tests where appropriate.

License

This project is licensed under the [e.g., MIT License, Apache 2.0 License, etc.]. See the LICENSE file for details (if you add one).


This README is a template. Please update it with specific details about your project's functionality, setup, and usage as it evolves.

推荐服务器

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

官方
精选