Labsco
gellasangameshgupta logo

Salesforce Order Concierge

from gellasangameshgupta

An ecommerce assistant for Salesforce, enabling interaction with orders, returns, and customer service operations.

๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

Salesforce Order Concierge MCP Server

A Model Context Protocol (MCP) server that provides Salesforce order management capabilities for Claude Desktop, including order status checking, return creation, case management, and Slack notifications.

๐ŸŽฏ Overview

This MCP server enables Claude Desktop to interact with Salesforce for:

  • Order status checking with shipping details and tracking information
  • Return order creation using standard Salesforce ReturnOrder objects
  • Case management integration for customer service escalation
  • Slack notification system for real-time alerts
  • Return label email automation for customer convenience

๐Ÿ›  Available Tools

  1. check_order_status - Check order status, shipping details, and tracking information
  2. create_return - Create return orders using standard Salesforce objects
  3. email_return_label - Email return shipping labels to customers
  4. update_case_status - Update case status with priority and assignment changes
  5. create_case_from_return - Create support cases from return orders
  6. send_slack_alert - Send formatted alerts to Slack channels

๐Ÿ” Testing with MCP Inspector

The MCP Inspector is a powerful tool for testing and debugging MCP servers. Here's how to use it:

Install MCP Inspector

npx @modelcontextprotocol/inspector

Test Your Server

  1. Start the Inspector:

    npx @modelcontextprotocol/inspector
  2. Configure Connection:

    • Server Command: node
    • Arguments: ["dist/index.js"]
    • Working Directory: /path/to/sf_mcp_oc
    • Environment Variables:
      SF_LOGIN_URL=https://login.salesforce.com
      SF_USERNAME=your-username@example.com
      SF_PASSWORD=your-password
      SF_SECURITY_TOKEN=your-token
      SLACK_WEBHOOK_URL=your-webhook-url
  3. Test Tools:

    • Click "Connect" to establish connection
    • Browse available tools in the left panel
    • Test each tool with sample data
    • View requests/responses in real-time

Sample Test Data

Check Order Status:

{
  "orderId": "00000100"
}

Create Return:

{
  "orderId": "801xx0000000001",
  "lineItemId": "802xx0000000001",
  "reason": "Defective",
  "quantity": 1,
  "description": "Product stopped working"
}

Send Slack Alert:

{
  "message": "Test alert from MCP Inspector",
  "priority": "info"
}

Debugging Tips

  • Connection Issues: Check environment variables and Salesforce credentials
  • Tool Failures: Review error messages in the inspector's response panel
  • Permissions: Ensure your Salesforce user has access to required objects
  • Network: Verify Salesforce and Slack connectivity

๐Ÿ”ง Environment Variables

VariableRequiredDescription
SF_LOGIN_URLYesSalesforce login URL (https://login.salesforce.com for production, https://test.salesforce.com for sandbox)
SF_USERNAMEYesSalesforce username
SF_PASSWORDYesSalesforce password
SF_SECURITY_TOKENYesSalesforce security token
SLACK_WEBHOOK_URLNoSlack webhook URL for notifications

๐Ÿ— Salesforce Objects Used

Standard Objects

  • ReturnOrder - Standard Salesforce object for return management
  • ReturnOrderLineItem - Individual return items
  • Case - Customer service integration
  • Order/OrderItem - Order relationships

Custom Fields (Optional)

  • ReturnOrder.LabelEmailSent__c - Tracks if return label was emailed
  • ReturnOrder.LabelEmailSentDate__c - Email timestamp

๐Ÿ“ Project Structure

sf_mcp_oc/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts                  # Main MCP server
โ”‚   โ”œโ”€โ”€ salesforce-client.ts     # Salesforce API client
โ”‚   โ””โ”€โ”€ types.ts                  # TypeScript schemas
โ”œโ”€โ”€ force-app/main/default/       # Salesforce metadata
โ”‚   โ”œโ”€โ”€ objects/ReturnOrder/      # Custom fields
โ”‚   โ””โ”€โ”€ flows/                    # Automation flows
โ”œโ”€โ”€ dist/                         # Compiled JavaScript
โ”œโ”€โ”€ package.json                  # Node.js dependencies
โ”œโ”€โ”€ tsconfig.json                 # TypeScript config
โ””โ”€โ”€ CLAUDE.md                     # Project instructions

๐Ÿ”’ Security

  • Never commit credentials to version control
  • Use environment variables for all sensitive data
  • Rotate Salesforce security tokens regularly
  • Use dedicated API users with minimal required permissions

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ”— Resources