added mcp server code
This commit is contained in:
@@ -192,6 +192,40 @@ def build(mkdocs_yml: Path) -> None:
|
||||
click.echo("MkDocs build completed")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# serve-mcp
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
@cli.command(name="serve-mcp")
|
||||
def serve_mcp() -> None:
|
||||
"""
|
||||
Serve MCP documentation from the local mcp_docs directory.
|
||||
"""
|
||||
from docforge.servers import MCPServer
|
||||
|
||||
mcp_root = Path.cwd() / "mcp_docs"
|
||||
|
||||
if not mcp_root.exists():
|
||||
raise click.ClickException("mcp_docs directory not found")
|
||||
|
||||
required = [
|
||||
mcp_root / "index.json",
|
||||
mcp_root / "nav.json",
|
||||
mcp_root / "modules",
|
||||
]
|
||||
|
||||
for path in required:
|
||||
if not path.exists():
|
||||
raise click.ClickException(f"Invalid MCP bundle, missing: {path.name}")
|
||||
|
||||
server = MCPServer(
|
||||
mcp_root=mcp_root,
|
||||
name="doc-forge-mcp",
|
||||
)
|
||||
|
||||
server.run()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# serve
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user