# `vllm_mlx.mcp.types`

Type definitions for MCP client support.

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

## 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.types
    options:
      members:
        - MCPTransport
        - MCPServerState
        - MCPServerConfig
        - MCPConfig
        - MCPTool
        - MCPToolResult
        - MCPServerStatus
      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.types.MCPTransport" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPTransport</code> · class</summary>

```python
vllm_mlx.mcp.types.MCPTransport()
```

Supported MCP transport types.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Constructs: `vllm_mlx.mcp.types.MCPTransport`

**Exceptions and behavior**

Class `MCPTransport` derives from `str`, `Enum` and declares 0 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L11-L15](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L11-L15).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPServerState" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPServerState</code> · class</summary>

```python
vllm_mlx.mcp.types.MCPServerState()
```

MCP server connection states.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Constructs: `vllm_mlx.mcp.types.MCPServerState`

**Exceptions and behavior**

Class `MCPServerState` derives from `str`, `Enum` and declares 0 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L18-L24](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L18-L24).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPServerConfig" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPServerConfig</code> · class</summary>

```python
vllm_mlx.mcp.types.MCPServerConfig(name: str, transport: MCPTransport = MCPTransport.STDIO, command: Optional[str] = None, args: Optional[List[str]] = None, env: Optional[Dict[str, str]] = None, url: Optional[str] = None, enabled: bool = True, timeout: float = 30.0)
```

Configuration for a single MCP server.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `str` | `yes` | `none` | Required constructor field. |
| `transport` | `MCPTransport` | `no` | `MCPTransport.STDIO` | Optional constructor field; defaults to `MCPTransport.STDIO`. |
| `command` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `args` | `Optional[List[str]]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `env` | `Optional[Dict[str, str]]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `url` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `enabled` | `bool` | `no` | `True` | Optional constructor field; defaults to `True`. |
| `timeout` | `float` | `no` | `30.0` | Optional constructor field; defaults to `30.0`. |

**Returns**

- Constructs: `vllm_mlx.mcp.types.MCPServerConfig`

**Exceptions and behavior**

Class `MCPServerConfig` declares 2 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L28-L78](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L28-L78).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPServerConfig.__post_init__" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPServerConfig.__post_init__</code> · method</summary>

```python
vllm_mlx.mcp.types.MCPServerConfig.__post_init__() -> not annotated
```

Validate configuration.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `MCPServerConfig.__post_init__` updates `self.transport`; calls `isinstance`, `MCPTransport`, `ValueError`, `self._validate_security`; can raise `ValueError`.
Directly raised exceptions: `ValueError`.

