orderdesk-mcp

ebabcock80/orderdesk-mcp

3.1

If you are the rightful owner of orderdesk-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

OrderDesk MCP Server is a specialized server designed to handle model context protocols, facilitating seamless communication and integration between various systems and applications.

OrderDesk MCP Server

CI Tests Coverage Python

A native Model Context Protocol (MCP) server for OrderDesk integration with AI assistants like Claude Desktop and ChatGPT. Features HTTP MCP endpoint for remote connections, professional web admin interface, smart order merge workflow with deduplication, and comprehensive production monitoring.

Status:Production-Ready with HTTP MCP + WebUI | CI: 🟢 All Checks Passing | Tests: 110/110 (100%)

🚀 Features

Core MCP Features

  • HTTP MCP Endpoint: Remote access via /mcp POST endpoint - connect from Claude Desktop, ChatGPT, or any MCP client
  • Native MCP Protocol: Full protocol support (initialize, tools/list, tools/call, prompts/list, resources/list, notifications)
  • Smart Order Updates: Fetch → Merge → Upload workflow with deduplication prevents data loss
  • Multi-Tenant Architecture: Secure tenant isolation with encrypted credentials
  • Advanced Order Filtering: 20+ search parameters (folder, customer, dates, email, etc.)
  • Store Config Caching: Auto-fetch and cache OrderDesk folders and settings
  • Comprehensive API Coverage: Orders, products, stores with full CRUD operations
  • Docker Ready: Multi-stage Docker build with health checks and persistent storage
  • npx mcp-remote Compatible: Easy setup with npx -y mcp-remote http://your-server.com/mcp?token=YOUR_KEY

🎨 WebUI Admin Interface (Phase 5) ⭐

  • Professional Dashboard: Visual overview of stores, API status, and quick actions
  • Store Management: Full CRUD operations for OrderDesk store registrations
  • Interactive API Console: Test all 13 MCP tools directly from your browser
  • Secure Authentication: JWT sessions with master key login
  • Mobile Responsive: Works on desktop, tablet, and mobile
  • Real-time Feedback: Instant response display with syntax highlighting
  • Request History: Track your last 10 API requests
  • Settings Page: View configuration and system information

👥 NEW: User Management + Optional Public Signup (Phase 6) ⭐

  • User Management: Master key holders can view and manage all users
  • Activity Tracking: Monitor user logins, activity, and store usage
  • Cascade Delete: Remove users and ALL their data (stores, audit logs, sessions)
  • Optional Public Signup: Enable/disable public registration with ENABLE_PUBLIC_SIGNUP
  • Email Verification: Secure signup flow with magic link verification
  • Master Key Generation: Cryptographically secure keys (64-char URL-safe)
  • One-Time Display: Master key shown once with copy/download options
  • Rate Limiting: 3 signups per hour per IP (configurable)
  • Self-Service: Users can sign up, verify email, and get their master key automatically

Access the WebUI: Set ENABLE_WEBUI=true in .env and visit http://localhost:8000/webui

🛠️ Implemented MCP Tools (11 Total)

v0.1.0-alpha includes 11 fully functional MCP tools accessible via HTTP MCP endpoint:

Tenant & Store Management (6 Tools)

  • tenant_use_master_key - Authenticate with master key (auto-provision support)
  • stores_register - Register OrderDesk store with encrypted credentials
  • stores_list - List all stores for authenticated tenant
  • stores_use_store - Set active store for session context
  • stores_delete - Remove store registration
  • stores_resolve - Debug tool for store lookup by ID or name

Order Operations (3 Tools)

  • orders_list - List orders with advanced filtering (20+ parameters, 15s cache)
  • orders_get - Fetch single order by ID (15s cache)
  • orders_update - Update order with smart merge workflow, deduplication, and automatic retry (5 attempts on conflict)

Product Operations (2 Tools)

  • products_list - List products with search and pagination (60s cache)
  • products_get - Fetch single product by ID (60s cache)

