added mcp_renderer

This commit is contained in:
2026-01-21 16:18:25 +05:30
parent 9a5e356039
commit 427e407d26
17 changed files with 212 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
from pathlib import Path
from typing import Iterable
from docforge.models import Project, Module, DocObject
class MCPRenderer:
"""
Renderer that emits MCP-compatible documentation resources.
"""
name: str
def generate_sources(self, project: Project, out_dir: Path) -> None:
"""Generate MCP resources for the given project."""
def _write_module(self, module: Module, out_dir: Path) -> None:
"""Write a single module as an MCP resource."""
def _render_module(self, module: Module) -> str:
"""Render a module and its contents into a text document."""
def _render_object(
self,
obj: DocObject,
level: int,
) -> Iterable[str]:
"""Recursively render a documented object and its members."""
def _module_resource_path(self, module: Module) -> Path:
"""Compute the MCP resource path for a module."""