# `vllm_mlx.mcp.config`

MCP configuration loading and validation.

[View the complete module source at #L1-L199](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L1-L199).

## API details

Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.

::: vllm_mlx.mcp.config
    options:
      members:
        - logger
        - CONFIG_SEARCH_PATHS
        - CONFIG_ENV_VAR
        - load_mcp_config
        - _find_config_file
        - validate_config
        - create_example_config
      filters: []
      show_if_no_docstring: true

## Complete contract reference

Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.

<details class="api-contract" id="contract-vllm_mlx.mcp.config.load_mcp_config" markdown="1">
<summary><code>vllm_mlx.mcp.config.load_mcp_config</code> · function</summary>

```python
vllm_mlx.mcp.config.load_mcp_config(path: Optional[Union[str, Path]] = None) -> MCPConfig
```

Load MCP configuration from file.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `Optional[Union[str, Path]]` | `no` | `None` | Optional explicit path to config file |

**Returns**

- Type: `MCPConfig`
- Direct return expressions: `MCPConfig()`; `validate_config(data)`

**Exceptions and behavior**

Function `load_mcp_config` calls `_find_config_file`, `logger.info`, `MCPConfig`, `Path(config_path).expanduser`; can raise `ImportError`; has 2 explicit return paths.
Directly raised exceptions: `ImportError`.

[View source #L26-L70](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L26-L70).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.config._find_config_file" markdown="1">
<summary><code>vllm_mlx.mcp.config._find_config_file</code> · function</summary>

```python
vllm_mlx.mcp.config._find_config_file(explicit_path: Optional[Union[str, Path]] = None) -> Optional[Path]
```

Find the config file to use.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `explicit_path` | `Optional[Union[str, Path]]` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Type: `Optional[Path]`
- Direct return expressions: `path`; `None`

**Exceptions and behavior**

Function `_find_config_file` calls `Path(explicit_path).expanduser`, `Path`, `path.exists`, `FileNotFoundError`; can raise `FileNotFoundError`; has 2 explicit return paths.
Directly raised exceptions: `FileNotFoundError`.

[View source #L73-L98](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L73-L98).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.config.validate_config" markdown="1">
<summary><code>vllm_mlx.mcp.config.validate_config</code> · function</summary>

```python
vllm_mlx.mcp.config.validate_config(data: Dict[str, Any]) -> MCPConfig
```

Validate and parse configuration dictionary.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `Dict[str, Any]` | `yes` | `none` | Raw configuration dictionary |

**Returns**

- Type: `MCPConfig`
- Direct return expressions: `MCPConfig(servers=servers, max_tool_calls=max_tool_calls, default_timeout=default_timeout, allowed_high_risk_tools=set(…`

**Exceptions and behavior**

Function `validate_config` calls `isinstance`, `ValueError`, `data.get`, `servers_data.items`; can raise `ValueError`; returns `MCPConfig(servers=servers, max_tool_calls=max_tool_calls, default_timeout=default_timeout, allowed_high_risk_tools=set(…`.
Directly raised exceptions: `ValueError`.

[View source #L101-L163](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L101-L163).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.config.create_example_config" markdown="1">
<summary><code>vllm_mlx.mcp.config.create_example_config</code> · function</summary>

```python
vllm_mlx.mcp.config.create_example_config() -> str
```

Create an example MCP configuration.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `str`
- Direct return expressions: `json.dumps(example, indent=2)`

**Exceptions and behavior**

Function `create_example_config` calls `json.dumps`; returns `json.dumps(example, indent=2)`.
No direct `raise` statement appears in this definition.

[View source #L166-L199](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L166-L199).

</details>

## Complete symbol map

This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.

| Symbol | Kind | Signature and inputs | What it does | Source |
| --- | --- | --- | --- | --- |
| [`load_mcp_config`](#contract-vllm_mlx.mcp.config.load_mcp_config) | function | `load_mcp_config(path: Optional[Union[str, Path]] = None) -> MCPConfig` | Load MCP configuration from file. | [#L26-L70](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L26-L70) |
| [`_find_config_file`](#contract-vllm_mlx.mcp.config._find_config_file) | function | `_find_config_file(explicit_path: Optional[Union[str, Path]] = None) -> Optional[Path]` | Find the config file to use. | [#L73-L98](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L73-L98) |
| [`validate_config`](#contract-vllm_mlx.mcp.config.validate_config) | function | `validate_config(data: Dict[str, Any]) -> MCPConfig` | Validate and parse configuration dictionary. | [#L101-L163](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L101-L163) |
| [`create_example_config`](#contract-vllm_mlx.mcp.config.create_example_config) | function | `create_example_config() -> str` | Create an example MCP configuration. | [#L166-L199](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/config.py#L166-L199) |
