Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

5.2 KB
Raw Blame
---
title: horizon_client
sidebarTitle: horizon_client
---

# `fastmcp.cli.deploy.horizon_client`


Typed HTTP client for the Horizon control plane.

## Functions

### `normalize_api_origin` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L129" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
normalize_api_origin(value: str) -> str
```


Validate and normalize a Horizon API origin.


## Classes

### `HorizonError` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L33" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


A safe Horizon client error.


### `HorizonUnavailableError` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L37" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


The Horizon API could not be reached.


### `HorizonUnauthorizedError` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L41" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


The Horizon credential was rejected.


### `HorizonResponseError` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L45" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Horizon returned an unexpected response.


### `DeviceAuthorization` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L60" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

### `DeviceAccessToken` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L69" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

**Methods:**

#### `require_nonempty_access_token` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L75" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
require_nonempty_access_token(cls, value: SecretStr) -> SecretStr
```

### `HorizonUser` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

### `HorizonOrganization` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L95" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

### `DeviceMetadata` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L112" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

### `DeviceTokenPoll` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L120" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

### `HorizonClient` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L150" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Call the Horizon routes used by FastMCP CLI authentication.


**Methods:**

#### `aclose` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L188" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
aclose(self) -> None
```

#### `create_device_authorization` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L242" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
create_device_authorization(self, metadata: DeviceMetadata | None = None) -> DeviceAuthorization
```

#### `exchange_device_authorization` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L262" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
exchange_device_authorization(self, device_code: str) -> DeviceTokenPoll
```

#### `get_current_user` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L287" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
get_current_user(self) -> HorizonUser
```

#### `list_organizations` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L297" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
list_organizations(self) -> tuple[HorizonOrganization, ...]
```

#### `revoke_current_api_key` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/cli/deploy/horizon_client.py#L326" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
revoke_current_api_key(self) -> None
```