feat: add standards wiki, MCP registry, and app template
This commit is contained in:
22
config.py
22
config.py
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
@@ -11,6 +11,7 @@ class MCPBundle:
|
||||
root: Path
|
||||
name: str
|
||||
port: int
|
||||
kind: str = "docs" # "docs" -> base MCPServer; "registry" -> StandardsMCPServer
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -31,15 +32,19 @@ class ServiceConfig:
|
||||
html_port: int
|
||||
health_port: int
|
||||
repos: tuple[RepoDoc, ...]
|
||||
mcp_static: dict[str, MCPBundle] = field(default_factory=dict)
|
||||
|
||||
@property
|
||||
def mcp_servers(self) -> dict[str, MCPBundle]:
|
||||
"""Return only repos that expose an MCP server."""
|
||||
return {
|
||||
"""Return every MCP server: one per repo that declares a bundle, plus
|
||||
the hand-authored static servers (for example the standards registry)."""
|
||||
servers: dict[str, MCPBundle] = {
|
||||
r.name: MCPBundle(root=Path("mcp") / r.name, name=r.mcp_server, port=r.mcp_port)
|
||||
for r in self.repos
|
||||
if r.mcp_port is not None
|
||||
}
|
||||
servers.update(self.mcp_static)
|
||||
return servers
|
||||
|
||||
|
||||
def load_config(path: Path | str = "config.yml") -> ServiceConfig:
|
||||
@@ -60,9 +65,20 @@ def load_config(path: Path | str = "config.yml") -> ServiceConfig:
|
||||
mcp_server=mcp["server"] if mcp else None,
|
||||
mcp_port=mcp["port"] if mcp else None,
|
||||
))
|
||||
|
||||
mcp_static: dict[str, MCPBundle] = {}
|
||||
for entry in data.get("mcp_static", []):
|
||||
mcp_static[entry["name"]] = MCPBundle(
|
||||
root=Path("mcp") / entry["bundle"],
|
||||
name=entry.get("server") or entry["name"],
|
||||
port=entry["port"],
|
||||
kind=entry.get("kind", "docs"),
|
||||
)
|
||||
|
||||
return ServiceConfig(
|
||||
name=service.get("name", "aetos-docs"),
|
||||
html_port=service.get("html_port", 9000),
|
||||
health_port=service.get("health_port", 8000),
|
||||
repos=tuple(repos),
|
||||
mcp_static=mcp_static,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user