> ## Documentation Index
> Fetch the complete documentation index at: https://ctrlrun-docs-python-3-13-3-14.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# serve

> Run a gateway in front of one upstream MCP server (SPEC-v0.2 §6.1).

`ctrlrun.gateway.serve` — function, defined at `src/ctrlrun/gateway/__init__.py:41`

```python theme={null}
from ctrlrun.gateway import serve
```

Needs the `gateway` extra: `pip install "ctrlrun[gateway]"`. Importing it without that raises `MissingDependency` carrying the install command.

```python theme={null}
def serve(*, upstream: str, alias: str, **options: Any) -> None
```

Run a gateway in front of one upstream MCP server (SPEC-v0.2 §6.1).

The dependency check happens first and unconditionally, so an operator who has not
installed the extra learns it from one clear line rather than from a stack trace.

Blocks until interrupted. `Control.from_file()` finds the policy and the store, so a
gateway and a decorator-based worker sharing a policy share reservations (§6.1).

## Next

* [Python API index](/docs/reference/api/index).
* [Get started](/docs/get-started/quickstart) · [Why](/docs/why).