HTTP MCP Endpoint Features

  • Authentication: Via Authorization: Bearer TOKEN header or ?token=TOKEN query parameter
  • Remote Access: Connect from Claude Desktop, ChatGPT, or any MCP client using npx mcp-remote
  • Copy-Paste Setup: WebUI Settings page generates ready-to-use configuration
  • Smart Deduplication: Prevents duplicate notes when updating orders
  • Full Protocol Support: initialize, tools/list, tools/call, prompts/list, resources/list, notifications

Coming in Future Phases

  • Enhanced order operations (create, delete) - Currently via API
  • Customer operations (Phase 8+)
  • Folder operations (Phase 8+)
  • Reports and analytics (Phase 8+)

✅ CI/CD Status

All GitHub Actions Checks Passing: 🟢

CheckStatusDetails
Lint & Format✅ Passingruff + black (0 errors)
Type Check✅ Passingmypy (0 errors)
Unit Tests✅ Passing110/110 tests (100%)
Coverage✅ Passing>80% (threshold: 55%)
Docker Build✅ PassingMulti-stage build successful
MCP Endpoints✅ Passing9/9 integration tests

View Results: GitHub Actions

Quality Metrics:

  • 🎯 100% test pass rate (110/110 unit tests, 9/9 MCP endpoint tests)
  • 🎯 0 linting errors (ruff + black)
  • 🎯 0 type errors (mypy with Python 3.12)
  • 🎯 0 Pydantic warnings (V2 ready)
  • 🎯 >80% code coverage (exceeds 55% threshold)
  • 🎯 Production-ready with HTTP MCP + WebUI
  • 🎯 Smart merge workflow with note deduplication

🚀 Quick Start

Option 1: HTTP MCP Endpoint (Recommended for Claude Desktop & ChatGPT) ⭐

The easiest way to get started! Deploy the server once and connect from any MCP client.

Step 1: Deploy with Docker Compose
# Clone the repository
git clone https://github.com/ebabcock80/orderdesk-mcp.git
cd orderdesk-mcp

# Start the server (includes WebUI on port 8080)
docker-compose up -d
Step 2: Access the WebUI

Navigate to: http://localhost:8080/webui

  • Login with the default master key: dev-admin-master-key-change-in-production-VNS09qKDdt
  • Add your OrderDesk store (store ID + API key)
  • Go to Settings page
  • Enter your master key to generate the MCP configuration
  • Copy the generated JSON configuration
Step 3: Connect Claude Desktop

Paste the configuration into ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "OrderDesk": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:8080/mcp?token=YOUR_MASTER_KEY_HERE"
      ]
    }
  }
}
Step 4: Restart Claude Desktop

That's it! Claude can now access all your OrderDesk data.

Try asking:

  • "List my OrderDesk stores"
  • "Show me the last 10 orders"
  • "Add a note to order 123456"

Option 2: Stdio MCP (Advanced - for local development)

For advanced users who want stdio-based MCP connections.

Step 1: Build the Docker Image
git clone https://github.com/ebabcock80/orderdesk-mcp.git
cd orderdesk-mcp
docker build -t orderdesk-mcp:latest .
Step 2: Configure Your AI Assistant

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "orderdesk": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-v", "/path/to/your/data:/app/data",
        "-e", "MCP_KMS_KEY=YOUR_GENERATED_KEY_HERE",
        "-e", "DATABASE_URL=sqlite:///./data/app.db",
        "orderdesk-mcp:latest"
      ]
    }
  }
}

Note: Generate MCP_KMS_KEY with: python -c "import secrets; print(secrets.token_urlsafe(32))"


Testing the Connection

Once configured, test with your AI assistant:

  • "List my OrderDesk stores"
  • "Show me recent orders from store DR"
  • "Add a note to order 342635621 saying 'Customer requested gift wrap'"

🎨 WebUI Quick Start

Access the Web Admin Interface

The OrderDesk MCP Server includes an optional professional web admin interface for managing stores, testing APIs, and monitoring the system.

