mcp.documentation.doc_loader¶

MCP documentation loader using haive document loaders.

This module provides functionality to load, process, and extract information from MCP server documentation. It includes methods to parse README files, extract setup instructions, and generate configurations from documentation.

The loader processes documentation from:
  • Stored JSON files containing 992+ MCP server docs

  • GitHub repositories (via GitHubLoader)

  • Web documentation (via WebScraper)

  • Local documentation files

Classes:

MCPDocumentationLoader: Main class for loading and processing MCP documentation

Example

Loading and using MCP documentation:


from haive.mcp.documentation import MCPDocumentationLoader

from haive import agents

# Initialize loader loader = MCPDocumentationLoader()

# Load all documentation all_docs = loader.load_all_mcp_documents() print(f”Loaded {len(all_docs)} server documentations”)

# Get specific server documentation fs_doc = loader.get_server_documentation(“modelcontextprotocol/server-filesystem”)

# Extract setup information setup_info = loader.extract_setup_info(fs_doc) print(“Installation:”, setup_info[“installation”]) print(“Configuration:”, setup_info[“configuration”])

# Search by capability search_servers = loader.search_servers_by_capability(“search”) print(f”Found {len(search_servers)} servers with search capability”)

Note

The loader gracefully handles missing dependencies for document loaders.

Attributes¶

Classes¶

MCPDocumentationLoader

Loads and processes MCP server documentation from various sources.

Module Contents¶

class mcp.documentation.doc_loader.MCPDocumentationLoader(resources_path: pathlib.Path | None = None)¶

Loads and processes MCP server documentation from various sources.

extract_setup_info(server_doc: dict[str, Any]) dict[str, Any]¶

Extract setup information from server documentation.

Parameters:

server_doc – Server documentation dictionary

Returns:

Extracted setup information

async fetch_github_readme(repo_url: str) langchain_core.documents.Document | None¶

Fetch README from GitHub repository.

Parameters:

repo_url – GitHub repository URL

Returns:

Document containing README content

async fetch_server_website(url: str) langchain_core.documents.Document | None¶

Fetch documentation from server website.

Parameters:

url – Website URL

Returns:

Document containing website content

get_server_documentation(server_name: str) dict[str, Any] | None¶

Get documentation for a specific MCP server.

Parameters:

server_name – Name of the MCP server (e.g., “modelcontextprotocol/server-filesystem”)

Returns:

Server documentation or None if not found

load_all_mcp_documents() dict[str, dict[str, Any]]¶

Load all MCP server documentation from the stored JSON.

Returns:

Dictionary mapping server names to documentation dictionaries

search_servers_by_capability(capability: str) list[dict[str, Any]]¶

Search for MCP servers by capability mentioned in description.

Parameters:

capability – Capability to search for

Returns:

List of matching server documentation

search_servers_by_category(category: str) list[dict[str, Any]]¶

Search for MCP servers by category.

Parameters:

category – Category to search for (e.g., “Databases”, “File Systems”)

Returns:

List of matching server documentation

mcp_servers_path¶
resources_path = None¶
mcp.documentation.doc_loader.LOADERS_AVAILABLE = True¶
mcp.documentation.doc_loader.logger¶