Model Context Protocol server for M/M/1 queue simulation and analysis
Project description
MCP Server for M/M/1 Queue Simulation
A Model Context Protocol server that provides comprehensive resources, tools, and prompts for M/M/1 queuing system simulation and analysis.
What is M/M/1?
M/M/1 is a fundamental queuing model in operations research:
- First M: Markovian (Poisson) arrivals
- Second M: Markovian (exponential) service times
- 1: Single server
This MCP server enables LLMs like Claude to:
- Access structured M/M/1 theory and formulas
- Validate simulation parameters
- Calculate theoretical performance metrics
- Generate and execute SimPy simulations
- Compare simulation results with theory
Features
📚 Resources (7)
mm1://schema- Complete M/M/1 system schemamm1://parameters- Parameter definitions with constraintsmm1://metrics- Performance metrics catalogmm1://formulas- Theoretical formulasmm1://guidelines- Implementation best practicesmm1://examples- Pre-configured scenariosmm1://literature- References and citations
🔧 Tools (5)
validate_config- Validate M/M/1 parameters and check stabilitycalculate_metrics- Compute theoretical performance metricsrun_simulation- Execute SimPy discrete event simulationcompare_results- Analyze simulation accuracyrecommend_parameters- Suggest optimal configuration
💬 Prompts (4)
generate_simulation_code- Create production-ready SimPy codeexplain_mm1_theory- Educational content on M/M/1 theoryanalyze_results- Interpret simulation outcomesdebug_simulation- Troubleshoot common issues
Installation
Option 1: Using uvx (Recommended)
uvx mcp-server-mm1
Option 2: Using pip
pip install mcp-server-mm1
mcp-server-mm1
Option 3: From Source
git clone https://github.com/yourusername/mcp-server-mm1.git
cd mcp-server-mm1
uv pip install -e .
mcp-server-mm1
Usage with Claude Desktop
Add to your claude_desktop_config.json:
macOS
Location: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows
Location: %APPDATA%\Claude\claude_desktop_config.json
Configuration
{
"mcpServers": {
"mm1-simulation": {
"command": "uvx",
"args": ["mcp-server-mm1"]
}
}
}
Restart Claude Desktop and the server will be available!
Example Usage in Claude
1. Get M/M/1 Schema
User: Show me the M/M/1 queue schema
Claude uses: mm1://schema resource
2. Validate Configuration
User: Is λ=5, μ=8 a valid M/M/1 configuration?
Claude uses: validate_config tool
Result: ✓ Valid, ρ=0.625
3. Calculate Theoretical Metrics
User: Calculate theoretical metrics for λ=5, μ=8
Claude uses: calculate_metrics tool
Result:
- Utilization: 0.625
- Avg queue length: 1.0417
- Avg waiting time: 0.2083
- Avg system time: 0.3333
4. Run Simulation
User: Run a simulation with λ=5, μ=8 for 10,000 time units
Claude uses: run_simulation tool
Result: Simulation metrics + theoretical comparison + accuracy analysis
5. Generate Code
User: Generate SimPy code for λ=3, μ=10
Claude uses: generate_simulation_code prompt
Result: Complete, production-ready Python code
Development
Setup Development Environment
# Clone repository
git clone https://github.com/yourusername/mcp-server-mm1.git
cd mcp-server-mm1
# Install dependencies
uv pip install -e ".[dev]"
Run Tests
pytest
Code Quality
# Format code
black src/ tests/
# Lint
ruff check src/ tests/
# Type check
mypy src/
Local Testing
Use the MCP Inspector to test the server locally:
# Install MCP inspector (if not already installed)
npm install -g @modelcontextprotocol/inspector
# Run server with inspector
mcp dev src/mcp_server_mm1/server.py
This opens a web interface where you can:
- Browse available resources
- Test tool invocations
- Try prompt templates
- Inspect JSON-RPC communication
Architecture
src/mcp_server_mm1/
├── server.py # FastMCP server with resources/tools/prompts
├── schemas/
│ └── mm1_schema.py # M/M/1 system schema definition
├── simulations/
│ └── mm1_queue.py # SimPy simulation implementation
└── utils/
└── metrics.py # Theoretical calculations
M/M/1 Theory Quick Reference
Key Formulas
Given arrival rate λ and service rate μ:
- Utilization: ρ = λ/μ
- Avg Queue Length: L_q = ρ²/(1-ρ)
- Avg Time in Queue: W_q = ρ/(μ(1-ρ))
- Avg Time in System: W = 1/(μ(1-ρ))
Stability Condition
System must satisfy ρ < 1 (λ < μ)
If ρ ≥ 1, the queue grows unbounded!
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
License
MIT License - see LICENSE file for details.
Related Work
This MCP server was developed as part of research on LLM-assisted simulation code generation for the Winter Simulation Conference (WSC) 2025.
References
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with ❤️ for the simulation and LLM communities
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_mm1-0.1.3.tar.gz.
File metadata
- Download URL: mcp_server_mm1-0.1.3.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
386be29b931efa109381aa2dd6b4e486aa8d366f08fa0f47d18f76b919796a05
|
|
| MD5 |
3bd95eb0044c2f71281efaedd4730f48
|
|
| BLAKE2b-256 |
c910a486616020688edf6b521600a2308895f96acf1a332a97539a9451d6f567
|
File details
Details for the file mcp_server_mm1-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mcp_server_mm1-0.1.3-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad197a0dd261eeabd186129581b7aea222d2dc90733143a170df77a818c39f3
|
|
| MD5 |
10b9303d60895e86cad05a0795f0f9f2
|
|
| BLAKE2b-256 |
94ec4826445bfa5deaf6c93414871713690874fdf02ac1a1550cc95adda1b15e
|