mcp-server

sajid-foodhub/mcp-server

3.1

If you are the rightful owner of mcp-server 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.

The FoodHub Customer Service MCP Server provides tools for store management, SMS campaigns, coupon creation, and ticket management.

Tools
5
Resources
0
Prompts
0

FoodHub Customer Service MCP Server

A Model Context Protocol (MCP) server that provides FoodHub customer service tools for store management, SMS campaigns, coupon creation, and ticket management.

Overview

This server implements a streamable HTTP transport for MCP and provides several tools for FoodHub customer service operations. It includes API integrations for store lookup, access key management, SMS scheduling, coupon creation, and support ticket creation.

Server Configuration

  • Default Port: 8123 (configurable via --port=XXXX command line argument)
  • MCP Endpoint: /mcp
  • Transport: Streamable HTTP with SSE (Server-Sent Events)
  • Session Management: Multi-session support with session-based access control

API Endpoints

1. Store Search API

Purpose: Find stores associated with a phone number

  • URL: https://ms.fhcdn.dev/api/falcon/sit/bob-crm/search-takeaway
  • Method: GET
  • Headers:
    • Authorization: Bearer token
  • Parameters:
    • term: Phone number to search
    • graveyard: 0 (exclude inactive stores)
  • Response: Array of store objects with ID, name, location, and delivery details

2. Access Key API

Purpose: Retrieve access key (license_key) for a specific store

  • URL: https://ms.foodhub.com/api/fl/bob-crm/search-takeaway
  • Method: GET
  • Headers:
    • language: en-us
    • Authorization: Access key token
    • api-version: v2022_05_05
    • locale: united kingdom
    • region: 1
  • Parameters:
    • storeId: Store ID to get access key for
  • Response: Store data including license_key, email, location details

3. SMS Scheduling API

Purpose: Schedule SMS campaigns for customer outreach

  • URL: https://myt-sit.fhcdn.dev/api/sms/schedule
  • Method: POST
  • Headers:
    • authorization: Bearer token
    • content-type: application/json
    • api-version: v2022_05_05
    • locale: united states
    • region: 19
  • Parameters:
    • api_token: API token for SMS scheduling
  • Body: SMS campaign data including title, message, datetime, costs, and customer selection criteria

4. Coupon Creation API

Purpose: Create promotional coupons for stores

  • URL: https://myt-sit.fhcdn.dev/api/coupons
  • Method: POST
  • Headers:
    • authorization: Bearer token
    • content-type: application/json
    • api-version: v2022_05_05
    • locale: united states
    • region: 19
  • Body: Coupon data including code, discount percentage, minimum order, usage limits, and scheduling

5. Ticket Creation API

Purpose: Create support tickets for store issues

  • URL: https://ms.foodhub.com/api/fl-graphql/tickets
  • Method: POST
  • Headers:
    • authorization: API token
    • content-type: application/json; charset=UTF-8
    • x-amz-user-agent: aws-amplify/6.9.0 api/1 framework/1
  • Body: GraphQL mutation for creating tasks with department, category, priority, and assignment details

MCP Tools

The server provides the following MCP tools:

1. get-stores-of-phonenumber

Description: Get stores associated with a phone number and confirm store details

Parameters:

  • phoneNumber (required): Phone number to search for stores
  • storeName (optional): Store name to confirm
  • postcode (optional): Postcode to confirm

Process:

  1. Validates phone number input
  2. Makes API call to search stores
  3. Returns available stores if no store name provided
  4. Validates store name if provided
  5. Requests postcode confirmation if store name confirmed
  6. Validates postcode against store label
  7. Returns final store ID and details

2. get-access-key-for-store

Description: Get access key (license_key) for a specific store

Parameters:

  • storeId (required): Store ID to get access key for

Process:

  1. Validates store ID input
  2. Makes API call to retrieve store access key
  3. Extracts license_key from response
  4. Sets session access permissions
  5. Returns store details and access confirmation

3. schedule-sms-campaign

Description: Schedule SMS campaign with provided API token (Available after store access)

