page:recipes:mcp server:flask:response streaming

Host mcp server with Flask: streamed responses

Summary

Deploy a mcp server built with Flask on Ample using the streaming response service pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL, a managed PostgreSQL 16 database is auto-provisioned and injected as DATABASE_URL. Verified on Flask: a Server-Sent Events endpoint read incrementally through the public HTTPS gateway.

Representative Queries

Resource Requirements

Infrastructure Requirements

  1. Compute
    • Status: verified
    • Summary: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
  2. Postgres
    • Status: verified
    • Summary: Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.

Prerequisites

Workflow Steps

  1. Build and start
    Command: pip install into .ample/python from requirements.txt, then waitress from app.py reading PORT on the python-3.12 template. The server must bind 0.0.0.0 on PORT.

  2. Implement the pattern on PostgreSQL
    Description: The fixture's module implements streaming response service.

  3. Deploy
    Command: ample deploy . --name --public --start "python3 app.py"

  4. Verify
    Command: ample logs --kind build

Cost Estimate

Success Checks

  1. App responds on its public URL

    • Kind: http_get
    • Path: /
    • Expect: ample canary flask patterns
  2. Streaming-response-service self-test

    • Kind: http_get
    • Path: /p/streaming-response-service
    • Expect: an SSE stream: data: id=, ... done=true|false

Examples

Limitations

Evidence Summary

  1. Canary run: Flask pattern fixture deployed on Ample.
    • Observed At: 2026-09-21
    • Summary: All checks passed.

Last Verified At

2026-09-21