Labamu MCP Server

Labamu MCP Server

Enables AI assistants like Claude to securely interact with Labamu's Material Resource Planning (MRP) and business APIs for inventory, vendor, batch, product, and invoice management through the Model Context Protocol.

Category
Visit Server

README

Labamu MCP Server

A secure, production-ready Model Context Protocol (MCP) server that provides Claude Desktop with access to Labamu's business APIs for material inventory management, vendor management, batch tracking, customer data, and invoice operations.

Version TypeScript Security

Overview

The Labamu MCP Server enables AI assistants like Claude to securely interact with Labamu's Material Resource Planning (MRP) and business APIs through the Model Context Protocol. Built on Cloudflare Workers for global edge deployment with enterprise-grade security.

Key Features

  • πŸ”’ Security First: JWT authentication, input validation, sanitized logging
  • ⚑ High Performance: Global edge deployment, <100ms response times
  • πŸ”§ Developer Friendly: Clean architecture, comprehensive documentation
  • πŸ“Š Production Ready: Monitoring, error handling, feature flags
  • πŸš€ Scalable: Serverless architecture with automatic scaling

Quick Start

Prerequisites

  • Node.js 18+
  • Cloudflare account
  • Labamu API credentials
  • Claude Desktop

1. Installation

git clone https://github.com/your-org/labamu-mcp
cd labamu-mcp
npm install

2. Deployment

# Build and deploy to Cloudflare Workers
npm run build
npm run deploy

3. Configuration

Copy the template and configure your Claude Desktop:

cp claude-desktop-config-template.json claude-desktop-config.json
# Edit claude-desktop-config.json with your JWT token

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "labamu": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote@latest",
        "https://labamu-mcp.your-subdomain.workers.dev/sse",
        "--header",
        "Authorization:Bearer ${LABAMU_API_KEY}"
      ],
      "env": {
        "LABAMU_API_KEY": "your-jwt-token-here"
      }
    }
  }
}

Available Tools

Material Management

Tool Description Status
get_materials List materials with filtering and pagination βœ… Active
get_material_by_id Retrieve specific material by UUID βœ… Active
update_material Update material properties βœ… Active
delete_material Remove material from inventory βœ… Active
bulk_create_materials Create multiple materials from CSV/JSON βœ… Active

Vendor Management

Tool Description Status
get_vendors List vendors with filtering and pagination βœ… Active
bulk_create_vendors Create multiple vendors in bulk βœ… Active
bulk_delete_vendors Delete multiple vendors by IDs βœ… Active
update_vendor Update vendor information βœ… Active

Batch Management

Tool Description Status
get_batches List material batches with filtering βœ… Active
bulk_create_batches Create multiple batches with vendor tracking βœ… Active
bulk_update_batches Update multiple batches (partial updates) βœ… Active
bulk_delete_batches Delete batches by IDs βœ… Active

Product Management

Tool Description Status
get_products List products with category, BOM, and pricing βœ… Active
create_product Create new product with pricing and category βœ… Active
bulk_create_products Create multiple products in bulk βœ… Active
get_products_with_bom List products that have BOMs attached βœ… Active
get_product_by_id Get product details by UUID βœ… Active
update_product Update product information βœ… Active
delete_product Delete product by ID βœ… Active
get_categories List product categories βœ… Active
create_category Create new category βœ… Active
get_category_by_id Get category details by UUID βœ… Active
update_category Update category information βœ… Active
delete_category Delete category by ID βœ… Active
get_boms List Bills of Materials with routing and costs βœ… Active
create_bom Create new BOM with materials and routing βœ… Active
get_bom_cogs_breakdown Get COGS breakdown for a BOM βœ… Active
get_bom_suggested_price Get suggested pricing from BOM costs βœ… Active
get_bom_by_id Get BOM details by UUID βœ… Active
update_bom Update BOM information βœ… Active
delete_bom Delete BOM by ID βœ… Active
check_bom_usage Check if BOM is used in products βœ… Active
get_material_usages List material usages with filtering βœ… Active
create_material_usage Create material usage for BOM βœ… Active
bulk_create_material_usages Create multiple material usages βœ… Active
get_material_usage_by_id Get material usage by UUID βœ… Active
update_material_usage Update material usage βœ… Active
delete_material_usage Delete material usage by ID βœ… Active

