Skip to content

Commit 66ec5df

Browse files
Merge pull request #256 from SheetMetalConnect/claude/debug-mcp-server-demo-018CzTp8C4coR3tUhLiziKM5
Debug MCP server and prepare demo
2 parents 9c8e7f6 + 465fc4f commit 66ec5df

File tree

14 files changed

+1397
-227
lines changed

14 files changed

+1397
-227
lines changed

mcp-server/README.md

Lines changed: 108 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
Model Context Protocol (MCP) server for Eryxon Flow Manufacturing Execution System.
44

5-
## Version 2.1.0 - OpenAI Chat Integration
5+
## Version 2.3.0 - Agent Batch & ERP Integration
66

7-
This version adds AI-powered chat capabilities using OpenAI for natural language queries and manufacturing data analysis.
7+
This version adds:
8+
- **Agent-optimized batch operations** for AI assistants to efficiently manage jobs, parts, and shipments
9+
- **ERP synchronization tools** for bidirectional data sync with external systems
10+
- **Caching layer** for improved performance
811

912
## Architecture
1013

@@ -21,17 +24,20 @@ src/
2124
│ ├── issues.ts # Issues/NCR domain (4 tools)
2225
│ ├── substeps.ts # Substeps domain (5 tools)
2326
│ ├── dashboard.ts # Dashboard/Analytics (3 tools)
24-
│ └── chat.ts # AI Chat/OpenAI (5 tools) - NEW
27+
│ ├── chat.ts # AI Chat/OpenAI (5 tools)
28+
│ ├── erp-sync.ts # ERP Integration (6 tools) - NEW in v2.2.0
29+
│ └── agent-batch.ts # Agent Batch Operations (16 tools) - NEW in v2.3.0
2530
├── types/
2631
│ └── index.ts # Shared TypeScript types
2732
└── utils/
2833
├── index.ts # Utility exports
2934
├── supabase.ts # Supabase client configuration
3035
├── response.ts # Response helper functions
31-
└── openai.ts # OpenAI client configuration - NEW
36+
├── openai.ts # OpenAI client configuration
37+
└── cache.ts # Cache abstraction layer (Redis/in-memory)
3238
```
3339

34-
## Available Tools (33 total)
40+
## Available Tools (55 total)
3541

3642
### Jobs Management (7 tools)
3743
- **fetch_jobs** - Retrieve jobs with optional status filtering
@@ -75,13 +81,42 @@ src/
7581
- **get_qrm_data** - Get Quick Response Manufacturing capacity data
7682
- **get_production_metrics** - Get production metrics for a time period
7783

78-
### AI Chat (5 tools) - NEW in v2.1.0
84+
### AI Chat (5 tools)
7985
- **chat_query** - Ask natural language questions about manufacturing data
8086
- **chat_summarize_jobs** - Get AI-generated summary of job status and metrics
8187
- **chat_analyze_quality** - Get AI analysis of quality issues and NCR patterns
8288
- **chat_explain_data** - Get AI explanation of specific entities (job, part, operation, issue)
8389
- **chat_suggest_actions** - Get AI-suggested actions based on production state
8490

91+
### ERP Synchronization (6 tools) - NEW in v2.2.0
92+
- **erp_sync_diff** - Compare external ERP data with local database and report differences
93+
- **erp_sync_execute** - Execute bidirectional sync for jobs, parts, and operations
94+
- **erp_lookup_external_id** - Find local entity by external ERP ID
95+
- **erp_sync_status** - Get synchronization status and history for an entity
96+
- **erp_batch_lookup** - Batch lookup multiple external IDs at once
97+
- **erp_resolve_ids** - Resolve external IDs to local IDs for efficient processing
98+
99+
### Agent Batch Operations (16 tools) - NEW in v2.3.0
100+
101+
Optimized tools for AI assistants to perform complex multi-step operations efficiently:
102+
103+
- **batch_update_parts** - Update multiple parts in a single call
104+
- **batch_reschedule_operations** - Reschedule multiple operations efficiently
105+
- **prioritize_job** - Set job priority and bullet card status for rush orders
106+
- **fetch_parts_by_customer** - Find all parts for a customer across jobs
107+
- **batch_complete_operations** - Complete multiple operations in one call
108+
- **get_job_overview** - Get comprehensive job summary with parts and operations
109+
- **check_resource_availability** - Check availability of machines, personnel, and tooling
110+
- **assign_resource_to_operations** - Assign resources to multiple operations
111+
- **get_shipping_status** - Get shipping status with job details
112+
- **manage_shipment** - Create, update, or add jobs to shipments
113+
- **get_jobs_ready_for_shipping** - Find jobs ready for shipping
114+
- **get_cell_capacity** - Get manufacturing cell capacity and utilization
115+
- **plan_shipping** - Plan optimal shipping dates based on job completion estimates
116+
- **find_shipping_consolidation** - Find opportunities to consolidate shipments
117+
- **get_parts_due_soon** - Get parts due within a specified timeframe
118+
- **suggest_reschedule** - Get AI-suggested reschedule based on delays and constraints
119+
85120
## Setup
86121

87122
1. Install dependencies:
@@ -97,6 +132,9 @@ export SUPABASE_SERVICE_KEY="your-service-key-here"
97132

98133
# Optional: For AI chat features
99134
export OPENAI_API_KEY="your-openai-api-key"
135+
136+
# Optional: For Redis caching (defaults to in-memory)
137+
export REDIS_URL="redis://localhost:6379"
100138
```
101139

