# MCP Server for M/M/1 Queue Simulation
A [Model Context Protocol](https://modelcontextprotocol.io/) server that provides comprehensive resources, tools, and prompts for M/M/1 queuing system simulation and analysis.
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[](https://modelcontextprotocol.io/)
## 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 schema
- `mm1://parameters` - Parameter definitions with constraints
- `mm1://metrics` - Performance metrics catalog
- `mm1://formulas` - Theoretical formulas
- `mm1://guidelines` - Implementation best practices
- `mm1://examples` - Pre-configured scenarios
- `mm1://literature` - References and citations
### 🔧 Tools (5)
- `validate_config` - Validate M/M/1 parameters and check stability
- `calculate_metrics` - Compute theoretical performance metrics
- `run_simulation` - Execute SimPy discrete event simulation
- `compare_results` - Analyze simulation accuracy
- `recommend_parameters` - Suggest optimal configuration
### 💬 Prompts (4)
- `generate_simulation_code` - Create production-ready SimPy code
- `explain_mm1_theory` - Educational content on M/M/1 theory
- `analyze_results` - Interpret simulation outcomes
- `debug_simulation` - Troubleshoot common issues
## Installation
### Option 1: Using `uvx` (Recommended)
```bash
uvx mcp-server-mm1
```
### Option 2: Using `pip`
```bash
pip install mcp-server-mm1
mcp-server-mm1
```
### Option 3: From Source
```bash
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
```json
{
"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
```bash
# 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
```bash
pytest
```
### Code Quality
```bash
# 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:
```bash
# 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:
1. Fork the repository
2. Create a feature branch
3. Make your changes with tests
4. Submit a pull request
## License
MIT License - see [LICENSE](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
- [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
- [SimPy Documentation](https://simpy.readthedocs.io/)
- [M/M/1 Queue - Wikipedia](https://en.wikipedia.org/wiki/M/M/1_queue)
## Support
- **Issues**: [GitHub Issues](https://github.com/yourusername/mcp-server-mm1/issues)
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/mcp-server-mm1/discussions)
---
**Made with ❤️ for the simulation and LLM communities**
Raw data
{
"_id": null,
"home_page": null,
"name": "mcp-server-mm1",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "mcp, model-context-protocol, simulation, queue, mm1, queueing-theory, simpy, discrete-event-simulation",
"author": null,
"author_email": "WSC 2025 Research Project <noreply@example.com>",
"download_url": "https://files.pythonhosted.org/packages/d2/c2/f84f7f8916380eec77dc53c180ffc04ee48a6e5be1c4e9069e55c73a19b6/mcp_server_mm1-0.1.0.tar.gz",
"platform": null,
"description": "# MCP Server for M/M/1 Queue Simulation\r\n\r\nA [Model Context Protocol](https://modelcontextprotocol.io/) server that provides comprehensive resources, tools, and prompts for M/M/1 queuing system simulation and analysis.\r\n\r\n[](https://www.python.org/downloads/)\r\n[](https://opensource.org/licenses/MIT)\r\n[](https://modelcontextprotocol.io/)\r\n\r\n## What is M/M/1?\r\n\r\nM/M/1 is a fundamental queuing model in operations research:\r\n- **First M**: Markovian (Poisson) arrivals\r\n- **Second M**: Markovian (exponential) service times\r\n- **1**: Single server\r\n\r\nThis MCP server enables LLMs like Claude to:\r\n- Access structured M/M/1 theory and formulas\r\n- Validate simulation parameters\r\n- Calculate theoretical performance metrics\r\n- Generate and execute SimPy simulations\r\n- Compare simulation results with theory\r\n\r\n## Features\r\n\r\n### \ud83d\udcda Resources (7)\r\n- `mm1://schema` - Complete M/M/1 system schema\r\n- `mm1://parameters` - Parameter definitions with constraints\r\n- `mm1://metrics` - Performance metrics catalog\r\n- `mm1://formulas` - Theoretical formulas\r\n- `mm1://guidelines` - Implementation best practices\r\n- `mm1://examples` - Pre-configured scenarios\r\n- `mm1://literature` - References and citations\r\n\r\n### \ud83d\udd27 Tools (5)\r\n- `validate_config` - Validate M/M/1 parameters and check stability\r\n- `calculate_metrics` - Compute theoretical performance metrics\r\n- `run_simulation` - Execute SimPy discrete event simulation\r\n- `compare_results` - Analyze simulation accuracy\r\n- `recommend_parameters` - Suggest optimal configuration\r\n\r\n### \ud83d\udcac Prompts (4)\r\n- `generate_simulation_code` - Create production-ready SimPy code\r\n- `explain_mm1_theory` - Educational content on M/M/1 theory\r\n- `analyze_results` - Interpret simulation outcomes\r\n- `debug_simulation` - Troubleshoot common issues\r\n\r\n## Installation\r\n\r\n### Option 1: Using `uvx` (Recommended)\r\n\r\n```bash\r\nuvx mcp-server-mm1\r\n```\r\n\r\n### Option 2: Using `pip`\r\n\r\n```bash\r\npip install mcp-server-mm1\r\nmcp-server-mm1\r\n```\r\n\r\n### Option 3: From Source\r\n\r\n```bash\r\ngit clone https://github.com/yourusername/mcp-server-mm1.git\r\ncd mcp-server-mm1\r\nuv pip install -e .\r\nmcp-server-mm1\r\n```\r\n\r\n## Usage with Claude Desktop\r\n\r\nAdd to your `claude_desktop_config.json`:\r\n\r\n### macOS\r\nLocation: `~/Library/Application Support/Claude/claude_desktop_config.json`\r\n\r\n### Windows\r\nLocation: `%APPDATA%\\Claude\\claude_desktop_config.json`\r\n\r\n### Configuration\r\n\r\n```json\r\n{\r\n \"mcpServers\": {\r\n \"mm1-simulation\": {\r\n \"command\": \"uvx\",\r\n \"args\": [\"mcp-server-mm1\"]\r\n }\r\n }\r\n}\r\n```\r\n\r\nRestart Claude Desktop and the server will be available!\r\n\r\n## Example Usage in Claude\r\n\r\n### 1. Get M/M/1 Schema\r\n```\r\nUser: Show me the M/M/1 queue schema\r\n\r\nClaude uses: mm1://schema resource\r\n```\r\n\r\n### 2. Validate Configuration\r\n```\r\nUser: Is \u03bb=5, \u03bc=8 a valid M/M/1 configuration?\r\n\r\nClaude uses: validate_config tool\r\nResult: \u2713 Valid, \u03c1=0.625\r\n```\r\n\r\n### 3. Calculate Theoretical Metrics\r\n```\r\nUser: Calculate theoretical metrics for \u03bb=5, \u03bc=8\r\n\r\nClaude uses: calculate_metrics tool\r\nResult:\r\n- Utilization: 0.625\r\n- Avg queue length: 1.0417\r\n- Avg waiting time: 0.2083\r\n- Avg system time: 0.3333\r\n```\r\n\r\n### 4. Run Simulation\r\n```\r\nUser: Run a simulation with \u03bb=5, \u03bc=8 for 10,000 time units\r\n\r\nClaude uses: run_simulation tool\r\nResult: Simulation metrics + theoretical comparison + accuracy analysis\r\n```\r\n\r\n### 5. Generate Code\r\n```\r\nUser: Generate SimPy code for \u03bb=3, \u03bc=10\r\n\r\nClaude uses: generate_simulation_code prompt\r\nResult: Complete, production-ready Python code\r\n```\r\n\r\n## Development\r\n\r\n### Setup Development Environment\r\n\r\n```bash\r\n# Clone repository\r\ngit clone https://github.com/yourusername/mcp-server-mm1.git\r\ncd mcp-server-mm1\r\n\r\n# Install dependencies\r\nuv pip install -e \".[dev]\"\r\n```\r\n\r\n### Run Tests\r\n\r\n```bash\r\npytest\r\n```\r\n\r\n### Code Quality\r\n\r\n```bash\r\n# Format code\r\nblack src/ tests/\r\n\r\n# Lint\r\nruff check src/ tests/\r\n\r\n# Type check\r\nmypy src/\r\n```\r\n\r\n### Local Testing\r\n\r\nUse the MCP Inspector to test the server locally:\r\n\r\n```bash\r\n# Install MCP inspector (if not already installed)\r\nnpm install -g @modelcontextprotocol/inspector\r\n\r\n# Run server with inspector\r\nmcp dev src/mcp_server_mm1/server.py\r\n```\r\n\r\nThis opens a web interface where you can:\r\n- Browse available resources\r\n- Test tool invocations\r\n- Try prompt templates\r\n- Inspect JSON-RPC communication\r\n\r\n## Architecture\r\n\r\n```\r\nsrc/mcp_server_mm1/\r\n\u251c\u2500\u2500 server.py # FastMCP server with resources/tools/prompts\r\n\u251c\u2500\u2500 schemas/\r\n\u2502 \u2514\u2500\u2500 mm1_schema.py # M/M/1 system schema definition\r\n\u251c\u2500\u2500 simulations/\r\n\u2502 \u2514\u2500\u2500 mm1_queue.py # SimPy simulation implementation\r\n\u2514\u2500\u2500 utils/\r\n \u2514\u2500\u2500 metrics.py # Theoretical calculations\r\n```\r\n\r\n## M/M/1 Theory Quick Reference\r\n\r\n### Key Formulas\r\n\r\nGiven arrival rate \u03bb and service rate \u03bc:\r\n\r\n- **Utilization**: \u03c1 = \u03bb/\u03bc\r\n- **Avg Queue Length**: L_q = \u03c1\u00b2/(1-\u03c1)\r\n- **Avg Time in Queue**: W_q = \u03c1/(\u03bc(1-\u03c1))\r\n- **Avg Time in System**: W = 1/(\u03bc(1-\u03c1))\r\n\r\n### Stability Condition\r\nSystem must satisfy **\u03c1 < 1** (\u03bb < \u03bc)\r\n\r\nIf \u03c1 \u2265 1, the queue grows unbounded!\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please:\r\n1. Fork the repository\r\n2. Create a feature branch\r\n3. Make your changes with tests\r\n4. Submit a pull request\r\n\r\n## License\r\n\r\nMIT License - see [LICENSE](LICENSE) file for details.\r\n\r\n## Related Work\r\n\r\nThis MCP server was developed as part of research on LLM-assisted simulation code generation for the Winter Simulation Conference (WSC) 2025.\r\n\r\n## References\r\n\r\n- [Model Context Protocol Documentation](https://modelcontextprotocol.io/)\r\n- [SimPy Documentation](https://simpy.readthedocs.io/)\r\n- [M/M/1 Queue - Wikipedia](https://en.wikipedia.org/wiki/M/M/1_queue)\r\n\r\n## Support\r\n\r\n- **Issues**: [GitHub Issues](https://github.com/yourusername/mcp-server-mm1/issues)\r\n- **Discussions**: [GitHub Discussions](https://github.com/yourusername/mcp-server-mm1/discussions)\r\n\r\n---\r\n\r\n**Made with \u2764\ufe0f for the simulation and LLM communities**\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Model Context Protocol server for M/M/1 queue simulation and analysis",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/yourusername/mcp-server-mm1#readme",
"Homepage": "https://github.com/yourusername/mcp-server-mm1",
"Issues": "https://github.com/yourusername/mcp-server-mm1/issues",
"Repository": "https://github.com/yourusername/mcp-server-mm1"
},
"split_keywords": [
"mcp",
" model-context-protocol",
" simulation",
" queue",
" mm1",
" queueing-theory",
" simpy",
" discrete-event-simulation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "95d6c45f5b818e7030b46b2b6d714a4a0f0b3e9d92905818f2df98e1d41f94cd",
"md5": "8a61383bf848105f374acd546140caa8",
"sha256": "057dce07178cfe583435c1395eef18d96572994d5de007dc91655879360d7279"
},
"downloads": -1,
"filename": "mcp_server_mm1-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a61383bf848105f374acd546140caa8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 29401,
"upload_time": "2025-11-04T07:12:23",
"upload_time_iso_8601": "2025-11-04T07:12:23.773508Z",
"url": "https://files.pythonhosted.org/packages/95/d6/c45f5b818e7030b46b2b6d714a4a0f0b3e9d92905818f2df98e1d41f94cd/mcp_server_mm1-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d2c2f84f7f8916380eec77dc53c180ffc04ee48a6e5be1c4e9069e55c73a19b6",
"md5": "8b0f3e1af63fec077fcd8d16e514c5bb",
"sha256": "0a7efc4e0b3773dabab56777dc62239e5f4ec242366ee84874169483f94c197a"
},
"downloads": -1,
"filename": "mcp_server_mm1-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "8b0f3e1af63fec077fcd8d16e514c5bb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 26304,
"upload_time": "2025-11-04T07:12:25",
"upload_time_iso_8601": "2025-11-04T07:12:25.088984Z",
"url": "https://files.pythonhosted.org/packages/d2/c2/f84f7f8916380eec77dc53c180ffc04ee48a6e5be1c4e9069e55c73a19b6/mcp_server_mm1-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-04 07:12:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "mcp-server-mm1#readme",
"github_not_found": true,
"lcname": "mcp-server-mm1"
}