You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Write configuration using adapter serialization."""
197
+
# Use get_adapter(self.get_adapter_host_name()) for serialization
198
+
...
182
199
```
183
200
201
+
**The `@register_host_strategy` decorator** registers the strategy class in a global dictionary (`MCPHostRegistry._strategies`) keyed by `MCPHostType`. This enables `MCPHostRegistry.get_strategy(host_type)` to look up and instantiate the correct strategy at runtime. The decorator is defined in `host_management.py` as a convenience wrapper around `MCPHostRegistry.register()`.
202
+
203
+
#### MCPHostStrategy Interface
204
+
205
+
The base `MCPHostStrategy` class (defined in `host_management.py`) provides the full strategy interface. The table below shows which methods typically need overriding vs which can be inherited from family base classes.
|`is_host_available()`| Always | -- | Check if host is installed on system |
211
+
|`get_config_key()`| Usually | From family | Most hosts use `"mcpServers"` (default) |
212
+
|`get_adapter_host_name()`| Usually | From family | Maps strategy to adapter registry entry |
213
+
|`validate_server_config()`| Usually | From family | Basic transport presence check |
214
+
|`read_configuration()`| Sometimes | From family | JSON read is identical across families |
215
+
|`write_configuration()`| Sometimes | From family | JSON write with adapter serialization |
216
+
217
+
> **Cross-reference:** See the [Architecture Doc -- MCPHostStrategy](../architecture/mcp_host_configuration.md#key-components) for the full interface specification.
218
+
184
219
**Inheriting from existing strategy families:**
185
220
221
+
If your host uses a standard JSON format, inherit from an existing family base class to get `read_configuration()`, `write_configuration()`, and shared validation for free:
222
+
186
223
```python
187
-
# If similar to Claude (standard JSON format)
224
+
# If similar to Claude (standard JSON format with mcpServers key)
0 commit comments