Run — mcp-replicate-hosted Build
Session am 2026-05-19. Phase 2.1 + 2.2 aus dem Design-Stack-Plan fuer Julian umgesetzt: kompletter Code-Bau eines zweiten hosted MCP (mcp-replicate-hosted) analog mcp-vf-hosted, plus Video-Provider-Entscheidung.
Was gemacht wurde
Code
Repo angelegt: ~/source/mcps/mcp-replicate-hosted/ — vollstaendig Mirror des mcp-vf-hosted-Patterns mit einem statt vier Sub-MCPs.
| Datei | Was sie tut |
|---|---|
src/mcp_replicate_hosted/main.py | FastMCP + ScalekitProvider + GuardMiddleware (Rate-Limit + Modell-Whitelist + Audit + Kill-Switch) + ToolWhitelistMiddleware + 5 Layer-Tools (create_image / _text_image / _svg_logo / _from_reference / _video) + search_tools + stdio-Proxy auf mcp-replicate |
src/mcp_replicate_hosted/config.py | Modell-Whitelist (15 Image-Modelle + 4 Video-Modelle), USE_CASE_DEFAULTS, env-Override-Mechanik |
src/mcp_replicate_hosted/brand_lock.py | VF-Brand-Snippet + Negative-Prompt-Hints, prepend-Logik mit reversiblem brand_lock=False |
src/mcp_replicate_hosted/settings.py | Pydantic-Settings (Scalekit + Replicate-Token + Rate-Limit + BRAND_LOCK_DEFAULT) |
src/mcp_replicate_hosted/ratelimit.py | 1:1 von mcp-vf-hosted portiert |
src/mcp_replicate_hosted/audit.py | 1:1 von mcp-vf-hosted portiert (JSON-Format + PIIScrubFilter mit JWT/Email/IBAN/Phone/Bearer-Patterns) |
src/mcp_replicate_hosted/prompts.py | 3 Slash-Prompts (/speaker_card, /save_the_date, /social_post) mit Anti-Prompt-Injection-Sanitizer |
Dockerfile | linux/amd64, python:3.12-slim + uv, mcp-replicate als sibling copy |
infra/lib/mcp-replicate-hosted-stack.ts | CDK Fargate + cloudflared-Sidecar + CloudWatch-Dashboard mit Cost-Audit-Widgets |
tests/ | 39 Tests gruen, ruff clean |
Validierung lokal
uv sync --all-extras # OK
uv run pytest -q # 39 passed in 0.68s
uv run ruff check src/ tests/ # All checks passed!
uv run python -c "from mcp_replicate_hosted.main import build_app; print(build_app().name)"
# -> vf-replicate
Replicate-Video-Check (Phase 2.2)
Live-Check der Replicate API am 2026-05-19 18:30 CET via QUERY /v1/models. Befund:
| Familie | Modelle Stand 05/2026 | Default fuer VF |
|---|---|---|
| Kling (Kuaishou) | v1.6, v2.1, v2.5-turbo-pro (2.6M runs), v2.6 (684k), v3.0 (Omni + Video + Motion-Control) | kwaivgi/kling-v2.5-turbo-pro |
| Wan (Alibaba) | 2.2, 2.5-i2v, 2.5-i2v-fast, 2.5-t2v-fast, 2.6-i2v-flash, 2.7-image-pro | wan-video/wan-2.5-i2v-fast |
| Veo (Google) | google/veo-3, google/veo-3-fast (cheaper + Audio) | google/veo-3-fast |
| Seedance (ByteDance) | 1-lite, 1-pro, 1.5-pro, 2.0, 2.0-fast (alle mit Audio) | bytedance/seedance-2.0-fast |
Nicht verfuegbar: Sora 2 (OpenAI hostet selbst), Veo 3.1 (Google bevorzugt Vertex AI direkt). Beides nicht VF-blockierend.
ADR geschrieben: vf-video-gen-provider. Entscheidung: Option A (Replicate-Hosted erweitern), Video-Modelle in Whitelist + create_video Layer-Tool ergaenzt.
AWS-Vorbereitung
- ECR-Repo
mcp-replicate-hostedinav-production(425924867359, eu-central-1) angelegt —aws ecr create-repository2026-05-19 18:32 CET - Image-Scan-on-Push aktiv, AES256 encryption
- ECR-URI:
425924867359.dkr.ecr.eu-central-1.amazonaws.com/mcp-replicate-hosted
Vault-Doku
| File | Status |
|---|---|
| mcp-replicate-hosted | NEU |
| mcp-replicate-hosted | NEU |
| vf-video-gen-provider | NEU (ADR) |
| _index | TODO Eintrag in Hosted-Tabelle |
| _index | TODO Eintrag in Repo-Tabelle |
| 2026-05-19-design-stack-julian | TODO Phase 2 als WIP markieren |
| sprint-2-replicate-hosted | TODO Phase 1-2 als done markieren |
| welle-4-capability-rollout | TODO Items 4.10 + 4.12 als done markieren |
Was offen ist (Marvin-Schritte)
Sofort (Code-Side Final)
- Commit
~/source/mcps/mcp-replicate-hosted/(NEW repo) - Commit Vault-Changes (Capability + ADR + Run-Log + Plan-Updates)
AWS-Deploy (~30 Min wenn alle Inputs da)
-
Replicate-API-Token besorgen + Spending-Cap
- https://replicate.com/account/api-tokens — neuer Token “vf-hosted” anlegen
- https://replicate.com/account/billing — Spending limit auf 50
-
AWS Secrets Manager
aws secretsmanager create-secret \ --name mcp-replicate-hosted/upstream-tokens \ --secret-string '{"REPLICATE_API_TOKEN":"r8_..."}' \ --region eu-central-1 --profile av-production -
Cloudflare-Tunnel via Dashboard ODER
mcp-cloudflare-Tool- Tunnel “mcp-replicate-hosted” anlegen
- Ingress:
replicate.agenticventures.de→http://localhost:8080 - Tunnel-Token kopieren:
aws secretsmanager create-secret \ --name mcp-replicate-hosted/cloudflared-token \ --secret-string '<tunnel-token>' \ --region eu-central-1 --profile av-production - Tunnel-ID notieren fuer DNS-CNAME
-
Scalekit-Resource (EU-Region) ueber Marvins Scalekit-Dashboard
- MCP → Resources → New
- Resource-Identifier:
https://replicate.agenticventures.de/mcp - Resource-Name:
VF Replicate Image-Gen MCP - Resource-ID (
res_...) notieren
-
Stack-Datei aktualisieren in
~/source/mcps/mcp-replicate-hosted/infra/lib/mcp-replicate-hosted-stack.ts:upstreamTokensARN-Suffix einsetzen (aus Schritt 2)cloudflaredTokenARN-Suffix einsetzen (aus Schritt 3)SCALEKIT_RESOURCE_IDmit res_… aus Schritt 4 ersetzen
-
Docker-Image bauen + push (linux/amd64!)
cd ~/source/mcps docker buildx build --platform linux/amd64 \ -f mcp-replicate-hosted/Dockerfile \ -t 425924867359.dkr.ecr.eu-central-1.amazonaws.com/mcp-replicate-hosted:latest \ --push . -
Image-Digest holen + im Stack pinnen
aws ecr describe-images \ --repository-name mcp-replicate-hosted --image-ids imageTag=latest \ --query 'imageDetails[0].imageDigest' --output text \ --profile av-production --region eu-central-1Im Stack-File
sha256:PLACEHOLDER_DIGEST_REPLACE_AFTER_FIRST_PUSHersetzen. -
CDK Deploy
cd ~/source/mcps/mcp-replicate-hosted/infra npm install npx cdk deploy --profile av-production -
DNS-Cutover in Cloudflare
- CNAME
replicate.agenticventures.de→<tunnel-id>.cfargotunnel.com, proxied=true
- CNAME
-
Smoke extern
curl https://replicate.agenticventures.de/health
Open WebUI Tool-Whitelist
Nach Live-Schaltung:
- Admin-UI von vf-chat.agenticventures.de → Tools → Add MCP Server
- URL:
https://replicate.agenticventures.de/mcp, Type: Streamable HTTP, OAuth 2.1 - OAuth-Flow als Marvin (+ Julian, Andre, Christoph wenn AVV unterschrieben) durchspielen
- vf-nova Tool-Whitelist erweitern um die 10 sichtbaren Tools (siehe Capability-File
#mcp-tool-whitelist-fuer-open-webui-vf)
AVV + VF-Komm
- VF-AVV: Replicate Inc. als Subprozessor eintragen
-
extern/shared/vibe-factory/avv-replicate.mdschreiben (Briefing fuer Andre) - Erst NACH AVV-Sign: Julian + Christoph zu OAuth einladen
- Julian-Live-Test organisieren: 2 Test-Prompts (Hero-Bild + Speaker-Card), Feedback einsammeln
Anti-Scope
Nicht in diesem Run gemacht (bewusst):
- AWS-Deploy (braucht Replicate-Token, Scalekit-Klick, AVV) — als Handover fuer Marvin
- fal.ai / Vertex EU Sub-Plan (Phase 2.2 Option B/C nicht gewaehlt — siehe ADR)
- Self-Host Wan 2.6 auf Hetzner (Industriekunden, separate Story)
- Skill-spezifische Custom Models (Phase 3)
- open-design Cherry-Pick beyond Anti-Slop (Phase 3)
- Brand-Kit-Discovery-Wizard
Lessons fuer naechstes Hosted-MCP-Repo
Das Mirror-Pattern hat funktioniert wie geplant. Reproduzierbare Schritte:
- Repo-Skelett vom mcp-vf-hosted-Pattern anlegen (Verzeichnisse + pyproject)
- ratelimit.py + audit.py 1:1 kopieren — sind generisch
- settings.py minimal anpassen (Token-Felder + ggf. domain-spezifische Defaults)
- config.py + brand_lock.py oder aequivalente Domain-Layer je nach Use-Case
- main.py: GuardMiddleware um domain-spezifische Checks erweitern (hier Modell-Whitelist)
- Layer-Tools fuer Higher-Level-Abstraktion ueber Sub-MCP-Raw-Tools
- ToolWhitelistMiddleware mit ~10 Tools default — search_tools als Discovery
- CDK-Stack-File mit klaren PLACEHOLDER-Markern fuer ARNs + Image-Digest + Scalekit-Resource-ID
- Tests fuer generische Layer (audit, ratelimit, settings) + domain-spezifische (whitelist, brand-lock)
Pattern-Doku in mcp-hosting-fargate-tunnel passt unveraendert.
Cross-Refs
- Plan-Source: 2026-05-19-design-stack-julian
- Sprint: sprint-2-replicate-hosted
- Capability: mcp-replicate-hosted
- Repo: mcp-replicate-hosted
- ADR Video-Provider: vf-video-gen-provider
- Vorbild-Stack: mcp-vf-hosted
- Pattern: mcp-hosting-fargate-tunnel