Legacy Tools (Disabled)

Tool Description Status
get_merchant Fetch merchant profile 🚫 Disabled
list_customers List customer data 🚫 Disabled
create_invoice Generate invoices 🚫 Disabled
search General search functionality 🚫 Disabled
fetch HTTP fetch utility 🚫 Disabled

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Claude        β”‚    β”‚   MCP Server    β”‚    β”‚   Labamu APIs   β”‚
β”‚   Desktop       │◄──►│  (CF Workers)   │◄──►│   (MRP/Business)β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ - Authenticationβ”‚    β”‚ - Validation    β”‚    β”‚ - Business Logicβ”‚
β”‚ - Tool Calls    β”‚    β”‚ - Security      β”‚    β”‚ - Data Storage  β”‚
β”‚ - Responses     β”‚    β”‚ - Logging       β”‚    β”‚ - Processing    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Security Model

  • Client-side Authentication: JWT tokens stored securely in Claude Desktop
  • Header-based Transport: Secure token transmission via Authorization headers
  • Input Validation: Comprehensive schema validation for all inputs
  • Sanitized Logging: Sensitive data automatically redacted
  • CORS Protection: Restrictive cross-origin resource sharing

Development

Local Development

# Start development server
npm run dev

# Run tests
npm run test

# Watch mode
npm run test:watch

# Type checking
npm run build

Project Structure

src/
β”œβ”€β”€ config/           # Security and configuration
β”œβ”€β”€ core/             # Base classes and MCP server
β”œβ”€β”€ tools/            # Tool implementations
β”‚   └── materials/    # Material management tools
β”œβ”€β”€ types/            # TypeScript definitions
β”œβ”€β”€ utils/            # Shared utilities
└── index.ts         # Worker entry point

Adding New Tools

  1. Create tool class extending BaseTool
  2. Add to tool registry in server
  3. Configure feature flag in wrangler.toml
  4. Write comprehensive tests
  5. Update documentation

See DEVELOPMENT.md for detailed guidelines.

Security

Authentication Flow

  1. JWT token stored in Claude Desktop environment variables
  2. Token transmitted via Authorization: Bearer header
  3. Server validates JWT format and structure
  4. Token forwarded to upstream Labamu APIs
  5. Response data sanitized before logging

Security Features

  • JWT format validation
  • Input schema validation
  • Request sanitization
  • Error message sanitization
  • Security headers on all responses
  • No sensitive data logging

See SECURITY.md for comprehensive security documentation.

Configuration

Feature Flags

Tools can be enabled/disabled via environment variables:

# wrangler.toml
FEATURE_GET_MATERIALS_ENABLED = "true"
FEATURE_UPDATE_MATERIAL_ENABLED = "true"
FEATURE_DELETE_MATERIAL_ENABLED = "true"

Environment Variables

Variable Description Default
LABAMU_MRP_API_BASE MRP API base URL https://mrp-api-dev.cashenable.com
LABAMU_API_BASE Business API base URL https://openapi-stg.cashenable.com

Monitoring

Health Check

curl https://labamu-mcp.your-subdomain.workers.dev/healthz

Returns server status and enabled tools:

{
  "status": "ok",
  "version": "2.4.0",
  "timestamp": "2025-09-30T12:00:00.000Z",
  "tools": ["get_materials", "get_material_by_id", "update_material", "delete_material", "bulk_create_materials"],
  "auth_mode": "client_provided"
}

Logging

# Monitor live logs
wrangler tail --format pretty

# Filter specific events
wrangler tail | grep ERROR

Testing

Test Coverage

  • Unit Tests: Tool logic and validation
  • Integration Tests: End-to-end MCP protocol
  • Security Tests: Authentication and input validation
# Run all tests
npm test

# Coverage report
npm run test:coverage

API Reference

Material Management

Get Materials

{
  "tool": "get_materials",
  "arguments": {
    "page": 1,
    "size": 10,
    "category_id": "uuid",
    "sku": "MAT-001",
    "name": "Steel Rod",
    "classification": "A",
    "type": "RAW",
    "is_stockable": true,
    "keyword": "search term"
  }
}

