> ## Documentation Index
> Fetch the complete documentation index at: https://ctrlrun.dev/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).


## Related topics

- [Protect an existing MCP server in five minutes](/docs/cookbook/protect-an-mcp-server.md)
- [CTRLRun and MCP](/docs/mcp/overview.md)
- [Roadmap](/docs/ROADMAP.md)
- [Use the docs from your editor](/docs/mcp/use-the-docs-from-your-editor.md)
- [Run verify in GitHub Actions](/docs/cookbook/verify-in-github-actions.md)
