feat(lib): bundle MCP servers from .common/lib into factory/lib/
Copies source (no node_modules, dist, .tasks, .wiki, __pycache__) for: - projects-meta-mcp v2.25.0 (TypeScript/Node) - wiki-graph v0.3.1 (TypeScript/Node) - interns-mcp v0.3.3 (Python/FastMCP) .gitignore: exclude lib build artefacts (node_modules, dist, .venv, __pycache__, *.pyc) bootstrap.ps1: add MCP build step — npm install+build for TS servers, venv+pip for Python Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
38
lib/interns-mcp/interns_mcp/registry.py
Normal file
38
lib/interns-mcp/interns_mcp/registry.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Load intern catalog from config.yaml."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from .interns.base import Intern
|
||||
from .interns.bulk_text_read import BulkTextRead
|
||||
from .interns.grep_audit import GrepAudit
|
||||
from .interns.repo_read import RepoRead
|
||||
from .interns.transcript_distill import TranscriptDistill
|
||||
|
||||
# Explicit registry — MVP choice (see design spec open questions).
|
||||
INTERN_CLASSES: dict[str, type[Intern]] = {
|
||||
"bulk_text_read": BulkTextRead,
|
||||
"grep_audit": GrepAudit,
|
||||
"repo_read": RepoRead,
|
||||
"transcript_distill": TranscriptDistill,
|
||||
}
|
||||
|
||||
|
||||
def load_config(config_path: Path) -> dict[str, Any]:
|
||||
with open(config_path, encoding="utf-8") as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
||||
def load_interns(config: dict[str, Any], client: Any = None, safety: Any = None) -> list[Intern]:
|
||||
"""Instantiate interns from config, wiring shared client and safety."""
|
||||
interns = []
|
||||
for intern_id, intern_cfg in config.get("interns", {}).items():
|
||||
cls = INTERN_CLASSES.get(intern_id)
|
||||
if cls is None:
|
||||
continue
|
||||
interns.append(cls(config=intern_cfg, client=client, safety=safety))
|
||||
return interns
|
||||
Reference in New Issue
Block a user