Orion Salesforce MCP Server

Orion Salesforce MCP Server

Enables natural language querying and data manipulation of Salesforce orgs, with intelligent SOQL/SOSL generation, cross-object search, and enterprise-ready features optimized for wholesale distribution systems.

Category
访问服务器

README

Orion Salesforce MCP Server

A powerful and intelligent Salesforce data interaction server designed specifically for wholesale distribution systems. This MCP (Model Control Plane) server provides natural language querying capabilities with advanced SOQL/SOSL generation, intelligent field resolution, and comprehensive data manipulation features.

🌟 Key Features

Intelligent Data Querying

  • Natural Language to SOQL: Convert plain English questions into optimized Salesforce queries
  • Smart Object & Field Resolution: Automatically map business terms to Salesforce API names using configurable synonyms
  • Cross-Object Search (SOSL): Search across multiple objects simultaneously with intelligent result aggregation
  • Relationship Traversal: Automatically handle lookups and master-detail relationships
  • Time-Sensitive Filtering: Intelligent date range detection and application

Data Manipulation (DML)

  • Controlled DML Operations: Configurable Insert, Update, Upsert, Delete, Undelete, and Merge capabilities
  • Feature Flags: Granular control over DML operations with org-specific configuration
  • Safety Guardrails: Built-in limits, confirmation requirements, and bulk operation controls
  • Permission Respect: Honor Salesforce field-level security and object permissions

Hybrid AI Responses

  • Data-Driven Answers: Combine actual Salesforce data with LLM knowledge for contextual responses
  • Intelligent Fallbacks: Graceful handling when data is unavailable or insufficient
  • Business Context: Understand wholesale distribution terminology and processes

Enterprise-Ready Architecture

  • Multi-Org Support: Configure different Salesforce orgs with unique settings and permissions
  • Robust Error Handling: Comprehensive Salesforce API error handling with clear user feedback
  • Security First: Token management, PII redaction, and configurable access controls
  • Performance Optimized: Intelligent caching, query optimization, and efficient API usage

🚀 Quick Start

Prerequisites

  • Node.js 18+
  • Salesforce org with API access
  • Valid Salesforce access tokens

Installation

  1. Clone and Install

    git clone https://github.com/jasonjuela/orion-salesforce-mcp-server.git
    cd orion-salesforce-mcp-server
    npm install
    
  2. Configure Salesforce Tokens

    cp data/secrets/tokens.example.json data/secrets/tokens.json
    

    Edit data/secrets/tokens.json with your Salesforce credentials:

    {
      "default": {
        "access_token": "your_access_token_here",
        "instance_url": "https://your-instance.salesforce.com",
        "token_type": "Bearer"
      }
    }
    
  3. Customize Organization Profile

    Edit data/configs/default.json to match your Salesforce org structure:

    {
      "orgId": "your-org-name",
      "namespaces": ["your_namespace__"],
      "objectSynonyms": {
        "owsc__Item__c": ["wine", "product", "inventory"],
        "owsc__Order__c": ["order", "purchase order", "po"]
      }
    }
    
  4. Start the Server

    npm start
    

    Server runs on http://localhost:3018

📖 Usage Examples

Basic Querying

# Natural language queries
curl -X POST http://localhost:3018/generate/stream \
  -H "Content-Type: application/json" \
  -d '{
    "user_question": "What is the alcohol percentage of Cockburn'\''s wines?",
    "orgId": "default",
    "sessionId": "demo"
  }'

Cross-Object Search

# Search across multiple objects
curl -X POST http://localhost:3018/generate/stream \
  -H "Content-Type: application/json" \
  -d '{
    "user_question": "search for Smith across all objects",
    "orgId": "default", 
    "sessionId": "demo"
  }'

Test Interface

Open http://localhost:3018 in your browser for a simple web interface to test queries.

⚙️ Configuration

Organization Profiles (data/configs/default.json)