Get Material by ID

{
  "tool": "get_material_by_id",
  "arguments": {
    "id": "20858588-ef10-4629-b01c-5b3fa6bfef6d"
  }
}

Update Material

{
  "tool": "update_material",
  "arguments": {
    "id": "20858588-ef10-4629-b01c-5b3fa6bfef6d",
    "name": "Updated Steel Rod",
    "classification": "A",
    "status": "ACTIVE"
  }
}

Product Management

Get Products

{
  "tool": "get_products",
  "arguments": {
    "page": 1,
    "size": 10,
    "name": "Meja",
    "sku": "PROD-001",
    "category_id": "uuid",
    "status": "ACTIVE",
    "keyword": "furniture",
    "sort": "updated_at:desc"
  }
}

Get Categories

{
  "tool": "get_categories",
  "arguments": {
    "page": 1,
    "size": 10,
    "name": "Rak Besi",
    "status": "ACTIVE",
    "keyword": "metal",
    "sort": "name:asc"
  }
}

Get BOMs

{
  "tool": "get_boms",
  "arguments": {
    "page": 1,
    "size": 10,
    "name": "Pembuatan",
    "product_id": "uuid",
    "status": "ACTIVE",
    "without_product": false,
    "sort": "created_at:desc"
  }
}

See individual tool files for complete API documentation.

Troubleshooting

Common Issues

Authentication Errors

Failed to retrieve materials: Invalid token provided

Solution: Verify JWT token format and expiration in Claude Desktop config.

Tool Not Available

Unknown tool: get_materials

Solution: Check feature flag is enabled in wrangler.toml.

CORS Errors

Solution: Ensure requests include proper headers and origin.

Debug Mode

Enable detailed logging by checking Cloudflare Workers logs:

wrangler tail --format pretty

Contributing

We welcome contributions! Please see our DEVELOPMENT.md guide for:

  • Development setup
  • Coding standards
  • Testing requirements
  • Security guidelines

Pull Request Process

  1. Fork the repository
  2. Create a feature branch
  3. Implement changes with tests
  4. Update documentation
  5. Submit pull request

Documentation

Deployment

Production Checklist

  • [ ] All tests passing
  • [ ] TypeScript compilation successful
  • [ ] Feature flags configured
  • [ ] Health endpoint accessible
  • [ ] Claude Desktop configuration updated
  • [ ] Security review completed

Rollback Procedure

# Quick feature disable
# Set feature flag to "false" in wrangler.toml
npm run deploy

# Full rollback
git revert HEAD
npm run deploy

License

This project is licensed under the ISC License - see the LICENSE file for details.

Support

For issues and questions:

  1. Check troubleshooting section
  2. Review security guidelines
  3. Open an issue with detailed information

Changelog

v2.9.0 (Current)

  • Major Release: Added 23 new product management tools (CRUD operations)
  • Products: Full CRUD + bulk operations + BOM-filtered queries
  • Categories: Complete category management (create, read, update, delete)
  • BOMs: Full BOM lifecycle + COGS breakdown + pricing suggestions + usage tracking
  • Material Usages: Complete material usage management for BOMs
  • All tools follow TDD with comprehensive unit tests (80+ tests passing)
  • Total active tools: 39 tools (up from 16)

v2.8.0

  • Added product management tools (get_products, get_categories, get_boms)
  • Support for complex product structures with BOMs and routing
  • Category filtering and management
  • Cost of Goods Sold (COGS) calculations in BOMs
  • Comprehensive unit tests for all product tools

v2.7.0

  • Added batch management with vendor tracking
  • Bulk operations for batches (create, update, delete)
  • Enhanced filtering capabilities

v2.4.0

  • Added material management tools (get, update, delete by ID)
  • Improved security with sanitized logging
  • Added comprehensive error handling
  • Enhanced authentication validation

v2.3.0

  • Added get_materials tool with filtering
  • Fixed authentication header handling
  • Improved documentation

v2.2.0

  • Added bulk material creation
  • Enhanced error handling

Built with TypeScript, Cloudflare Workers, and security best practices.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured