Skip to content

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

3.7 KB
Raw Blame
---
title: credentials
sidebarTitle: credentials
---

# `fastmcp.cli.deploy.credentials`


Restricted Horizon credential storage and resolution.

## Functions

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

```python
resolve_credential(store: CredentialStore) -> ResolvedCredential
```


Resolve environment, stored, then interactive credentials.


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

```python
revoke_and_clear_credential(client: HorizonClient, store: CredentialStore) -> None
```


Attempt remote revocation and always remove the stored credential.


## Classes

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


No Horizon credential is available without interactive authorization.


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

**Methods:**

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

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

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

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


Persist the active personal Horizon API key.


**Methods:**

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

```python
load(self) -> SecretStr | None
```

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

```python
save(self, api_key: SecretStr | str) -> None
```

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

```python
save_for_origin(self, api_key: SecretStr | str) -> None
```

Save a key only while its issuing Horizon origin is active.


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

```python
clear_if_matches(self, api_key: SecretStr | str) -> None
```

Clear a key only while its Horizon origin and value are active.


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

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