# Deploying FrontMCP servers

> How to build a FrontMCP server and run it in production: Node and Docker, Vercel, AWS Lambda, Cloudflare Workers and @frontmcp/edge, state in Redis or SQLite, several instances behind a load balancer, health checks, security headers and connecting MCP clients.

Source: https://frontmcp.dev/reference/deployment

This section takes a server from your machine to somewhere clients can reach it. `frontmcp build` turns one `@FrontMcp` entry file into what a platform runs: a Node process, on a machine or in Docker; a function for Vercel or AWS Lambda; or a Cloudflare Worker. `@frontmcp/edge` runs a server on Workers without that build step. The rest of the section covers where the server keeps its state between requests, running several instances behind a load balancer, the health checks and metrics an orchestrator reads, what FrontMCP does at the HTTP layer, and how MCP clients connect. It's for whoever ships and runs a server. Start with [Production build](https://frontmcp.dev/reference/deployment/production-build); [Deploying Your Server](https://frontmcp.dev/learn/deploying-your-server) takes one server from `frontmcp build` to a connected client, step by step.

```bash
frontmcp build --target node          # or distributed, vercel, lambda, cloudflare, sdk, browser, cli, mcpb
```

---

## Building

| Page | Covers |
| --- | --- |
| [Production build](https://frontmcp.dev/reference/deployment/production-build) | `frontmcp build` and its targets: what each one writes, what it bundles and what it leaves in `node_modules`, how the result runs, which endpoint path it serves, and when it's in production mode |

## Where it runs

| Page | Covers |
| --- | --- |
| [Node.js and Docker](https://frontmcp.dev/reference/deployment/node) | The node build on a machine, in a Docker image, with Redis in Docker Compose, behind nginx, or on a Unix socket: what it needs, the environment it reads, and how it stops |
| [Vercel](https://frontmcp.dev/reference/deployment/vercel) | The vercel target: the files it writes, the `vercel.json` it makes, what the function serves, when it runs in production, and sessions in Vercel KV or Upstash |
| [AWS Lambda](https://frontmcp.dev/reference/deployment/aws-lambda) | The lambda target: the handler it writes, what to deploy, `NODE_ENV`, the events it accepts, and sessions in Redis |
| [Cloudflare Workers](https://frontmcp.dev/reference/deployment/cloudflare-workers) | The cloudflare target: the entry and `wrangler.toml` it writes, secrets and bindings, when the Worker is in production, and the storage it takes and refuses |
| [@frontmcp/edge](https://frontmcp.dev/reference/deployment/edge) | `createEdgeMcp()`: a server on Cloudflare Workers from a plain configuration, bundled by `wrangler` with no `frontmcp build`, with sessions in a Durable Object and a managed mode |
| [Browser](https://frontmcp.dev/reference/deployment/browser) | A server inside a web page or a Web Worker: the SDK's browser build, the entry points that never listen, what needs Node, keys in IndexedDB or localStorage, and calling a model from the page |

## State and several instances

| Page | Covers |
| --- | --- |
| [Redis](https://frontmcp.dev/reference/deployment/redis) | The `redis` option: what FrontMCP keeps in Redis and under which keys, how long sessions last, what doesn't use it, and what happens when Redis can't be reached |
| [SQLite](https://frontmcp.dev/reference/deployment/sqlite) | The `sqlite` option: sessions, background tasks and pending questions in a SQLite file on one machine, with locking and encryption |
| [High availability](https://frontmcp.dev/reference/deployment/high-availability) | Several instances behind a load balancer: what they must share, how an older client's session moves between them through Redis, machine ids, and distributed mode |

## Running it in production

| Page | Covers |
| --- | --- |
| [Health checks and metrics](https://frontmcp.dev/reference/deployment/health-and-metrics) | What `/healthz`, `/readyz` and `/metrics` answer on each runtime, and how to point container health checks, Kubernetes probes, load balancers and Prometheus at them |
| [Security headers and transport](https://frontmcp.dev/reference/deployment/security) | The security headers FrontMCP sends and how to turn on HSTS and a CSP, bind address and host checks, body size limits, the endpoints the Node server exposes, and the startup audit |
| [Connecting MCP clients](https://frontmcp.dev/reference/deployment/mcp-clients) | Clients that connect by URL over Streamable HTTP, start the server over stdio, or use a Unix socket; client snippets from the CLI; and MCP Bundles |

## Which page for which task

| You want to | Read |
| --- | --- |
| Pick a build target for your platform | [Targets](https://frontmcp.dev/reference/deployment/production-build#targets) |
| Build a Docker image | [Building a Docker image](https://frontmcp.dev/reference/deployment/node#building-a-docker-image) |
| Run with Redis in Docker Compose | [Running with Redis in Docker Compose](https://frontmcp.dev/reference/deployment/node#running-with-redis-in-docker-compose) |
| Put nginx in front of the server | [Putting nginx in front](https://frontmcp.dev/reference/deployment/node#putting-nginx-in-front) |
| Deploy to Vercel | [Deploying a server](https://frontmcp.dev/reference/deployment/vercel#deploying-a-server) |
| Deploy to AWS Lambda | [Deploying with SAM](https://frontmcp.dev/reference/deployment/aws-lambda#deploying-with-sam) |
| Deploy to Cloudflare Workers | [Deploying a Worker](https://frontmcp.dev/reference/deployment/cloudflare-workers#deploying-a-worker), or [@frontmcp/edge](https://frontmcp.dev/reference/deployment/edge) without `frontmcp build` |
| Run a server inside a web page | [Running a server in the page](https://frontmcp.dev/reference/deployment/browser#running-a-server-in-the-page) |
| Keep sessions across a restart, on one machine | [Keeping sessions across restarts](https://frontmcp.dev/reference/deployment/sqlite#keeping-sessions-across-restarts) |
| Run behind a load balancer | [High availability](https://frontmcp.dev/reference/deployment/high-availability), and [storing sessions in Redis](https://frontmcp.dev/reference/deployment/redis#storing-sessions-in-redis) |
| Point Kubernetes probes at the server | [Pointing Kubernetes at the probes](https://frontmcp.dev/reference/deployment/health-and-metrics#pointing-kubernetes-at-the-probes) |
| Scrape metrics with Prometheus | [Scraping metrics with Prometheus](https://frontmcp.dev/reference/deployment/health-and-metrics#scraping-metrics-with-prometheus) |
| Turn on HSTS and a Content Security Policy | [Turning on HSTS and a CSP](https://frontmcp.dev/reference/deployment/security#turning-on-hsts-and-a-csp) |
| Let a client start the server over stdio | [Starting the server over stdio](https://frontmcp.dev/reference/deployment/mcp-clients#starting-the-server-over-stdio) |
| Ship the server as an MCP Bundle for desktop clients | [Installing from an MCP Bundle](https://frontmcp.dev/reference/deployment/mcp-clients#installing-from-an-mcp-bundle) |
| Set the secrets production requires | [Secrets](https://frontmcp.dev/reference/auth/production#secrets) |
| Fix a client that gets `404` at `/mcp` after deploying | [A client gets `404` at `/mcp` after deploying](https://frontmcp.dev/reference/deployment/production-build#a-client-gets-404-at-mcp-after-deploying) |

## Related pages

- [Auth in production](https://frontmcp.dev/reference/auth/production): secrets, the public address and token checks for an authenticated server.
- [Observability and telemetry](https://frontmcp.dev/reference/server/observability): every option of `health`, `metrics` and tracing.
- [Configuration files](https://frontmcp.dev/reference/server/config-files#environment-variables): every environment variable FrontMCP reads.
- [`createFetchHandler()`](https://frontmcp.dev/reference/sdk/create-fetch-handler) and [`FrontMcpInstance`](https://frontmcp.dev/reference/sdk/frontmcp-instance): the entry points the build targets run.
- [frontmcp CLI](https://frontmcp.dev/reference/cli) and [Nx executors](https://frontmcp.dev/reference/nx/executors): the commands that build, start and deploy.
- Learn: [Deploying Your Server](https://frontmcp.dev/learn/deploying-your-server) and [Running Several Instances](https://frontmcp.dev/learn/running-several-instances).
