page:recipes:mcp server:nestjs:response streaming

Host MCP Server with NestJS: Streamed Responses

Summary

Deploy a MCP server built with NestJS on Ample using the streaming response service pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL, with a managed PostgreSQL 16 database auto-provisioned and injected as DATABASE_URL.

Representative Queries

Resource Requirements

Infrastructure Requirements

Prerequisites

  1. A NestJS project that builds and starts with the documented commands (npm install, nest build (TypeScript) then node dist/main.js on the node-22 template).
  2. A PostgreSQL driver reading DATABASE_URL at runtime (auto-provisioned when omitted, or supplied with --env).
  3. An Ample account token with servers:write, databases:read.

Tested Configuration

Workflow Steps

  1. Build and Start: npm install, nest build (TypeScript) then node dist/main.js on the node-22 template. The server must bind 0.0.0.0 on PORT.
  2. Implement the Pattern on PostgreSQL: The fixture's module implements streaming response service. Copy the approach into your schema; keep migrations idempotent and run them with --release-command.
  3. Deploy: Run the synchronous deploy once and read the result (exit 0 live, 1 failed, 2 blocked). Re-running with no change is a no-op. Command: ample deploy . --name --public
  4. Verify: Fetch the live URL and the pattern self-test route(s) (/p/streaming-response-service); then run your own checks. Command: ample logs --kind build

Examples

Success Checks

Limitations

Cost Estimate

Evidence Summary

Next Actions