chore(release): 0.0.7
Squash-merge lib-standardisation: adopt repo standards across packaging, tooling, docs, and CI. - standardize pyproject.toml (canonical packaging, lint config, extras, GSDFC pydoclint) - add py.typed marker, modernize type hints and Google-style docstrings - nest generated docs under docs/lib and docs/mcp; add hand-written wiki - adopt standard Type A PyPI CI pipeline (tag==version guard + quality gate) - promote generated CHANGELOG.md; bump version to 0.0.7
This commit is contained in:
@@ -5,6 +5,16 @@ MCP server implementation.
|
||||
|
||||
This module defines the `MCPServer` class, which serves pre-generated
|
||||
documentation bundles through the Model Context Protocol (MCP).
|
||||
|
||||
---
|
||||
|
||||
Notes:
|
||||
- The served bundle is generated offline by `MCPRenderer`.
|
||||
- Missing resources are reported as structured error dictionaries rather
|
||||
than raising exceptions.
|
||||
- The server exposes read-only resources and a single health-check tool.
|
||||
|
||||
---
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -22,6 +32,14 @@ class MCPServer:
|
||||
|
||||
The server exposes documentation resources and diagnostic tools through
|
||||
MCP endpoints backed by JSON files generated by the MCP renderer.
|
||||
|
||||
Attributes:
|
||||
mcp_root (Path):
|
||||
Directory containing the generated MCP documentation bundle.
|
||||
|
||||
app (FastMCP):
|
||||
Underlying FastMCP application instance that registers resources
|
||||
and tools.
|
||||
"""
|
||||
|
||||
def __init__(self, mcp_root: Path, name: str) -> None:
|
||||
@@ -96,9 +114,7 @@ class MCPServer:
|
||||
|
||||
@self.app.resource("docs://modules/{module}")
|
||||
def module(module: str):
|
||||
return self._read_json(
|
||||
self.mcp_root / "modules" / f"{module}.json"
|
||||
)
|
||||
return self._read_json(self.mcp_root / "modules" / f"{module}.json")
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# MCP tools
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
from pathlib import Path
|
||||
from typing import Literal, Any
|
||||
from typing import Any, Literal
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
|
||||
class MCPServer:
|
||||
"""MCP server for serving documentation."""
|
||||
"""MCP server serving a pre-generated documentation bundle.
|
||||
|
||||
Exposes read-only documentation resources and a health-check tool.
|
||||
"""
|
||||
|
||||
mcp_root: Path
|
||||
app: FastMCP
|
||||
|
||||
def __init__(self, mcp_root: Path, name: str) -> None: ...
|
||||
|
||||
def _read_json(self, path: Path) -> Any: ...
|
||||
|
||||
def _register_resources(self) -> None: ...
|
||||
|
||||
def _register_tools(self) -> None: ...
|
||||
|
||||
def run(self, transport: Literal["stdio", "sse", "streamable-http"] = ...) -> None:
|
||||
"""Start the MCP server."""
|
||||
|
||||
Reference in New Issue
Block a user