feat(mcp-docugen): scaffold service + Docker stack con gateway Caddy

Task 0 del piano (adattato a workspace uv):
- services/mcp-docugen/: pyproject.toml, src/mcp_docugen/, tests/unit+integration/,
  README, .env.example. Package rinominato da docugen_mcp -> mcp_docugen.
- Root pyproject.toml: aggiunto services/mcp-docugen a workspace members.
- .python-version: 3.11
- uv.lock committato.

Docker stack stile CerberoSuite/Cerbero con prefisso "arca-":
- docker/base.Dockerfile -> arca-base:latest
- docker/mcp-docugen.Dockerfile -> arca-mcp-docugen:dev (porta interna 9100,
  label arca.service, runtime multi-stage, user non-root, healthcheck)
- docker-compose.yml root: gateway Caddy unica porta host (8080) + mcp-docugen
  su rete interna. Security defaults cap_drop ALL, no-new-privileges, read_only
  ove applicabile, restart unless-stopped.
- gateway/Caddyfile: reverse proxy /mcp-docugen/* -> mcp-docugen:9100 + landing.
- gateway/public/index.html: landing page minimale.

.env.example root aggiornato con DOCUGEN_API_KEY + OPENROUTER_API_KEY condivisa.

Task 1-12 (implementazione TDD effettiva) ancora da fare.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-21 12:16:22 +02:00
parent 7b169fb8db
commit c5e84a578b
16 changed files with 1692 additions and 8 deletions
+18
View File
@@ -0,0 +1,18 @@
# Authentication (bearer token che i client MCP passano)
API_KEY=
# OpenRouter
OPENROUTER_API_KEY=
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
LLM_MODEL_DEFAULT=anthropic/claude-sonnet-4
# URL pubblico usato per costruire link asset nel Markdown generato
PUBLIC_BASE_URL=https://mcp-docugen.<dominio>
# Storage persistente (mappato su volume in Docker)
DATA_DIR=/data
# Limiti
ASSET_TTL_DAYS=30
MAX_IMAGE_SIZE_MB=10
LLM_TIMEOUT_SECONDS=60
+37
View File
@@ -0,0 +1,37 @@
# mcp-docugen
MCP server per generazione documenti Markdown da template + LLM (OpenRouter).
Design: [`../../docs/mcp-docugen-design.md`](../../docs/mcp-docugen-design.md)
Plan: [`../../docs/mcp-docugen-implementation.md`](../../docs/mcp-docugen-implementation.md)
## Dev
Dalla root del repo:
```bash
uv sync --all-groups
uv run --package mcp-docugen mcp-docugen
```
## Test
```bash
uv run --package mcp-docugen pytest services/mcp-docugen
```
## Docker
```bash
# build (dalla root)
docker build -f docker/base.Dockerfile -t arca-base:latest .
docker build -f docker/mcp-docugen.Dockerfile -t arca-mcp-docugen:dev .
# o via compose
docker compose build mcp-docugen
docker compose up mcp-docugen
```
## Env
Vedi `.env.example`. Variabili obbligatorie: `API_KEY`, `OPENROUTER_API_KEY`, `PUBLIC_BASE_URL`.
+40
View File
@@ -0,0 +1,40 @@
[project]
name = "mcp-docugen"
version = "0.1.0"
description = "MCP server for document generation from Markdown templates via OpenRouter"
requires-python = ">=3.11"
dependencies = [
"mcp>=1.2",
"fastapi>=0.115",
"uvicorn[standard]>=0.34",
"pydantic>=2.0",
"pydantic-settings>=2.0",
"httpx>=0.27",
"aiosqlite>=0.20",
"aiofiles>=24.0",
"pyyaml>=6.0",
"pillow>=11.0",
"python-multipart>=0.0.9",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0",
"pytest-asyncio>=0.24",
"respx>=0.21",
"pytest-cov>=5.0",
]
[project.scripts]
mcp-docugen = "mcp_docugen.main:run"
[tool.coverage.run]
source = ["src/mcp_docugen"]
omit = ["src/mcp_docugen/main.py"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/mcp_docugen"]
@@ -0,0 +1 @@
__version__ = "0.1.0"