MCP Server Setup Guide
The MCP (Model Context Protocol) server enables Claude Desktop to interact with your Eryxon Flow deployment using natural language. This guide covers both local development and production deployment.
Overview
Section titled “Overview”What is the MCP Server?
- Provides 55 AI tools across 9 modules for manufacturing operations
- Enables natural language interaction with jobs, parts, operations, quality, and analytics
- Optional component - your application works perfectly without it
- Designed for developers and power users who want AI assistant integration
Architecture:
Claude Desktop (User) ↓ MCP Protocol (stdio/SSE)MCP Server (Local or Hosted) ↓ REST API or Direct SupabaseEryxon Flow Database ↓ RLS (Row-Level Security)Your DataDeployment Modes
Section titled “Deployment Modes”Mode 1: Local Development (Self-Hosted)
Section titled “Mode 1: Local Development (Self-Hosted)”Best for: Single-tenant self-hosted deployments, development
Requirements:
- Node.js 18+
- Direct access to Supabase database
- Service role key
Setup:
- Build the server:
cd mcp-servernpm installnpm run build- Configure environment:
export SUPABASE_URL="https://your-project.supabase.co"export SUPABASE_SERVICE_KEY="eyJhbGc..." # Service role key- Start the server:
npm start- Configure Claude Desktop:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{ "mcpServers": { "eryxon-flow": { "command": "node", "args": ["/absolute/path/to/eryxon-flow/mcp-server/dist/index.js"], "env": { "SUPABASE_URL": "https://your-project.supabase.co", "SUPABASE_SERVICE_KEY": "your-service-role-key" } } }}- Restart Claude Desktop
You should see “Eryxon Flow MCP Server v2.5.0” with 55 tools available.
Mode 2: Cloud Deployment (Multi-Tenant)
Section titled “Mode 2: Cloud Deployment (Multi-Tenant)”Best for: SaaS deployments, multiple users, hosted environments
Requirements:
- Railway, Fly.io, or similar platform
- Upstash Redis (for caching)
- Eryxon Flow API endpoint
Option A: Railway (Recommended)
Section titled “Option A: Railway (Recommended)”Why Railway?
- Zero-config deployments
- Automatic HTTPS
- Built-in monitoring
- $5/month starter plan
Steps:
- Install Railway CLI:
npm install -g @railway/clirailway login- Deploy:
cd mcp-serverrailway initrailway up- Set environment variables in Railway dashboard:
ERYXON_API_URL=https://your-project.supabase.coUPSTASH_REDIS_REST_URL=https://your-redis.upstash.ioUPSTASH_REDIS_REST_TOKEN=your-token- Get your deployment URL:
https://your-mcp-server.railway.app- User Configuration:
Each user runs the MCP server locally in API mode:
{ "mcpServers": { "eryxon-flow": { "command": "node", "args": ["/path/to/eryxon-flow/mcp-server/dist/index.js"], "env": { "ERYXON_API_URL": "https://your-project.supabase.co", "ERYXON_API_KEY": "ery_live_xxxxx" } } }}Note: In cloud/multi-tenant mode, each user runs the MCP server locally but it connects to your hosted Eryxon API using their personal API key. Users get their API key from: Settings → API Keys in Eryxon Flow web interface.
Option B: Fly.io
Section titled “Option B: Fly.io”Why Fly.io?
- Global edge deployment
- Free tier available
- Excellent performance
Steps:
- Install Fly CLI:
brew install flyctl # macOS# or: curl -L https://fly.io/install.sh | shflyctl auth login- Create
fly.tomlinmcp-server/:
app = "your-mcp-server"primary_region = "ams" # Amsterdam or your preferred region
[build] builder = "paketobuildpacks/builder:base"
[env] NODE_ENV = "production" PORT = "8080"
[[services]] internal_port = 8080 protocol = "tcp"
[[services.ports]] handlers = ["http"] port = 80
[[services.ports]] handlers = ["tls", "http"] port = 443- Deploy:
flyctl launchflyctl secrets set ERYXON_API_URL="https://your-project.supabase.co"flyctl secrets set UPSTASH_REDIS_REST_URL="your-redis-url"flyctl secrets set UPSTASH_REDIS_REST_TOKEN="your-token"flyctl deploy- Your URL:
https://your-mcp-server.fly.devOption C: Docker
Section titled “Option C: Docker”Dockerfile (already included in mcp-server/):
FROM node:18-alpineWORKDIR /appCOPY package*.json ./RUN npm ci --only=productionCOPY . .RUN npm run buildCMD ["npm", "start"]Deploy:
cd mcp-serverdocker build -t eryxon-mcp-server .docker run -e ERYXON_API_URL="..." -e ERYXON_API_KEY="..." -p 3000:3000 eryxon-mcp-serverMode Detection
Section titled “Mode Detection”The server automatically detects which mode to use:
| Environment Variables | Mode | Use Case |
|---|---|---|
ERYXON_API_KEY set | API Mode | Cloud, multi-tenant, SaaS |
SUPABASE_SERVICE_KEY set | Direct Mode | Self-hosted, local, single-tenant |
Available Tools
Section titled “Available Tools”The MCP server provides 55 tools across 9 modules:
1. Jobs (7 tools)
Section titled “1. Jobs (7 tools)”fetch_jobs- Query jobs with filters and paginationcreate_job- Create new manufacturing jobsupdate_job- Update job propertiesstart_job- Start job executionstop_job- Pause/stop jobcomplete_job- Mark job as completedresume_job- Resume paused job
2. Parts (2 tools)
Section titled “2. Parts (2 tools)”fetch_parts- Query parts with relationshipsupdate_part- Update part properties
3. Operations (5 tools)
Section titled “3. Operations (5 tools)”fetch_operations- Query operations with filtersstart_operation- Begin operation executionpause_operation- Pause operationcomplete_operation- Complete operationupdate_operation- Update operation details
4. Tasks (2 tools)
Section titled “4. Tasks (2 tools)”fetch_tasks- Query tasksupdate_task- Update task status
5. Issues (8 tools)
Section titled “5. Issues (8 tools)”fetch_issues- Query quality issuescreate_ncr- Create Non-Conformance Reportsfetch_ncrs- Query NCRsupdate_issue- Update issue statusget_issue_analytics- Issue trend analysisget_issue_trends- Historical issue patternsget_root_cause_analysis- Root cause insightssuggest_quality_improvements- AI-powered recommendations
6. Substeps (5 tools)
Section titled “6. Substeps (5 tools)”fetch_substeps- Query operation substepsadd_substep- Add substep to operationcomplete_substep- Mark substep completeupdate_substep- Update substepdelete_substep- Remove substep
7. Dashboard (3 tools)
Section titled “7. Dashboard (3 tools)”get_dashboard_stats- Real-time production metricsget_qrm_data- Quick Response Manufacturing capacityget_production_metrics- Historical production data
8. Scrap (7 tools)
Section titled “8. Scrap (7 tools)”fetch_scrap_reasons- Query scrap categoriesreport_scrap- Record scrap eventsget_scrap_analytics- Scrap analysisget_scrap_trends- Scrap patterns over timeget_yield_metrics- Production yield ratesget_scrap_pareto- Pareto analysis of scrap causesget_quality_score- Overall quality metrics
9. Agent Batch (11 tools)
Section titled “9. Agent Batch (11 tools)”Optimized batch operations for AI agents:
batch_update_parts- Bulk part updatesbatch_reschedule_operations- Bulk reschedulingprioritize_job- Set job priorityfetch_parts_by_customer- Customer-scoped queriesbatch_complete_operations- Bulk completionget_job_overview- Comprehensive job summarycheck_resource_availability- Resource planningassign_resource_to_operations- Resource allocationget_cell_capacity- Cell utilizationget_parts_due_soon- Due date alertssuggest_reschedule- AI-powered rescheduling
Testing Your Setup
Section titled “Testing Your Setup”1. Verify Server is Running
Section titled “1. Verify Server is Running”Local mode:
npm start# Should output:# Eryxon Flow MCP Server v2.5.0# Loaded 55 tools from 9 modules# Eryxon Flow MCP Server running on stdioCloud mode:
curl https://your-mcp-server.railway.app/health# Should return: {"status": "ok"}2. Test in Claude Desktop
Section titled “2. Test in Claude Desktop”Ask Claude:
"Show me all jobs currently in progress"Claude should use the fetch_jobs tool with status: "in_progress".
3. Verify Tool Access
Section titled “3. Verify Tool Access”Ask Claude:
"What tools do you have available from Eryxon Flow?"Claude should list all 55 tools.
Troubleshooting
Section titled “Troubleshooting””MCP server not found”
Section titled “”MCP server not found””Issue: Claude Desktop can’t find the server
Solutions:
- Verify absolute paths in config (no
~or relative paths) - Ensure
npm run buildcompleted successfully - Check
dist/index.jsexists - Restart Claude Desktop after config changes
”Permission denied” or “EACCES”
Section titled “”Permission denied” or “EACCES””Issue: Node can’t execute the script
Solution:
chmod +x mcp-server/dist/index.js“Supabase connection failed”
Section titled ““Supabase connection failed””Issue: Can’t connect to database
Solutions:
- Verify
SUPABASE_URLis correct - Check
SUPABASE_SERVICE_KEYorERYXON_API_KEYis valid - Test connection manually:
curl https://your-project.supabase.co/rest/v1/jobs \ -H "apikey: YOUR_ANON_KEY_HERE" \ -H "Authorization: Bearer YOUR_SERVICE_KEY_HERE"“No tools available”
Section titled ““No tools available””Issue: Tools not loading
Solutions:
- Check server logs for errors
- Verify build output:
ls -la mcp-server/dist/tools/ - Ensure all dependencies installed:
npm ci
”Rate limited”
Section titled “”Rate limited””Issue: Too many requests
Solution:
- For cloud mode: Add Redis caching (Upstash)
- For local mode: Reduce request frequency
Security Best Practices
Section titled “Security Best Practices”For Self-Hosted (Direct Mode)
Section titled “For Self-Hosted (Direct Mode)”- Never commit service keys to version control
- Use environment variables for all secrets
- Restrict service key to specific IP ranges if possible
- Enable RLS policies on all tables
- Monitor usage via Supabase dashboard
For Cloud (API Mode)
Section titled “For Cloud (API Mode)”- Generate unique API keys per user
- Rotate keys regularly (every 90 days)
- Set key expiration dates
- Monitor API usage and set rate limits
- Use HTTPS only for MCP server endpoints
- Enable Redis caching to reduce database load
Updating the MCP Server
Section titled “Updating the MCP Server”Local Mode
Section titled “Local Mode”cd mcp-servergit pull origin mainnpm cinpm run build# Restart Claude DesktopCloud Mode
Section titled “Cloud Mode”Railway:
git push # Railway auto-deploysFly.io:
flyctl deployPerformance Optimization
Section titled “Performance Optimization”Caching (Cloud Mode)
Section titled “Caching (Cloud Mode)”Add Redis caching for frequently accessed data:
# Set in Railway/Fly.ioUPSTASH_REDIS_REST_URL="https://your-redis.upstash.io"UPSTASH_REDIS_REST_TOKEN="your-token"Default TTL: 5 minutes for fetch operations
Query Optimization
Section titled “Query Optimization”The server includes:
- Pagination - All fetch operations support
limitandoffset - Soft-delete filtering - Automatically excludes deleted records
- Timeout protection - 30-second query timeout (configurable)
Migration from v2.3 to v2.5
Section titled “Migration from v2.3 to v2.5”Breaking changes: None (100% backward compatible)
New features:
- ✅ Zod runtime validation (catches invalid inputs early)
- ✅ Tool factory pattern (60% less code duplication)
- ✅ Enhanced error messages with context
- ✅ Pagination metadata (
has_more,totalcount) - ✅ Race condition prevention in state transitions
To upgrade:
cd mcp-servernpm cinpm run build# Restart Claude Desktop or redeploySupport
Section titled “Support”- Documentation: Website Docs
- Demo Guide: MCP Demo Guide
- API Reference: REST API Docs
- Self-Hosting: Self-Hosting Guide
Need help? The MCP server is fully open source. Check the source code in mcp-server/src/ for implementation details.