sajid-foodhub/mcp-server
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.
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=XXXXcommand 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 searchgraveyard: 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-usAuthorization: Access key tokenapi-version: v2022_05_05locale: united kingdomregion: 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 tokencontent-type: application/jsonapi-version: v2022_05_05locale: united statesregion: 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 tokencontent-type: application/jsonapi-version: v2022_05_05locale: united statesregion: 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 tokencontent-type: application/json; charset=UTF-8x-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 storesstoreName(optional): Store name to confirmpostcode(optional): Postcode to confirm
Process:
- Validates phone number input
- Makes API call to search stores
- Returns available stores if no store name provided
- Validates store name if provided
- Requests postcode confirmation if store name confirmed
- Validates postcode against store label
- 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:
- Validates store ID input
- Makes API call to retrieve store access key
- Extracts license_key from response
- Sets session access permissions
- 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 schedulingtitle(required): SMS campaign titlemessage(required): SMS message contentstartDatetime(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 creationcode(required): Coupon code (e.g., SRH4MP)percent(required): Discount percentage (e.g., 10)minOrder(required): Minimum order amount (e.g., 10)description(optional): Coupon descriptiondateStart(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 creationjobName(required): Ticket title/namedepartmentId(required): Department ID (e.g., 57 for Customer Service)departmentName(required): Department namesubCategoryId(required): Sub-category ID (e.g., 428 for Account Maintenance)subCategoryName(required): Sub-category nameitemCategoryId(required): Item category ID (e.g., 1484 for Config)itemCategoryName(required): Item category namejobPriority(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 ticketpostcode(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
- Use
get-stores-of-phonenumberwith phone number - Confirm store name from results
- Confirm postcode from store label
- Get store ID for further operations
Advanced Operations
- Get store access via
get-access-key-for-store - Use advanced tools (SMS, coupons, tickets) with API tokens
- 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.