Parameters:

  • apiToken (required): API token for SMS scheduling
  • title (required): SMS campaign title
  • message (required): SMS message content
  • startDatetime (required): Campaign start datetime (YYYY-MM-DD HH:MM:SS)
  • endDatetime (required): Campaign end datetime (YYYY-MM-DD HH:MM:SS)
  • totalSmsCost (optional): Total SMS cost (default: "5.705")
  • couponCode (optional): Coupon code for the campaign (default: "1")

Access Control: Requires prior store access via get-access-key-for-store

4. create-coupon

Description: Create coupon with provided API token (Available after store access)

Parameters:

  • apiToken (required): API token for coupon creation
  • code (required): Coupon code (e.g., SRH4MP)
  • percent (required): Discount percentage (e.g., 10)
  • minOrder (required): Minimum order amount (e.g., 10)
  • description (optional): Coupon description
  • dateStart (optional): Start date (YYYY-MM-DD format)
  • dateEnd (optional): End date (YYYY-MM-DD format)
  • timeStart (optional): Start time (HH:MM format)
  • timeEnd (optional): End time (HH:MM format)
  • numberOfUses (optional): Number of uses allowed (0 for unlimited)
  • onePerCustomer (optional): One per customer (0 = no, 1 = yes)

Access Control: Requires prior store access via get-access-key-for-store

5. create-ticket

Description: Create support ticket with provided API token and store details (Available after store access)

Parameters:

  • apiToken (required): API token for ticket creation
  • jobName (required): Ticket title/name
  • departmentId (required): Department ID (e.g., 57 for Customer Service)
  • departmentName (required): Department name
  • subCategoryId (required): Sub-category ID (e.g., 428 for Account Maintenance)
  • subCategoryName (required): Sub-category name
  • itemCategoryId (required): Item category ID (e.g., 1484 for Config)
  • itemCategoryName (required): Item category name
  • jobPriority (required): Job priority (1=Low, 2=Medium, 3=High)
  • priority (required): Priority level (NORMAL, HIGH, URGENT)
  • dueDate (required): Due date (YYYY-MM-DD format)
  • internalNotes (optional): Internal notes for the ticket
  • postcode (optional): Postcode

Access Control: Requires prior store access via get-access-key-for-store

Session Management

The server implements session-based access control:

  • Each client connection gets a unique session ID
  • Store access is tracked per session
  • Advanced tools (SMS, coupons, tickets) require prior store access
  • Session data includes store ID, store name, and access status

Data Models

Store Interface

interface Store {
  id: number;
  flag: string;
  level: string;
  newlabel: string;
  name: string;
  host: string;
  country_id: number;
  locale: string;
  type: string;
  delivery_charge: number;
}

AccessKeyStore Interface

interface AccessKeyStore {
  id: number;
  flag: string;
  level: string;
  newlabel: string;
  name: string;
  host: string;
  country_id: number;
  locale: string;
  type: string;
  delivery_charge: number;
  license_key: string;
  email: string;
  postcode: string;
  town: string;
  street: string;
  city: string;
  lat: string;
  lng: string;
  store_id: number;
}

Error Handling

The server implements comprehensive error handling:

  • Input validation for all parameters
  • API error handling with status codes
  • Session access validation
  • Sequential thinking process for debugging
  • Detailed error messages with context

Security Features

  • Bearer token authentication for all external APIs
  • Session-based access control
  • Input validation and sanitization
  • Secure token handling (not displayed in responses)
  • CORS and security headers for API requests

Usage Examples

Basic Store Lookup

  1. Use get-stores-of-phonenumber with phone number
  2. Confirm store name from results
  3. Confirm postcode from store label
  4. Get store ID for further operations

Advanced Operations

  1. Get store access via get-access-key-for-store
  2. Use advanced tools (SMS, coupons, tickets) with API tokens
  3. All operations are logged with sequential thinking process

Development

Prerequisites

  • Node.js
  • TypeScript
  • Express.js
  • MCP SDK

Running the Server

npm start
# or with custom port
npm start -- --port=9000

Building

npm run build

API Tokens

The server uses multiple API tokens for different services:

  • FoodHub CRM API token
  • Access Key API token
  • SMS Scheduling API token
  • Coupon Creation API token
  • Ticket Creation API token

All tokens are configured as constants in the server code and should be updated as needed for different environments.