Add stdio MCP server for RollCalc

This commit is contained in:
2026-09-24 13:58:55 +02:00
parent defbf20202
commit bbaaaf31c5
5 changed files with 324 additions and 0 deletions
+33
View File
@@ -114,6 +114,39 @@ Implemented routes:
Authentication is implemented with `Flask-HTTPAuth`. The current code checks `BETA_USERS` with `werkzeug.security.check_password_hash`; plaintext passwords are not stored in the application.
## MCP PoC
`mcp_server.py` provides a local stdio-only Model Context Protocol server. It is
a thin adapter over the same domain services used by Flask: article lookup,
direct roll calculation, and transport analysis. The available PoC tools are
`get_article`, `calculate_roll_diameter`, and `analyze_transport_capacity`.
Install the pinned dependencies, including `mcp==1.26.0`, in the existing
environment, then start it with:
```bash
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python mcp_server.py
```
The PoC has no MCP resources, HTTP/SSE transport, remote authentication, or
dedicated product-length or target-length calculation tools, or extrapolation.
Tool calling semantics:
- `get_article` accepts textual `article_number` values (including leading
zeroes) and an optional `article_name_hint`.
- `calculate_roll_diameter` uses `roll_length_m` for the material length on one
roll. Diameter and thickness inputs are in mm; `width_m` is in m;
`area_weight_g_m2` is in g/m². `include_roll_weight` requests the optional
kilogram result.
- `analyze_transport_capacity` uses roll/core diameters in mm; roll width and
transport dimensions in m; and roll/payload weights in kg.
`product_length_m` is the material length represented by one roll, used only
for reported square metres. The supplied `roll_weight_kg` is passed through
unchanged. Callers may use a canonical `transport_preset` or provide custom
transport dimensions and `max_weight_kg`.
Generate a password hash or user entry with:
```bash