Step 1: Configure WebUI

Edit your .env file:

# Enable WebUI
ENABLE_WEBUI=true

# Set JWT secret (generate with: openssl rand -base64 48)
JWT_SECRET_KEY=your-secure-random-64-char-key-here

# Session settings
SESSION_TIMEOUT=3600
SESSION_COOKIE_SECURE=true
SESSION_COOKIE_SAMESITE=strict

# Phase 6: User Management + Optional Public Signup
ENABLE_PUBLIC_SIGNUP=false  # Set to true for public/SaaS deployments
REQUIRE_EMAIL_VERIFICATION=true

# Email Configuration (for public signup)
EMAIL_PROVIDER=console  # Use 'smtp' for production
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_USE_TLS=true
SMTP_FROM_EMAIL=noreply@yourdomain.com

# Signup Rate Limiting
SIGNUP_RATE_LIMIT_PER_HOUR=3
SIGNUP_VERIFICATION_EXPIRY=900  # 15 minutes

Step 2: Start the Server

# Using Docker Compose (recommended for production)
docker-compose -f docker-compose.production.yml up -d

# Or run locally with uvicorn
uvicorn mcp_server.main:app --host 0.0.0.0 --port 8000

Step 3: Access the WebUI

Navigate to: http://localhost:8000/webui

Features:

  • 🔐 Login with your master key
  • 📊 Dashboard with store overview
  • 🏪 Manage stores (add, edit, delete, test connection)
  • 🧪 Interactive API console (test all 13 MCP tools)
  • ⚙️ Settings and configuration display

WebUI Screenshots

Dashboard:

  • Store count and quick actions
  • Recent activity
  • API status indicators

API Console:

  • Select any of 13 MCP tools
  • Dynamic form generation
  • Instant JSON response display
  • Request history tracking

🔧 Critical Features

Smart Order Merge Workflow with Deduplication ⭐

The server implements an intelligent order update system:

  1. Fetch: Retrieves the complete current order from OrderDesk
  2. Merge: Intelligently merges your changes with existing data
    • Appends new notes instead of replacing
    • Deduplicates notes (case-insensitive comparison)
    • Preserves all existing fields not being updated
  3. Upload: Sends the complete merged order back to OrderDesk
  4. Retry: Automatic conflict resolution (up to 5 attempts)

Example:

Existing order: {order_items: [...], order_notes: [{content: "Note 1"}, {content: "Note 2"}]}
Your change: {order_notes: [{content: "Note 3"}]}
Result: {order_items: [...], order_notes: [{content: "Note 1"}, {content: "Note 2"}, {content: "Note 3"}]}

This prevents data loss and duplicate entries.

HTTP MCP Endpoint

  • Remote Access: Connect from anywhere using HTTP POST to /mcp
  • Authentication: Via Authorization: Bearer TOKEN header or ?token=TOKEN query parameter
  • Compatible: Works with Claude Desktop, ChatGPT, or any MCP client
  • Easy Setup: Use npx mcp-remote http://your-server.com/mcp?token=YOUR_KEY
  • Copy-Paste Config: WebUI Settings page generates ready-to-use configuration

Multi-Tenant Architecture

  • Secure tenant isolation with per-tenant encryption keys
  • Master key authentication with auto-provisioning
  • Encrypted credential storage (AES-256-GCM)
  • Complete audit trail per tenant

📋 Environment Variables

Required Variables

VariableDescriptionExample
MCP_KMS_KEYBase64-encoded encryption key (32+ bytes)dGVzdC1rbXMta2V5...

Core Settings

VariableDescriptionDefault
PORTServer port8080
DATABASE_URLDatabase connection URLsqlite:///data/app.db
LOG_LEVELLogging verbosityINFO
TRUST_PROXYTrust proxy headers (X-Forwarded-For)false

Authentication & Security