102140
3. Build the server:
@@ -161,7 +199,7 @@ Use the create_ncr tool with operation_id, title, and severity
161199
Use the get_qrm_data tool to see cell capacity utilization
162200
```
163201

164-
### AI Chat Examples (NEW)
202+
### AI Chat Examples
165203

166204
#### Ask a natural language question
167205
```
@@ -177,26 +215,61 @@ Use chat_summarize_jobs with:
177215
- focus: "delays"
178216
```
179217

180-
#### Analyze quality patterns
218+
### ERP Sync Examples (NEW)
219+
220+
#### Check differences before syncing
221+
```
222+
Use erp_sync_diff with:
223+
- entity_type: "jobs"
224+
- external_data: [...array of ERP job records...]
225+
```
226+
227+
#### Execute bidirectional sync
228+
```
229+
Use erp_sync_execute with:
230+
- jobs: [...ERP job records...]
231+
- parts: [...ERP part records...]
232+
- options: { skip_unchanged: true, continue_on_error: true }
233+
```
234+
235+
#### Find entity by external ID
181236
```
182-
Use chat_analyze_quality with:
183-
- time_period: "this_month"
184-
- include_recommendations: true
237+
Use erp_lookup_external_id with:
238+
- entity_type: "jobs"
239+
- external_id: "ERP-JOB-123"
240+
- external_source: "SAP"
185241
```
186242

187-
#### Explain a specific entity
243+
### Agent Batch Examples (NEW)
244+
245+
#### Prioritize a rush job
188246
```
189-
Use chat_explain_data with:
190-
- entity_type: "job"
191-
- entity_id: "job-uuid-here"
192-
- detail_level: "detailed"
247+
Use prioritize_job with:
248+
- job_number: "JOB-2024-0001"
249+
- priority: "urgent"
250+
- set_bullet_card: true
251+
- notes: "Customer requested expedited delivery"
193252
```
194253

195-
#### Get action suggestions
254+
#### Get parts due soon
196255
```
197-
Use chat_suggest_actions with:
198-
- focus_area: "bottlenecks"
199-
- max_suggestions: 5
256+
Use get_parts_due_soon with:
257+
- days_ahead: 3
258+
- include_in_progress: true
259+
```
260+
261+
#### Check resource availability
262+
```
263+
Use check_resource_availability with:
264+
- resource_type: "machine"
265+
- include_usage: true
266+
```
267+
268+
#### Plan shipping
269+
```
270+
Use plan_shipping with:
271+
- job_ids: ["uuid1", "uuid2"]
272+
- consolidate: true
200273
```
201274

202275
## Adding New Tools
@@ -250,15 +323,17 @@ The module includes specialized system prompts for different contexts:
250323
- **production** - Production planning and scheduling
251324
- **general** - General assistance
252325

253-
### Chat Tool Features
326+
## Caching
327+
328+
Version 2.2.0+ includes a caching layer that supports:
329+
330+
- **In-memory cache** - Default, no configuration needed
331+
- **Redis** - Set `REDIS_URL` environment variable
254332

255-
| Tool | Database Access | AI Analysis | Output |
256-
|------|----------------|-------------|--------|
257-
| chat_query | Optional | Yes | Natural language response |
258-
| chat_summarize_jobs | Yes | Yes | Summary + statistics |
259-
| chat_analyze_quality | Yes | Yes | Analysis + recommendations |
260-
| chat_explain_data | Yes | Yes | Explanation + raw data |
261-
| chat_suggest_actions | Yes | Yes | Action items + context |
333+
Cache is used for:
334+
- Frequent lookups (external IDs, entity mappings)
335+
- Prefetched data during batch operations
336+
- Temporary sync state
262337

263338
## Development
264339

@@ -269,12 +344,14 @@ The module includes specialized system prompts for different contexts:
269344
## Tech Stack
270345

271346
- TypeScript 5.x
272-
- @modelcontextprotocol/sdk 1.0.4
273-
- @supabase/supabase-js 2.80.0
274-
- openai 4.70.0 - NEW
347+
- @modelcontextprotocol/sdk 1.24.3
348+
- @supabase/supabase-js 2.86.2
349+
- openai 6.10.0
275350

276351
## Version History
277352

353+
- **2.3.0** - Agent-optimized batch operations (55 tools in 10 modules)
354+
- **2.2.0** - ERP synchronization and caching (39 tools in 9 modules)
278355
- **2.1.0** - OpenAI chat integration (33 tools in 8 modules)
279356
- **2.0.0** - Modular architecture refactor (28 tools in 7 modules)
280357
- **1.0.0** - Initial monolithic implementation

0 commit comments

Comments
 (0)