Salesforce Commerce Cloud B2B MCP Server
Create a powerful Model Context Protocol (MCP) server for Salesforce Commerce Cloud B2B in minutes with our AI Gateway. This guide walks you through setting up seamless B2B commerce integration with enterprise-grade security and instant OAuth authentication.
About Salesforce Commerce Cloud B2B API
Salesforce B2B Commerce is a powerful platform for business-to-business digital commerce, enabling companies to deliver personalized buying experiences. The B2B Commerce API provides comprehensive access to:
- Account Management: Buyer accounts, account groups, and hierarchies
- Product Catalog: B2B-specific product features, categories, and variations
- Pricing Management: Contract pricing, volume discounts, and price books
- Cart & Checkout: B2B cart management, quote requests, and approval workflows
- Order Management: Order processing, tracking, and history
- Inventory & Fulfillment: Real-time inventory and delivery scheduling
- Payment Processing: Terms, credit limits, and payment methods
- Search & Navigation: Faceted search and B2B-specific filters
Key Features
- REST API: Comprehensive RESTful interface
- Salesforce Platform: Built on trusted Salesforce infrastructure
- Multi-Org Support: Manage multiple business units
- CPQ Integration: Connect with Configure, Price, Quote
- Account Hierarchies: Complex B2B relationships
- Approval Workflows: Multi-step approval processes
- Contract Management: Negotiated terms and pricing
- Bulk Operations: Handle large B2B transactions
What You Can Do with Salesforce Commerce Cloud B2B MCP Server
The MCP server transforms Salesforce B2B Commerce API into a natural language interface, enabling AI agents to:
Account & Buyer Management
-
Account Operations
- "Create a new buyer account for Acme Corporation"
- "Set up account hierarchy for parent and subsidiary companies"
- "Update credit limits for enterprise accounts"
- "Manage buyer groups and permissions"
-
User Management
- "Add purchasing managers to the buyer account"
- "Set approval limits for different user roles"
- "Create buyer admin users with specific permissions"
- "Deactivate users who left the company"
-
Account Intelligence
- "Show accounts nearing credit limits"
- "Find inactive accounts from last quarter"
- "List accounts with pending approvals"
- "Analyze purchasing patterns by account"
Product & Catalog Management
-
Product Operations
- "Add bulk pricing tiers for industrial supplies"
- "Set minimum order quantities for wholesale items"
- "Create product bundles for solution selling"
- "Update lead times for made-to-order products"
-
Category Management
- "Organize products by industry vertical"
- "Create private catalogs for specific accounts"
- "Set up category-specific approval rules"
- "Hide products from certain buyer groups"
-
Search Enhancement
- "Configure facets for technical specifications"
- "Set up synonym groups for industry terms"
- "Boost products in search results"
- "Create saved searches for buyers"
Pricing & Contract Management
-
Price Management
- "Apply contract pricing for enterprise account"
- "Set volume discount tiers for bulk orders"
- "Create promotional pricing with date ranges"
- "Override list prices for negotiated deals"
-
Contract Operations
- "Create new pricing agreement for 2-year term"
- "Update contract terms and conditions"
- "Set contract-specific product availability"
- "Track contract utilization and compliance"
-
Quote Management
- "Generate quote for complex configuration"
- "Apply special discounts to quote items"
- "Route quote for multi-level approval"
- "Convert approved quote to order"
Cart & Order Management
-
Cart Operations
- "Add items to cart with specific delivery dates"
- "Split cart items across multiple ship-to addresses"
- "Apply account-specific payment terms"
- "Calculate taxes and shipping for B2B rules"
-
Order Processing
- "Submit order for approval workflow"
- "Track order through fulfillment stages"
- "Handle partial shipments and backorders"
- "Process return merchandise authorizations"
-
Reorder & Templates
- "Create order template from previous purchase"
- "Set up recurring orders for consumables"
- "Enable quick reorder from order history"
- "Bulk upload orders via CSV"
Analytics & Reporting
-
Sales Analytics
- "Show top performing products by revenue"
- "Analyze order patterns by account segment"
- "Track quote-to-order conversion rates"
- "Monitor average order values over time"
-
Account Insights
- "Generate account purchasing history report"
- "Show products frequently bought together"
- "Identify cross-sell opportunities"
- "Track account growth year-over-year"
-
Inventory Analytics
- "Monitor stock levels for high-velocity items"
- "Predict inventory needs based on trends"
- "Alert on low stock for contracted items"
- "Analyze fulfillment performance"
Integration & Automation
-
ERP Integration
- "Sync products from ERP catalog"
- "Update inventory levels in real-time"
- "Push orders to fulfillment system"
- "Synchronize customer master data"
-
Workflow Automation
- "Auto-approve orders under threshold"
- "Route large orders for credit check"
- "Trigger notifications for order milestones"
- "Escalate stalled approvals"
-
Data Management
- "Import product data from spreadsheets"
- "Export order data for analysis"
- "Bulk update product attributes"
- "Archive historical transaction data"
Prerequisites
- Access to Cequence AI Gateway
- Salesforce org with B2B Commerce Cloud
- System Administrator or B2B Commerce Administrator access
- Connected App configuration capabilities
Step 1: Create Salesforce Connected App
Before setting up the MCP server, you need to create a Connected App in Salesforce.
1.1 Access Salesforce Setup
- Log in to your Salesforce org
- Navigate to Setup (gear icon Setup)
- In Quick Find, search for "App Manager"
- Click App Manager
1.2 Create New Connected App
-
Click New Connected App
-
Fill in Basic Information:
- Connected App Name: "AI Gateway B2B Commerce MCP"
- API Name: Auto-populated
- Contact Email: Your admin email
-
Enable OAuth Settings:
- Check Enable OAuth Settings
- Callback URL:
https://auth.aigateway.cequence.ai/v1/outbound/oauth/callback
1.3 Configure OAuth Scopes
Select the following OAuth scopes:
- Access and manage your data (api)
- Perform requests on your behalf at any time (refresh_token, offline_access)
- Access your basic information (id, profile, email, address, phone)
- Full access (full) - if needed for admin operations
1.4 Configure Additional Settings
- IP Relaxation: Set to "Relax IP restrictions" for initial testing
- Refresh Token Policy: Set based on security requirements
- Save the Connected App
1.5 Retrieve OAuth Credentials
After saving:
- Click Manage Edit Policies
- Note the Consumer Key (Client ID)
- Click Manage Consumer Details
- Verify your identity to view Consumer Secret
- Copy both values securely
Step 2: Access AI Gateway Apps
- Log in to your Cequence AI Gateway dashboard
- Navigate to Apps in the left sidebar
- You'll see the list of available third-party applications
Step 3: Find and Select Salesforce Commerce Cloud B2B API
- In the Apps section, browse through the Third-party category
- Look for Salesforce Commerce Cloud B2B or use the search function
- Click on the Salesforce Commerce Cloud B2B API card to view details
The API card shows:
- Number of available endpoints
- Integration capabilities
- Quick description of functionality
Step 4: Create MCP Server
- Click the Create MCP Server button on the API card
- You'll be redirected to the MCP Server creation wizard
Step 5: Configure API Endpoints
In the App Configuration step:
-
Base URL: Enter your Salesforce instance URL
- Format:
https://{instance}.salesforce.com
- Example:
https://na139.salesforce.com
- Or use your My Domain:
https://mycompany.my.salesforce.com
- Format:
-
Select API endpoints to expose to your MCP server
-
Click Next to proceed
Step 6: MCP Server Basic Setup
Configure your MCP server details:
-
MCP Server Name: Enter a descriptive name
- Example: "Salesforce B2B Commerce Hub"
- This name will identify your server in the dashboard
-
Description (Optional): Add details about the server's purpose
- Example: "B2B commerce operations and buyer management"
-
Production Mode: Toggle based on your needs
- ON for production environments
- OFF for development/testing
-
Click Next to continue
Step 7: Configure Authentication
This is where you'll use your Connected App credentials:
-
Authentication Type: Select OAuth 2.0
-
Fill in the OAuth configuration:
-
Authorization URL:
https://login.salesforce.com/services/oauth2/authorize
(Use
test.salesforce.com
for sandboxes) -
Token URL:
https://login.salesforce.com/services/oauth2/token
-
Client ID: Paste Consumer Key from Connected App
-
Client Secret: Paste Consumer Secret from Connected App
-
Redirect URI:
https://auth.aigateway.cequence.ai/v1/outbound/oauth/callback
-
-
Scopes: Select from available scopes (see next section)
Available Salesforce Commerce Cloud B2B OAuth Scopes
Configure the appropriate scopes based on your application needs:
Core Scopes
-
api
- Access and manage Salesforce data
- Required for most B2B Commerce operations
- Read and write access to objects
- Execute SOQL and SOSL queries
-
full
- Full access to all data accessible by logged-in user
- Includes all other scopes except refresh_token
- Use carefully in production
- Required for some admin operations
-
refresh_token
- Perform requests on behalf of user when offline
- Maintain persistent access
- Required for background operations
- Essential for automated workflows
Recommended Scope Combinations
For Standard B2B Operations:
api
refresh_token
For Full Administrative Access:
api
full
refresh_token
Step 8: Configure Security
Set up API protection features:
-
API Protection: Toggle ON to enable
- Protects against bot attacks, DDoS, and threats
- Monitors for suspicious activity
- Rate limiting and anomaly detection
-
Protection Features (when enabled):
- Auto-scaling protection
- Managed infrastructure
- Built-in monitoring
- Zero maintenance required
-
Click Next to continue
Step 9: Choose Deployment Method
Select your deployment preference:
Option A: Deploy to Cequence Cloud (Recommended)
- Fully managed deployment
- Automatic scaling and monitoring
- Built-in high availability
Option B: Deploy with Helm Chart
- Self-managed Kubernetes deployment
- Full control over infrastructure
- Requires Kubernetes expertise
Click Next after selecting.
Step 10: Review and Deploy
Review your MCP server configuration:
- MCP Server Name: Your chosen name
- Base URL: Your Salesforce instance
- Selected Endpoints: Number of endpoints selected
- Authentication: OAuth 2.0 (Configured)
- API Protection: Enabled/Disabled
- Deployment: Your selected method
Click Create & Deploy to finalize the setup.
Step 11: Post-Deployment Setup
After successful deployment:
-
Note the MCP Server URL provided
-
Test the OAuth flow:
- Click "Test Connection"
- Log in to Salesforce when prompted
- Authorize the application
- Confirm successful connection
-
Configure AI Agents:
- The MCP server is now available for AI agent connections
- Use the provided server URL in your AI agent configuration
Using Your Salesforce Commerce Cloud B2B MCP Server
With Claude Desktop
-
Open Claude Desktop settings
-
Add your MCP server:
{
"servers": {
"salesforce-b2b": {
"url": "your-mcp-server-url",
"auth": {
"type": "oauth2",
"client_id": "your-client-id"
}
}
}
} -
Start using natural language commands:
- "Show me all buyer accounts created this month"
- "Update pricing for contract ACC-12345"
- "Create a quote for Acme Corp with our standard discount"
- "Find products with low inventory that are on active contracts"
- "Generate a report of orders pending approval"
API Integration Example
// Initialize MCP client
const mcpClient = new MCPClient({
serverUrl: 'your-mcp-server-url',
auth: {
type: 'oauth2',
token: 'user-access-token'
}
});
// Get web stores
const webstores = await mcpClient.salesforce.commerce.getWebstores();
// Create a cart
const cart = await mcpClient.salesforce.commerce.createCart({
webstoreId: 'store-id',
effectiveAccountId: 'account-id',
currencyIsoCode: 'USD'
});
// Add items to cart
await mcpClient.salesforce.commerce.addToCart({
cartId: cart.cartId,
cartItems: [{
productId: 'product-id',
quantity: 100,
salesPrice: 25.00
}]
});
// Apply contract pricing
await mcpClient.salesforce.commerce.applyContractPricing({
cartId: cart.cartId,
contractId: 'contract-id'
});
// Submit for approval
const order = await mcpClient.salesforce.commerce.submitOrder({
cartId: cart.cartId,
approvalRequired: true
});
Common Use Cases
B2B Commerce Operations
- Account-based pricing management
- Complex approval workflows
- Multi-tier distributor management
- Contract and subscription handling
- Bulk order processing
Integration Scenarios
- ERP system synchronization
- CPQ integration for complex products
- Marketing automation connections
- Financial system integration
- Logistics and fulfillment
Analytics & Insights
- Account purchasing analysis
- Product performance metrics
- Sales team effectiveness
- Inventory optimization
- Customer lifetime value
Security Best Practices
-
OAuth Security:
- Use IP restrictions in production
- Implement session timeout policies
- Regular token rotation
- Monitor API usage logs
-
Data Access:
- Apply field-level security
- Use record-level sharing rules
- Implement data masking for sensitive fields
- Regular permission audits
-
API Limits:
- Monitor API call limits
- Implement efficient batching
- Use selective field queries
- Cache frequently accessed data
Troubleshooting
Common Issues
-
Invalid Session ID
- Re-authenticate OAuth flow
- Check session timeout settings
- Verify IP restrictions
- Review security policies
-
Insufficient Privileges
- Verify user permissions
- Check object-level access
- Review field-level security
- Confirm API-enabled permission
-
API Limit Exceeded
- Check org limits in Setup
- Implement request throttling
- Use bulk API operations
- Consider off-peak processing
Getting Help
- Documentation: AI Gateway Docs
- Support: support@cequence.ai
- Community: AI Gateway Forum
- Salesforce Docs: B2B Commerce Developer Guide