mcp-replicate-hosted (Repo)

Source-Pfad: ~/source/mcps/mcp-replicate-hosted/ — gebaut 2026-05-19 als Phase 2 von 2026-05-19-design-stack-julian.

Stack

  • Python 3.12+, uv sync --all-extras, pyproject.toml + hatchling
  • FastMCP v2 (Prefect-Fork) — ScalekitProvider, create_proxy, Middleware
  • pydantic-settings typed ENV
  • AWS CDK in infra/ (TypeScript, identisches Pattern zu mcp-vf-hosted/infra)
  • Sub-MCP: mcp-replicate via editable install + stdio-Subprocess

Module

FileWas es macht
src/mcp_replicate_hosted/main.pyFastMCP-App, GuardMiddleware, ToolWhitelistMiddleware, Layer-Tools, sub-MCP-Proxy
src/mcp_replicate_hosted/settings.pyPydantic-Settings, typed ENV
src/mcp_replicate_hosted/ratelimit.py1:1 von mcp-vf-hosted portiert — Token-Bucket pro Subject
src/mcp_replicate_hosted/audit.py1:1 von mcp-vf-hosted portiert — JSON + PIIScrubFilter
src/mcp_replicate_hosted/config.pyModell-Whitelist + USE_CASE_DEFAULTS, Source of Truth
src/mcp_replicate_hosted/brand_lock.pyVF-Brand-Snippet + Negative-Prompt-Hints, prepend-Logik
src/mcp_replicate_hosted/prompts.pySlash-Prompts /speaker_card, /save_the_date, /social_post mit Anti-Prompt-Injection-Sanitizer
Dockerfilelinux/amd64, python:3.12-slim, uv, non-root user, baut mcp-replicate als sibling
infra/lib/mcp-replicate-hosted-stack.tsCDK Fargate + cloudflared-Sidecar + CloudWatch-Dashboard
tests/39 Tests: audit, brand-lock, model-whitelist, prompts, ratelimit, settings

Tools (exposed)

ToolWas es macht
create_imageDefault Flux 2 Pro, Brand-Lock-Injection, Foto-Real
create_text_imageIdeogram V3 Quality, Speaker-Cards / Poster mit Text
create_svg_logoRecraft V4 SVG, echtes Vektor-File zurueck
create_image_from_referenceFlux Kontext Pro, Variante eines bestehenden Bilds
create_videoDefault Kling 2.5 Turbo Pro, optional Veo 3 / Seedance / Wan
search_toolsDiscovery der versteckten 25+ raw replicate_*-Tools
replicate_* (Lifecycle)get_prediction, wait_for_prediction, cancel_prediction, list_predictions

Bauen + Testen

cd ~/source/mcps/mcp-replicate-hosted
uv sync --all-extras
uv run pytest               # 39 Tests
uv run ruff check src/ tests/
# Build-Smoke
SCALEKIT_ENV_URL=https://x.eu.scalekit.dev SCALEKIT_RESOURCE_ID=res_x \
  PUBLIC_BASE_URL=https://x.example REPLICATE_API_TOKEN=r8_test \
  uv run python -c "from mcp_replicate_hosted.main import build_app; print(build_app().name)"

Deploy auf AWS

Siehe README.md. Voraussetzungen:

  • ECR-Repo mcp-replicate-hosted in av-production (angelegt 2026-05-19)
  • Secrets Manager: mcp-replicate-hosted/upstream-tokens + /cloudflared-token
  • Cloudflare-Tunnel mit Ingress
  • Scalekit-Resource in EU-Region
  • DNS-Record

Editable Install fuer lokale Tests

Aktuell NICHT in ~/.claude/ registriert — laeuft nicht lokal als stdio-MCP, sondern nur in der Container-Deployment-Form. Wenn lokal-debug-Bedarf: uv run python -m mcp_replicate_hosted.main (Port 8080).