mcpengine/servers/clover/src/tools/merchants-tools.ts
Jake Shore 7ee40342c8 Clover: Complete MCP server with 50+ tools and 18 React apps
- API client with Clover REST API v3 integration (OAuth2 + API key auth)
- 50+ comprehensive tools across 10 categories:
  * Orders: list, get, create, update, delete, add/remove line items, discounts, payments, fire order
  * Inventory: items, categories, modifiers, stock management
  * Customers: CRUD, search, addresses, payment cards
  * Employees: CRUD, roles, shifts, clock in/out
  * Payments: list, get, refunds
  * Merchants: settings, devices, tender types
  * Discounts: CRUD operations
  * Taxes: CRUD, tax rates
  * Reports: sales summary, revenue by item/category, employee performance
  * Cash: cash drawer tracking and events

- 18 React MCP apps with full UI:
  * Order management: dashboard, detail, grid
  * Inventory: dashboard, detail, category manager
  * Customer: detail, grid
  * Employee: dashboard, schedule
  * Payment history
  * Analytics: sales dashboard, revenue by item, revenue by category
  * Configuration: discount manager, tax manager, device manager
  * Cash drawer

- Complete TypeScript types for Clover API
- Pagination support with automatic result fetching
- Comprehensive error handling
- Full README with examples and setup guide
2026-02-12 17:42:59 -05:00

86 lines
2.4 KiB
TypeScript

import { CloverClient } from '../clients/clover.js';
import { CloverMerchant, CloverDevice, CloverTenderType } from '../types/index.js';
export function createMerchantsTools(client: CloverClient) {
return {
clover_get_merchant: {
description: 'Get merchant information',
inputSchema: {
type: 'object',
properties: {
expand: {
type: 'string',
description: 'Comma-separated fields to expand (address, owner)',
},
},
},
handler: async (args: any) => {
return await client.get<CloverMerchant>('', {
expand: args.expand,
});
},
},
clover_update_merchant: {
description: 'Update merchant settings',
inputSchema: {
type: 'object',
properties: {
name: { type: 'string', description: 'Merchant name' },
phoneNumber: { type: 'string', description: 'Phone number' },
website: { type: 'string', description: 'Website URL' },
},
},
handler: async (args: any) => {
return await client.post<CloverMerchant>('', args);
},
},
clover_list_devices: {
description: 'List all devices for the merchant',
inputSchema: {
type: 'object',
properties: {
expand: {
type: 'string',
description: 'Comma-separated fields to expand',
},
},
},
handler: async (args: any) => {
const devices = await client.fetchPaginated<CloverDevice>(
'/devices',
{ expand: args.expand }
);
return { devices, count: devices.length };
},
},
clover_get_device: {
description: 'Get a specific device by ID',
inputSchema: {
type: 'object',
properties: {
deviceId: { type: 'string', description: 'Device ID' },
},
required: ['deviceId'],
},
handler: async (args: any) => {
return await client.get<CloverDevice>(`/devices/${args.deviceId}`);
},
},
clover_list_tender_types: {
description: 'List tender types (payment methods)',
inputSchema: {
type: 'object',
properties: {},
},
handler: async () => {
const tenders = await client.fetchPaginated<CloverTenderType>('/tenders');
return { tenders, count: tenders.length };
},
},
};
}