{
  "orgId": "wholesale-system",
  "description": "Wholesale distribution system configuration",
  "namespaces": ["owsc__"],
  
  "guardrails": {
    "piiRedaction": true,
    "maxRows": 1000,
    "defaultDateRange": "LAST_N_MONTHS:6",
    "allowedObjects": [],
    "blockedObjects": ["UserRecordAccess", "ObjectPermissions"]
  },
  
  "features": {
    "dmlOperations": {
      "enabled": false,
      "allowedOperations": {
        "insert": false,
        "update": false,
        "upsert": false,
        "delete": false,
        "undelete": false,
        "merge": false
      },
      "safeguards": {
        "maxRecordsPerOperation": 50,
        "requireConfirmation": true,
        "allowBulkOperations": false
      }
    }
  },
  
  "objectSynonyms": {
    "owsc__Item__c": ["wine", "product", "inventory", "item"],
    "owsc__Order__c": ["order", "purchase order", "po"],
    "Account": ["account", "customer", "client"]
  }
}

DML Operations

To enable data manipulation:

  1. Set features.dmlOperations.enabled: true
  2. Enable specific operations (insert, update, etc.)
  3. Configure safety guardrails
  4. Specify allowed/blocked objects in dmlRestrictions

🏗️ Architecture

Core Components

  • Planner Service (src/services/planner.js): Intent detection and query generation
  • Salesforce Service (src/services/salesforce.js): API client with retry logic
  • Intelligent Resolver (src/services/intelligentResolver.js): Object and field mapping
  • Stream Generator (src/routes/generateStream.js): Main orchestration and LLM integration

Data Flow

  1. Intent Detection: Analyze user question for search type and entities
  2. Object Resolution: Map business terms to Salesforce objects using synonyms
  3. Field Discovery: Use Describe API to find relevant fields
  4. Query Generation: Build optimized SOQL/SOSL queries
  5. Data Retrieval: Execute queries with error handling and retries
  6. Response Generation: Combine data with LLM for intelligent answers

🔧 API Endpoints

Primary Endpoints

  • POST /generate/stream - Main query interface with streaming responses
  • GET /auth/login - Salesforce OAuth initiation (placeholder)
  • GET /auth/callback - OAuth callback handler (placeholder)
  • GET /search/capabilities - Check available search capabilities
  • POST /search/cross-object - Direct SOSL search endpoint

Response Format

Streaming responses include:

  • Query plan (SOQL/SOSL)
  • Data retrieval status
  • Record count
  • Formatted results
  • LLM-generated insights

🛡️ Security Features

  • Token Management: Secure credential storage and rotation
  • PII Redaction: Configurable personally identifiable information filtering
  • Object Whitelisting: Control access to specific Salesforce objects
  • Field-Level Security: Respect Salesforce permissions
  • Query Limits: Prevent expensive or dangerous operations
  • Feature Flags: Granular control over dangerous operations like DML

🎯 Wholesale Distribution Focus

Optimized for wholesale/distribution use cases:

  • Inventory Management: Track items, lots, containers, and locations
  • Order Processing: Handle purchase orders, sales orders, and fulfillment
  • Supply Chain: Manage vendors, warehouses, and shipping
  • Financial Operations: Support invoicing, payments, and accounting
  • Business Intelligence: Aggregate data for reporting and analytics

🚦 Production Considerations

Performance

  • Implement response caching for frequent queries
  • Use connection pooling for Salesforce API calls
  • Add request rate limiting
  • Monitor API usage limits

Security

  • Implement proper OAuth flows
  • Add request authentication/authorization
  • Enable HTTPS in production
  • Regular token rotation
  • Audit logging

Monitoring

  • Add comprehensive logging
  • Implement health checks
  • Monitor Salesforce API limits
  • Track query performance metrics

🤝 Contributing

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

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

For questions, issues, or feature requests:

  • Open an issue on GitHub
  • Check existing documentation
  • Review configuration examples

Built for intelligent Salesforce data interaction with wholesale distribution in mind.

推荐服务器

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

官方
精选