Skip to content

Commit 0bc06fb

Browse files
Merge pull request #48 from LittleCoinCoin/dev
[v0.8.1-dev.2] Augment MCP host support & CLI logging improvements
2 parents 9d7f0e5 + 5fd15dd commit 0bc06fb

File tree

11 files changed

+54
-16
lines changed

11 files changed

+54
-16
lines changed

.claude/skills/adding-mcp-hosts/references/testing-fixtures.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,33 @@ Minimal example (modeled on the `lmstudio` entry, which uses `CLAUDE_FIELDS`):
2727

2828
For hosts with extra fields, add them alongside the universals (see `gemini` or `codex` entries for examples with `httpUrl`, `timeout`, `includeTools`, `cwd`, etc.).
2929

30-
## 2. host_registry.py entries
30+
## 2. test_adapter_protocol.py entries
31+
32+
`tests/unit/mcp/test_adapter_protocol.py` has two **static** lists that are NOT auto-updated by the data-driven infrastructure. Both must be updated manually:
33+
34+
**`ALL_ADAPTERS`** -- append the new adapter class:
35+
36+
```python
37+
ALL_ADAPTERS = [
38+
# ... existing entries ...
39+
NewHostAdapter,
40+
]
41+
```
42+
43+
**`HOST_ADAPTER_MAP`** -- add the `MCPHostType → adapter class` mapping:
44+
45+
```python
46+
HOST_ADAPTER_MAP = {
47+
# ... existing entries ...
48+
MCPHostType.NEW_HOST: NewHostAdapter,
49+
}
50+
```
51+
52+
Import `NewHostAdapter` and `MCPHostType.NEW_HOST` at the top of the file alongside the existing imports. Missing either entry means the AP-01…AP-06 protocol compliance tests silently skip the new adapter — they pass without covering it.
53+
54+
---
55+
56+
## 3. host_registry.py entries
3157

3258
Make three additions in `tests/test_data/mcp_adapters/host_registry.py`.
3359

docs/articles/users/CLIReference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ These flags are accepted by the top-level parser and apply to all commands unles
5050
| `--envs-dir` | path | Directory to store environments | `~/.hatch/envs` |
5151
| `--cache-ttl` | int | Cache time-to-live in seconds | `86400` (1 day) |
5252
| `--cache-dir` | path | Directory to store cached packages | `~/.hatch/cache` |
53+
| `--log-level` | choice | Log verbosity: `DEBUG`, `INFO`, `WARNING`, `ERROR` | `WARNING` |
5354

5455
Example:
5556

hatch/cli/__main__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ def main() -> int:
972972
"""
973973
# Configure logging
974974
logging.basicConfig(
975-
level=logging.INFO,
975+
level=logging.WARNING,
976976
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
977977
)
978978

@@ -1010,8 +1010,15 @@ def main() -> int:
10101010
default=Path.home() / ".hatch" / "cache",
10111011
help="Directory to store cached packages",
10121012
)
1013+
parser.add_argument(
1014+
"--log-level",
1015+
default="WARNING",
1016+
choices=["DEBUG", "INFO", "WARNING", "ERROR"],
1017+
help="Log verbosity level (default: WARNING)",
1018+
)
10131019

10141020
args = parser.parse_args()
1021+
logging.getLogger().setLevel(getattr(logging, args.log_level))
10151022

10161023
# Initialize managers (lazy - only when needed)
10171024
from hatch.environment_manager import HatchEnvironmentManager

hatch/environment_manager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def __init__(
6262
"""
6363

6464
self.logger = logging.getLogger("hatch.environment_manager")
65-
self.logger.setLevel(logging.INFO)
6665
# Set up environment directories
6766
self.environments_dir = environments_dir or (Path.home() / ".hatch" / "envs")
6867
self.environments_dir.mkdir(exist_ok=True)

hatch/installers/dependency_installation_orchestrator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def __init__(
6767
registry_data (Dict[str, Any]): Registry data for dependency resolution.
6868
"""
6969
self.logger = logging.getLogger("hatch.dependency_orchestrator")
70-
self.logger.setLevel(logging.INFO)
7170
self.package_loader = package_loader
7271
self.registry_service = registry_service
7372
self.registry_data = registry_data

hatch/installers/docker_installer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from .registry import installer_registry
2121

2222
logger = logging.getLogger("hatch.installers.docker_installer")
23-
logger.setLevel(logging.INFO)
2423

2524
# Handle docker-py import with graceful fallback
2625
DOCKER_AVAILABLE = False

hatch/installers/python_installer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class PythonInstaller(DependencyInstaller):
3131
def __init__(self):
3232
"""Initialize the PythonInstaller."""
3333
self.logger = logging.getLogger("hatch.installers.python_installer")
34-
self.logger.setLevel(logging.INFO)
3534

3635
@property
3736
def installer_type(self) -> str:

hatch/installers/system_installer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class SystemInstaller(DependencyInstaller):
3333
def __init__(self):
3434
"""Initialize the SystemInstaller."""
3535
self.logger = logging.getLogger("hatch.installers.system_installer")
36-
self.logger.setLevel(logging.INFO)
3736

3837
@property
3938
def installer_type(self) -> str:

hatch/package_loader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def __init__(self, cache_dir: Optional[Path] = None):
3131
Defaults to ~/.hatch/packages.
3232
"""
3333
self.logger = logging.getLogger("hatch.package_loader")
34-
self.logger.setLevel(logging.INFO)
3534

3635
# Set up cache directory
3736
if cache_dir is None:

hatch/python_environment_manager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def __init__(self, environments_dir: Optional[Path] = None):
4141
Defaults to ~/.hatch/envs.
4242
"""
4343
self.logger = logging.getLogger("hatch.python_environment_manager")
44-
self.logger.setLevel(logging.INFO)
4544

4645
# Set up environment directories
4746
self.environments_dir = environments_dir or (Path.home() / ".hatch" / "envs")

0 commit comments

Comments
 (0)