elegibility-engine-mcp-rs

alpha-hack-program/elegibility-engine-mcp-rs

3.1

If you are the rightful owner of elegibility-engine-mcp-rs and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Elegibility Engine MCP Server is a demonstration project showcasing the implementation of a Model Context Protocol (MCP) server for evaluating leave assistance eligibility based on fictional regulations.

Elegibility Engine MCP Server

Example Model Context Protocol (MCP) Server demonstrating leave assistance evaluation based on fictional regulations

CI Pipeline License: MIT Rust

An example Model Context Protocol (MCP) server developed in Rust that demonstrates how to evaluate complex business rules using the ZEN Engine decision engine. This project serves as a reference implementation for building MCP servers with rule-based decision systems.

โš ๏ธ DISCLAIMER

This is a demonstration/example project only. The regulations, amounts, and evaluation logic implemented here are fictional and created solely for educational and demonstration purposes. This software:

  • Should NOT be used for actual legal or administrative decisions
  • Does NOT represent real government regulations
  • Is NOT affiliated with any official government entity
  • Serves as a technical example of MCP server implementation

For real legal advice or official information about leave assistance, please consult official government sources and qualified legal professionals.

๐ŸŽฏ Features

  • 5 Example Evaluation Scenarios: Demonstrates implementation of complex rule sets (A-E)
  • Decision Engine Integration: Shows how to use ZEN Engine for rule-based evaluation
  • Multiple Transport Protocols: Examples of STDIO, SSE, and HTTP streamable implementations
  • Robust Input Validation: Demonstrates JSON schema validation with detailed error handling
  • Production-Ready Containerization: Example Docker/Podman setup for deployment
  • Claude Desktop Integration: Example DXT packaging for MCP integration

๐Ÿ“‹ Example Assistance Scenarios (Fictional)

ScenarioDescriptionExample Monthly Amount
ACare for first-degree relative (illness/accident)725โ‚ฌ
BThird child or more with newborn500โ‚ฌ
CAdoption or foster care500โ‚ฌ
DMultiple birth, adoption, or foster care500โ‚ฌ
ESingle-parent families500โ‚ฌ

Note: These scenarios and amounts are completely fictional and used only for demonstration purposes.

๐Ÿš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/alpha-hack-program/elegibility-engine-mcp-rs.git
cd elegibility-engine-mcp-rs

# Build all servers
make build-all

# Or build individually
make build-sse      # SSE Server
make build-mcp      # MCP HTTP Server
make build-stdio    # STDIO Server for Claude

Running

# SSE Server (recommended for development)
make test-sse

# MCP HTTP Server
make test-mcp

# Or directly
RUST_LOG=debug ./target/release/sse_server

๐Ÿ”ง Configuration

Environment Variables

# Server configuration
HOST=127.0.0.1          # Bind address (0.0.0.0 for containers)
PORT=8001               # Server port
RUST_LOG=info           # Logging level (debug, info, warn, error)

# Or use BIND_ADDRESS directly
BIND_ADDRESS=127.0.0.1:8001

Example Usage

{
  "input": {
    "relationship": "mother",
    "situation": "illness",
    "single_parent_family": false,
    "number_of_children": 2
  }
}

Example Response:

{
  "output": {
    "case": "A",
    "description": "Care for first-degree relative (illness or accident)",
    "monthly_benefit": 725,
    "potentially_eligible": true,
    "additional_requirements": "The person must have been hospitalized..."
  }
}

Important: This is example data for demonstration purposes only.

๐Ÿณ Containerization

Build and Run

This requires podman or docker. Adapt .env to your needs.

# Build container image
./image.sh build

# Run locally
./image.sh run

# Run from remote registry
./image.sh push
./image.sh run-remote

Environment Variables for Containers

# Production configuration
docker run -p 8001:8001 \
  -e HOST=0.0.0.0 \
  -e PORT=8001 \
  -e RUST_LOG=info \
  quay.io/atarazana/elegibility-engine-mcp-server:latest

