# @frontmcp/host-express

> Select the Express host for FrontMCP routes and middleware that use Express APIs.

Source: https://frontmcp.dev/reference/deployment/host-express

[Covers FrontMCP 1.15.2](https://frontmcp.dev/versions#how-pages-are-checked) as of December 4, 2026

Use `@frontmcp/host-express` when your server needs Express middleware or request and response APIs such as `req.ip` and `res.sendFile()`. A server whose routes only need web `Request` and `Response` objects can use the [built-in host](https://frontmcp.dev/reference/deployment/node#choosing-the-http-host).

```ts
import { expressHost, type ExpressHostAdapterOptions } from "@frontmcp/host-express";

const hostFactory = expressHost();
```



---

<a id="reference"></a>

## Reference

<a id="expresshostoverrides"></a>

### `expressHost(overrides?)`

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `overrides` | `ExpressHostAdapterOptions` | none | Host options to override after FrontMCP resolves CORS, security, body limits and timeouts. This type aliases the SDK's `HostAdapterOptions`. |

Returns a factory for [`http.hostFactory`](https://frontmcp.dev/reference/sdk/frontmcp#using-your-own-http-server). The package also exports `ExpressHostAdapter`, `UserContentListener` and `DEFAULT_EXPRESS_BODY_LIMIT`. Its host's `getHandler()` returns the Express app.

<a id="caveats"></a>

#### Caveats

The package takes Express 4.18 or later in the 4.x line, or Express 5.

With `future.builtInHost: true` and no `hostFactory`, FrontMCP selects this host when the package is installed. An explicit `hostFactory` controls the choice in either mode.

<a id="usage"></a>

## Usage

<a id="selecting-express-explicitly"></a>

### Selecting Express explicitly

> **Note**
>
> Run this configuration in Node. The Playground cannot start a Node HTTP host or load Express middleware.

```bash
npm install @frontmcp/host-express@1.15.2 express cors
```

```ts main.ts
import { expressHost } from "@frontmcp/host-express";
import { FrontMcp } from "@frontmcp/sdk";
import { Reports } from "./reports";

@FrontMcp({
  info: { name: "reports", version: "1.0.0" },
  apps: [Reports],
  http: { hostFactory: expressHost() },
})
export default class ReportsServer {}
```

<a id="troubleshooting"></a>

## Troubleshooting

<a id="httphostfeatureerror"></a>

### `HttpHostFeatureError`

If the error names an Express member, verify that the server selects `expressHost()`. If you only need to return an HTTP response, a [web-standard route](https://frontmcp.dev/reference/sdk/frontmcp#serving-http-routes-next-to-mcp) works across hosts.