VariableDescriptionDefault
ADMIN_MASTER_KEYAdmin master key for WebUI login (⚠️ change in production!)dev-admin-master-key-change-in-production-VNS09qKDdt
AUTO_PROVISION_TENANTAuto-create tenants for unknown master keystrue
JWT_SECRET_KEYJWT signing key (required if WebUI enabled)Auto-generated
SESSION_TIMEOUTSession timeout in seconds86400 (24h)
CSRF_SECRET_KEYCSRF token secretAuto-generated

WebUI Settings

VariableDescriptionDefault
ENABLE_WEBUIEnable web admin interfacefalse
PUBLIC_URLPublic URL for MCP client config generationhttp://localhost:8080
SESSION_COOKIE_SECURERequire HTTPS for cookiestrue
SESSION_COOKIE_HTTPONLYHttpOnly flag for cookiestrue
SESSION_COOKIE_SAMESITESameSite cookie attributeStrict

Rate Limiting

VariableDescriptionDefault
RATE_LIMIT_RPMAPI requests per minute120
WEBUI_RATE_LIMIT_LOGINLogin attempts per IP per minute5
WEBUI_RATE_LIMIT_SIGNUPSignup attempts per IP per minute2
WEBUI_RATE_LIMIT_API_CONSOLEAPI console requests per user per minute30
SIGNUP_RATE_LIMIT_PER_HOURSignups per IP per hour3

Public Signup (Optional - Phase 6)

VariableDescriptionDefault
ENABLE_PUBLIC_SIGNUPAllow public email signupsfalse
REQUIRE_EMAIL_VERIFICATIONRequire email verificationtrue
SIGNUP_VERIFICATION_EXPIRYVerification link expiry (seconds)900 (15 min)

Email Settings (for Public Signup)

VariableDescriptionDefault
EMAIL_PROVIDEREmail provider: console, smtpconsole
SMTP_HOSTSMTP server hostname-
SMTP_PORTSMTP server port587
SMTP_USERNAMESMTP username-
SMTP_PASSWORDSMTP password-
SMTP_USE_TLSUse TLS for SMTPtrue
SMTP_FROM_EMAILDefault sender email-

Caching

VariableDescriptionDefault
CACHE_BACKENDCache backend: memory, sqlite, redismemory
REDIS_URLRedis connection URLredis://redis:6379/0
CACHE_TTL_ORDERSCache TTL for orders (seconds)15
CACHE_TTL_PRODUCTSCache TTL for products (seconds)60
CACHE_TTL_CUSTOMERSCache TTL for customers (seconds)60
CACHE_TTL_STORE_SETTINGSCache TTL for store settings (seconds)300

HTTP Client

VariableDescriptionDefault
HTTP_TIMEOUTHTTP client timeout (seconds)30
HTTP_MAX_RETRIESMax retries for HTTP 429/5xx3
MUTATION_MAX_RETRIESMax retries for mutation conflicts5

Monitoring

VariableDescriptionDefault
ENABLE_METRICSEnable Prometheus metrics endpointtrue
ENABLE_DETAILED_HEALTHEnable detailed health checktrue
ENABLE_AUDIT_LOGEnable audit loggingtrue
AUDIT_LOG_RETENTION_DAYSAudit log retention (days)90

Testing (Optional)

VariableDescriptionDefault
ORDERDESK_TEST_ENABLEDEnable integration testsfalse
ORDERDESK_TEST_STORE_IDTest store ID-
ORDERDESK_TEST_API_KEYTest API key-

Quick Setup

Create a .env file with minimum required settings:

# Required
MCP_KMS_KEY=dGVzdC1rbXMta2V5LWZvci1kZXZlbG9wbWVudC0zMi1ieXRlcy1taW5pbXVt

# Admin Access (⚠️ CHANGE IN PRODUCTION!)
ADMIN_MASTER_KEY=dev-admin-master-key-change-in-production-VNS09qKDdt

# WebUI (Optional)
ENABLE_WEBUI=true
PUBLIC_URL=http://localhost:8080

# That's it for development!

🏭 Production Features