๐Ÿ“ฆ Claude Desktop Integration

Packaging

# Create DXT package for Claude Desktop
make pack

Example Claude Configuration

Drag and drop the DXT file into the Settings->Extensions dropping area.

Note: This demonstrates MCP integration patterns and is not intended for production use with real data.

๐Ÿงช Testing

# Run all tests
make test

Manual Testing Examples

Run the server: make test-sse or ./image.sh run.

This requires NodeJS 19+.

In another terminal.

make inspector

Then connect your browser to the suggest url given by the MCP inspector. Once there connect to http://localhost:${PORT}/sse

PORT is set in .env

Connect and list tools, select the tool and use this JSON.

{
    "relationship": "son",
    "situation": "birth",
    "single_parent_family": true
}

๐Ÿ› ๏ธ Development

Available Commands

make help                    # Show help
make build-all              # Build all servers
make clean                  # Clean artifacts
make fmt                    # Format code
make lint                   # Run clippy
make audit                  # Security audit
make dev                    # Development server with auto-reload

Project Structure

โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ common/
โ”‚   โ”‚   โ”œโ”€โ”€ eligibility_engine.rs      # MCP logic and decision engine
โ”‚   โ”‚   โ””โ”€โ”€ mod.rs
โ”‚   โ”œโ”€โ”€ sse_server.rs           # SSE Server
โ”‚   โ”œโ”€โ”€ mcp_server.rs           # MCP HTTP Server
โ”‚   โ””โ”€โ”€ stdio_server.rs         # STDIO Server
โ”œโ”€โ”€ dxt/
โ”‚   โ””โ”€โ”€ manifest.json           # Claude Desktop manifest
โ”œโ”€โ”€ Containerfile              # Container definition
โ”œโ”€โ”€ Makefile                   # Build commands
โ””โ”€โ”€ container.sh               # Container management script

Debug and Monitoring

# Debug proxy
make proxy                  # Start mitmproxy on port 8888

# MCP Inspector
make inspector              # Start MCP Inspector

# Supergateway for SSE
make sgw-sse               # STDIO -> SSE wrapping

# Supergateway for MCP
make sgw-mcp               # STDIO -> MCP HTTP wrapping

๐Ÿ“š API Reference

Main Endpoint

POST /message - Example endpoint for rule evaluation

Example Input Parameters

FieldTypeRequiredDescription
relationshipstringโœ…Family relationship (father, mother, son, daughter, spouse, partner, husband, wife, woman, man)
situationstringโœ…Care reason (birth, adoption, foster_care, illness, accident, etc.)
single_parent_familybooleanโœ…Is it a single-parent family?
number_of_childrennumberโŒNumber of children (optional, required for Case B)

Response

FieldTypeDescription
casestringApplicable scenario letter (A-E)
descriptionstringScenario description
monthly_benefitnumberMonthly amount in euros
potentially_eligiblebooleanMeets basic requirements?
additional_requirementsstringAdditional specific requirements
erroresarrayList of validation errors
warningsarrayWarnings and additional information

๐Ÿ”’ Security

  • Input validation: Strict JSON schemas
  • Non-root user: Containers run as user 1001
  • Security audit: cargo audit in CI/CD
  • Minimal image: Based on UBI 9 minimal

๐Ÿค Contributing

  1. Fork the project
  2. Create feature branch (git checkout -b feature/new-feature)
  3. Commit changes (git commit -am 'Add new feature')
  4. Push to branch (git push origin feature/new-feature)
  5. Create Pull Request

Guidelines

  • Follow code style with cargo fmt
  • Pass linting with cargo clippy
  • Add tests for new functionality
  • Update documentation as needed

๐Ÿ“„ License

This project is licensed under the MIT License - see for details.

๐Ÿ™‹ Support

๐Ÿท๏ธ Tags

mcp model-context-protocol rust eligibility-engine unpaid-leave zen-engine claude decision-engine


Developed with โค๏ธ by Alpha Hack Group