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
- Host mcp server with Flask: streamed responses
- Where can I host MCP server built with Flask?
- I need a tested end-to-end streaming transport, timeout behavior and client disconnect handling.
Resource Requirements
- primitive:compute
- primitive:postgres
Infrastructure Requirements
- 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.
- 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
- A Flask project that builds and starts with the documented commands.
- A PostgreSQL driver reading DATABASE_URL at runtime.
- An Ample account token with servers:write, databases:read.
Workflow Steps
Build and start
Command:pip install into .ample/python from requirements.txt, thenwaitress from app.py reading PORT on the python-3.12 template.The server must bind0.0.0.0on PORT.Implement the pattern on PostgreSQL
Description: The fixture's module implements streaming response service.Deploy
Command:ample deploy . --name --public --start "python3 app.py"Verify
Command:ample logs --kind build
Cost Estimate
- Currency: USD
- Monthly Amount: $10.00
- Components:
- App server
- Size: s-1vcpu-1gb
- Monthly Amount: $5.00
- Managed PostgreSQL database
- Size: s-1vcpu-1gb
- Monthly Amount: $5.00
- App server
Success Checks
App responds on its public URL
- Kind: http_get
- Path: /
- Expect: ample canary flask patterns
Streaming-response-service self-test
- Kind: http_get
- Path: /p/streaming-response-service
- Expect: an SSE stream: data: id=, ... done=true|false
Examples
- Flask pattern fixture: Multi-pattern Flask app whose streaming response service module was checked live; the module is under tests/deploy-canaries/_pattern-modules.
Limitations
- Verified on the python-3.12 template at s-1vcpu-1gb with the example fixture.
- Other sizes, templates and Flask major versions are not verified.
- Apps auto-pause when idle and wake on the next request.
Evidence Summary
- Canary run: Flask pattern fixture deployed on Ample.
- Observed At: 2026-09-21
- Summary: All checks passed.
Last Verified At
2026-09-21