Monitoring & Observability

  • Prometheus Metrics: 15+ production metrics (request latency, cache hit rates, error tracking)
  • Health Checks: 4 endpoints (/health, /health/live, /health/ready, /health/detailed)
  • Structured Logging: JSON logs with correlation IDs and secret redaction
  • Audit Trail: Complete logging of all MCP tool calls

Deployment Options

  • Docker Compose: Single-server deployment with nginx + PostgreSQL + Redis
  • Kubernetes: Full manifests with health probes and autoscaling
  • Multi-Instance: Load balancing with automatic failover
  • SSL/TLS: Let's Encrypt, self-signed, or Cloudflare integration

Security

  • A+ Security Rating: OWASP Top 10 compliant
  • Encryption: AES-256-GCM for credentials, HKDF for key derivation
  • Authentication: bcrypt master keys, JWT sessions, CSRF protection
  • Rate Limiting: Token bucket algorithm, per-tenant limits
  • Audit Logging: Complete activity tracking

Performance

  • Smart Caching: Multi-backend (memory/SQLite/Redis) with configurable TTLs
  • Conflict Resolution: Automatic retry with exponential backoff
  • Connection Pooling: Efficient database and HTTP client pooling
  • Response Times: <50ms (cached), <2s (uncached)

See for complete setup instructions.


🏗️ Architecture

Dual Interface Design

The server provides two interfaces for maximum flexibility:

1. MCP Protocol (AI Assistant Interface)

  • Native stdio communication
  • 13 registered tools for AI assistants
  • Safe order updates (fetch-merge-update)
  • Comprehensive error handling

2. WebUI (Human Admin Interface)

  • Browser-based admin dashboard
  • Visual store management
  • Interactive API testing console
  • Mobile-responsive design

Core Components

  • Authentication: Master key + JWT sessions
  • Storage: SQLite/PostgreSQL with encrypted credentials
  • Caching: Multi-backend with selective invalidation
  • HTTP Client: Automatic retries with exponential backoff
  • Monitoring: Prometheus metrics + health checks

📖 Usage Guide

Getting Started with OrderDesk

  1. First, add your OrderDesk store:

    "Add my OrderDesk store with ID 42174 and API key abc123"
    
  2. List your stores to verify:

    "Show me all my OrderDesk stores"
    
  3. Browse your orders:

    "List my recent orders from OrderDesk"
    "Show me pending orders"
    "Get orders from folder 123"
    

Common Use Cases

Order Management
"Get details for order 12345"
"Update order 12345 status to shipped with tracking number 1Z999AA1234567890"
"Move order 12345 to the 'Shipped' folder"
"Add a note to order 12345: 'Customer requested expedited shipping'"
Product Operations
"List all products in my store"
"Search for products containing 'widget'"
"Get details for product ID 5678"
Customer Management
"List all customers"
"Search for customer 'john@example.com'"
"Get customer details for ID 999"
Folder Organization
"List all order folders"
"Create a new folder called 'Priority Orders'"
"Move order 12345 to the 'Priority Orders' folder"

Advanced Operations

Safe Order Updates

The server automatically handles safe order updates:

  • Fetches the complete current order data
  • Merges your changes with existing data
  • Sends the complete updated order back to OrderDesk
  • Prevents data loss from partial updates
Batch Operations
"List the last 100 orders"
"Show me all orders from the last 30 days"
"Get all pending orders in folder 456"

🔧 MCP Tool Reference

Store Management

Create Store
{
  "tool": "create_store",
  "arguments": {
    "store_id": "your-store-id",
    "api_key": "your-api-key",
    "name": "My Store"
  }
}
List Stores
{
  "tool": "list_stores",
  "arguments": {}
}

Order Operations