[View source #L46-L63](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L46-L63).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPServerConfig._validate_security" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPServerConfig._validate_security</code> · method</summary>

```python
vllm_mlx.mcp.types.MCPServerConfig._validate_security() -> None
```

Validate security of the configuration.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `None`

**Exceptions and behavior**

Method `MCPServerConfig._validate_security` calls `validate_mcp_server_config`, `ValueError`, `str`; can raise `ValueError`.
Directly raised exceptions: `ValueError`.

[View source #L65-L78](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L65-L78).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPConfig" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPConfig</code> · class</summary>

```python
vllm_mlx.mcp.types.MCPConfig(servers: Dict[str, MCPServerConfig] = field(default_factory=dict), max_tool_calls: int = 10, default_timeout: float = 30.0, allowed_high_risk_tools: Set[str] = field(default_factory=set))
```

Root configuration for MCP client.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `servers` | `Dict[str, MCPServerConfig]` | `no` | `field(default_factory=dict)` | Optional constructor field; defaults to `field(default_factory=dict)`. |
| `max_tool_calls` | `int` | `no` | `10` | Optional constructor field; defaults to `10`. |
| `default_timeout` | `float` | `no` | `30.0` | Optional constructor field; defaults to `30.0`. |
| `allowed_high_risk_tools` | `Set[str]` | `no` | `field(default_factory=set)` | Optional constructor field; defaults to `field(default_factory=set)`. |

**Returns**

- Constructs: `vllm_mlx.mcp.types.MCPConfig`

**Exceptions and behavior**

Class `MCPConfig` declares 1 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L82-L103](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L82-L103).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPConfig.from_dict" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPConfig.from_dict</code> · method</summary>

```python
vllm_mlx.mcp.types.MCPConfig.from_dict(data: Dict[str, Any]) -> 'MCPConfig'
```

Create config from dictionary.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `Dict[str, Any]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `'MCPConfig'`
- Direct return expressions: `cls(servers=servers, max_tool_calls=data.get('max_tool_calls', 10), default_timeout=data.get('default_timeout', 30.0), …`

**Exceptions and behavior**

Method `MCPConfig.from_dict` calls `data.get('servers', {}).items`, `data.get`, `MCPServerConfig`, `cls`; returns `cls(servers=servers, max_tool_calls=data.get('max_tool_calls', 10), default_timeout=data.get('default_timeout', 30.0), …`.
No direct `raise` statement appears in this definition.

[View source #L91-L103](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L91-L103).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPTool" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPTool</code> · class</summary>

```python
vllm_mlx.mcp.types.MCPTool(server_name: str, name: str, description: str, input_schema: Dict[str, Any] = field(default_factory=dict))
```

Normalized tool representation from MCP server.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `server_name` | `str` | `yes` | `none` | Required constructor field. |
| `name` | `str` | `yes` | `none` | Required constructor field. |
| `description` | `str` | `yes` | `none` | Required constructor field. |
| `input_schema` | `Dict[str, Any]` | `no` | `field(default_factory=dict)` | Optional constructor field; defaults to `field(default_factory=dict)`. |

**Returns**

- Constructs: `vllm_mlx.mcp.types.MCPTool`

**Exceptions and behavior**

Class `MCPTool` declares 2 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L107-L129](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L107-L129).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPTool.full_name" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPTool.full_name</code> · method</summary>

```python
vllm_mlx.mcp.types.MCPTool.full_name() -> str
```

Get namespaced tool name (server__tool).

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `str`
- Direct return expressions: `f'{self.server_name}__{self.name}'`

**Exceptions and behavior**

Method `MCPTool.full_name` returns `f'{self.server_name}__{self.name}'`.
No direct `raise` statement appears in this definition.

[View source #L116-L118](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L116-L118).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPTool.to_openai_format" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPTool.to_openai_format</code> · method</summary>

```python
vllm_mlx.mcp.types.MCPTool.to_openai_format() -> Dict[str, Any]
```

Convert to OpenAI function calling format.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `Dict[str, Any]`
- Direct return expressions: `{'type': 'function', 'function': {'name': self.full_name, 'description': self.description, 'parameters': self.input_sch…`

**Exceptions and behavior**

Method `MCPTool.to_openai_format` returns `{'type': 'function', 'function': {'name': self.full_name, 'description': self.description, 'parameters': self.input_sch…`.
No direct `raise` statement appears in this definition.

[View source #L120-L129](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L120-L129).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPToolResult" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPToolResult</code> · class</summary>

```python
vllm_mlx.mcp.types.MCPToolResult(tool_name: str, content: Any, is_error: bool = False, error_message: Optional[str] = None)
```

Result from a tool execution.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_name` | `str` | `yes` | `none` | Required constructor field. |
| `content` | `Any` | `yes` | `none` | Required constructor field. |
| `is_error` | `bool` | `no` | `False` | Optional constructor field; defaults to `False`. |
| `error_message` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |

**Returns**

- Constructs: `vllm_mlx.mcp.types.MCPToolResult`

**Exceptions and behavior**

Class `MCPToolResult` declares 1 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L133-L156](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L133-L156).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPToolResult.to_message" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPToolResult.to_message</code> · method</summary>

```python
vllm_mlx.mcp.types.MCPToolResult.to_message(tool_call_id: str) -> Dict[str, Any]
```

Convert to OpenAI tool result message format.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tool_call_id` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `Dict[str, Any]`
- Direct return expressions: `{'role': 'tool', 'tool_call_id': tool_call_id, 'content': content}`

**Exceptions and behavior**

Method `MCPToolResult.to_message` calls `isinstance`, `json.dumps`; returns `{'role': 'tool', 'tool_call_id': tool_call_id, 'content': content}`.
No direct `raise` statement appears in this definition.

[View source #L141-L156](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L141-L156).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPServerStatus" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPServerStatus</code> · class</summary>

```python
vllm_mlx.mcp.types.MCPServerStatus(name: str, state: MCPServerState, transport: MCPTransport, tools_count: int = 0, error: Optional[str] = None, last_connected: Optional[float] = None)
```

Status of an MCP server connection.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `str` | `yes` | `none` | Required constructor field. |
| `state` | `MCPServerState` | `yes` | `none` | Required constructor field. |
| `transport` | `MCPTransport` | `yes` | `none` | Required constructor field. |
| `tools_count` | `int` | `no` | `0` | Optional constructor field; defaults to `0`. |
| `error` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `last_connected` | `Optional[float]` | `no` | `None` | Optional constructor field; defaults to `None`. |

**Returns**

- Constructs: `vllm_mlx.mcp.types.MCPServerStatus`

**Exceptions and behavior**

Class `MCPServerStatus` declares 1 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L160-L179](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L160-L179).

</details>

<details class="api-contract" id="contract-vllm_mlx.mcp.types.MCPServerStatus.to_dict" markdown="1">
<summary><code>vllm_mlx.mcp.types.MCPServerStatus.to_dict</code> · method</summary>

```python
vllm_mlx.mcp.types.MCPServerStatus.to_dict() -> Dict[str, Any]
```

Convert to dictionary for API response.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `Dict[str, Any]`
- Direct return expressions: `{'name': self.name, 'state': self.state.value, 'transport': self.transport.value, 'tools_count': self.tools_count, 'err…`

**Exceptions and behavior**

Method `MCPServerStatus.to_dict` returns `{'name': self.name, 'state': self.state.value, 'transport': self.transport.value, 'tools_count': self.tools_count, 'err…`.
No direct `raise` statement appears in this definition.

[View source #L170-L179](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L170-L179).

</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 |
| --- | --- | --- | --- | --- |
| [`MCPTransport`](#contract-vllm_mlx.mcp.types.MCPTransport) | class | `MCPTransport()` | Supported MCP transport types. | [#L11-L15](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L11-L15) |
| [`MCPServerState`](#contract-vllm_mlx.mcp.types.MCPServerState) | class | `MCPServerState()` | MCP server connection states. | [#L18-L24](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L18-L24) |
| [`MCPServerConfig`](#contract-vllm_mlx.mcp.types.MCPServerConfig) | class | `MCPServerConfig(name: str, transport: MCPTransport = MCPTransport.STDIO, command: Optional[str] = None, args: Optional[List[str]] = None, env: Optional[Dict[str, str]] = None, url: Optional[str] = None, enabled: bool = True, timeout: float = 30.0)` | Configuration for a single MCP server. | [#L28-L78](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L28-L78) |
| [`MCPServerConfig.__post_init__`](#contract-vllm_mlx.mcp.types.MCPServerConfig.__post_init__) | method | `MCPServerConfig.__post_init__() -> not annotated` | Validate configuration. | [#L46-L63](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L46-L63) |
| [`MCPServerConfig._validate_security`](#contract-vllm_mlx.mcp.types.MCPServerConfig._validate_security) | method | `MCPServerConfig._validate_security() -> None` | Validate security of the configuration. | [#L65-L78](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L65-L78) |
| [`MCPConfig`](#contract-vllm_mlx.mcp.types.MCPConfig) | class | `MCPConfig(servers: Dict[str, MCPServerConfig] = field(default_factory=dict), max_tool_calls: int = 10, default_timeout: float = 30.0, allowed_high_risk_tools: Set[str] = field(default_factory=set))` | Root configuration for MCP client. | [#L82-L103](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L82-L103) |
| [`MCPConfig.from_dict`](#contract-vllm_mlx.mcp.types.MCPConfig.from_dict) | method | `MCPConfig.from_dict(data: Dict[str, Any]) -> 'MCPConfig'` | Create config from dictionary. | [#L91-L103](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L91-L103) |
| [`MCPTool`](#contract-vllm_mlx.mcp.types.MCPTool) | class | `MCPTool(server_name: str, name: str, description: str, input_schema: Dict[str, Any] = field(default_factory=dict))` | Normalized tool representation from MCP server. | [#L107-L129](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L107-L129) |
| [`MCPTool.full_name`](#contract-vllm_mlx.mcp.types.MCPTool.full_name) | method | `MCPTool.full_name() -> str` | Get namespaced tool name (server__tool). | [#L116-L118](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L116-L118) |
| [`MCPTool.to_openai_format`](#contract-vllm_mlx.mcp.types.MCPTool.to_openai_format) | method | `MCPTool.to_openai_format() -> Dict[str, Any]` | Convert to OpenAI function calling format. | [#L120-L129](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L120-L129) |
| [`MCPToolResult`](#contract-vllm_mlx.mcp.types.MCPToolResult) | class | `MCPToolResult(tool_name: str, content: Any, is_error: bool = False, error_message: Optional[str] = None)` | Result from a tool execution. | [#L133-L156](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L133-L156) |
| [`MCPToolResult.to_message`](#contract-vllm_mlx.mcp.types.MCPToolResult.to_message) | method | `MCPToolResult.to_message(tool_call_id: str) -> Dict[str, Any]` | Convert to OpenAI tool result message format. | [#L141-L156](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L141-L156) |
| [`MCPServerStatus`](#contract-vllm_mlx.mcp.types.MCPServerStatus) | class | `MCPServerStatus(name: str, state: MCPServerState, transport: MCPTransport, tools_count: int = 0, error: Optional[str] = None, last_connected: Optional[float] = None)` | Status of an MCP server connection. | [#L160-L179](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L160-L179) |
| [`MCPServerStatus.to_dict`](#contract-vllm_mlx.mcp.types.MCPServerStatus.to_dict) | method | `MCPServerStatus.to_dict() -> Dict[str, Any]` | Convert to dictionary for API response. | [#L170-L179](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/mcp/types.py#L170-L179) |
