Skip to content

# Mcp Server

## `` docforge.servers.mcp_server

### Summary

MCP server implementation.

This module defines the `MCPServer` class, which serves pre-generated documentation bundles through the Model Context Protocol (MCP).

### Classes

#### `` MCPServer

    1

    MCPServer(mcp_root: Path, name: str)

MCP server for serving a pre-generated documentation bundle.

The server exposes documentation resources and diagnostic tools through MCP endpoints backed by JSON files generated by the MCP renderer.

Initialize the MCP server.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`mcp_root` | `Path` | Directory containing the generated MCP documentation bundle (for example `index.json`, `nav.json`, and `modules/`). | required
`name` | `str` | Identifier used for the MCP server instance. | required

##### Functions

###### `` run

    1

    run(transport: Literal['stdio', 'sse', 'streamable-http'] = 'streamable-http') -> None

Start the MCP server.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`transport` | `Literal['stdio', 'sse', 'streamable-http']` | Transport mechanism used by the MCP server. Supported options include `stdio`, `sse`, and `streamable-http`. | `'streamable-http'`