List Orders
{
  "tool": "list_orders",
  "arguments": {
    "store_id": "your-store-id",
    "api_key": "your-api-key",
    "limit": 50,
    "offset": 0,
    "status": "pending",
    "folder_id": 123
  }
}
Get Order
{
  "tool": "get_order",
  "arguments": {
    "store_id": "your-store-id",
    "api_key": "your-api-key",
    "order_id": 12345
  }
}
Update Order (Safe)
{
  "tool": "update_order",
  "arguments": {
    "store_id": "your-store-id",
    "api_key": "your-api-key",
    "order_id": 12345,
    "order_data": {
      "status": "shipped",
      "tracking_number": "1Z999AA1234567890"
    }
  }
}

🚀 Recent Updates

Latest Release (October 18, 2025) ⭐

HTTP MCP Endpoint + Smart Order Merge Workflow

  • HTTP MCP Endpoint: Remote access via /mcp POST endpoint for Claude Desktop, ChatGPT, and any MCP client
  • Smart Order Merge: Fetch-merge-upload workflow with intelligent note deduplication (case-insensitive)
  • MCP Protocol Complete: Full support for initialize, tools/list, tools/call, prompts/list, resources/list, notifications
  • Advanced Order Filtering: 20+ search parameters (folder, customer, dates, email, shipping, etc.)
  • Store Config Caching: Auto-fetch OrderDesk folders and settings on store registration
  • Tool Naming Fixed: All tools follow MCP spec (service_method format)
  • Deduplication: Prevents duplicate notes when adding order notes
  • Response Unwrapping: Properly extracts order data from OrderDesk API envelope
  • Cache Improvements: Added invalidate_pattern method for granular cache control

Commits: 7e33927, de3fffb, 6929cbe, fbc8192

Key Improvements

  • 🔧 110 Tests Passing: Comprehensive test coverage (up from 76)
  • 🔧 All CI Checks Green: Lint, format, type check, unit tests, Docker build
  • 🔧 Zero Type Errors: Full mypy compliance with Python 3.12
  • 🔧 Production Documentation: CI_STATUS.md, TESTING_SUMMARY.md added
  • 🔧 WebUI MCP Config Generator: Copy-paste ready configuration on Settings page

📚 Documentation

Core Documentation

  • - This file, quick start and overview
  • - Complete CI status with all test results
  • - MCP endpoint testing and integration guide
  • - Deep dive into security architecture

Setup Guides

  • - Complete setup instructions
  • - API endpoint reference
  • - MCP tool operation guide
  • - Complete MCP tool reference

Testing & CI

  • - Automated MCP endpoint testing
  • - GitHub Actions CI configuration
  • - Python project configuration and dependencies

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

📄 License

MIT License - see file for details.

🔧 Troubleshooting

Common Issues

Docker Connection Problems
# Check if Docker is running
docker --version

# Verify the image was built correctly
docker images | grep orderdesk-mcp

# Check container logs
docker logs <container_id>
MCP Server Not Starting
# Verify environment variables
echo $MCP_KMS_KEY
echo $DATABASE_URL

# Check data directory permissions
ls -la data/

# Test with verbose logging
docker run --rm -i \
  -v $(pwd)/data:/app/data \
  -e SERVER_MODE=mcp \
  -e MCP_KMS_KEY="your-key" \
  -e LOG_LEVEL=debug \
  orderdesk-mcp:latest
OrderDesk API Errors
  • 401 Unauthorized: Check your store_id and api_key
  • 404 Not Found: Verify the endpoint exists in OrderDesk API v2
  • 500 Server Error: Check OrderDesk service status
Data Persistence Issues
# Ensure data directory exists and is writable
mkdir -p data
chmod 755 data

# Check database file
ls -la data/app.db

Getting Help

  1. Check the logs: Look for error messages in the Docker container logs
  2. Verify configuration: Ensure all environment variables are set correctly
  3. Test connectivity: Try a simple tool call like health_check
  4. Check OrderDesk: Verify your OrderDesk account and API credentials

🆘 Support

Contributing

Found a bug or want to add a feature? We welcome contributions!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test them
  4. Commit your changes: git commit -m 'Add amazing feature'
  5. Push to the branch: git push origin feature/amazing-feature
  6. Open a Pull Request

License

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