search_mcp_docs
Search official MCP protocol and FastMCP framework documentation to find relevant information for building MCP servers. Enter a query to get ranked results with URLs, titles, and content previews.
Instructions
Search MCP protocol and FastMCP documentation with ranked results.
This tool provides access to comprehensive MCP documentation including:
MCP Protocol:
Architecture and core concepts
Transports (stdio, streamable HTTP)
Tools, Resources, and Prompts
Lifecycle and capabilities negotiation
Error handling and security
FastMCP Framework:
Python server patterns and decorators
Tool definitions with type hints
Resource and prompt templates
Client integration examples
Use this to find relevant MCP documentation for building MCP servers.
Args: query: Search query string (e.g., "tool input schema", "stdio transport") k: Maximum number of results to return (default: 5)
Returns: List of dictionaries containing: - url: Document URL - title: Display title - score: Relevance score (higher is better) - snippet: Contextual content preview
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| k | No |
Input Schema (JSON Schema)
Implementation Reference
- The core handler function for the 'search_mcp_docs' tool. It searches a cached documentation index for relevant MCP and FastMCP docs, hydrates top results with content for snippets, and returns a ranked list of results with URLs, titles, scores, and previews.def search_mcp_docs(query: str, k: int = 5) -> list[dict[str, Any]]: """Search MCP protocol and FastMCP documentation with ranked results. This tool provides access to comprehensive MCP documentation including: **MCP Protocol:** - Architecture and core concepts - Transports (stdio, streamable HTTP) - Tools, Resources, and Prompts - Lifecycle and capabilities negotiation - Error handling and security **FastMCP Framework:** - Python server patterns and decorators - Tool definitions with type hints - Resource and prompt templates - Client integration examples Use this to find relevant MCP documentation for building MCP servers. Args: query: Search query string (e.g., "tool input schema", "stdio transport") k: Maximum number of results to return (default: 5) Returns: List of dictionaries containing: - url: Document URL - title: Display title - score: Relevance score (higher is better) - snippet: Contextual content preview """ cache.ensure_ready() index = cache.get_index() if index is None: return [] results = index.search(query, k=k) url_cache = cache.get_url_cache() # Hydrate top results with content for snippets top = results[: min(len(results), cache.SNIPPET_HYDRATE_MAX)] for _, doc in top: cached = url_cache.get(doc.uri) if cached is None or not cached.content: cache.ensure_page(doc.uri) # Build response with snippets return_docs: list[dict[str, Any]] = [] for score, doc in results: page = url_cache.get(doc.uri) snippet = text_processor.make_snippet(page, doc.display_title) return_docs.append( { "url": doc.uri, "title": doc.display_title, "score": round(score, 3), "snippet": snippet, } ) return return_docs
- src/mcp_server_builder/server.py:15-15 (registration)Registers the search_mcp_docs tool on the FastMCP server instance using the @mcp.tool() decorator.mcp.tool()(docs.search_mcp_docs)
- src/mcp_server_builder/server.py:6-6 (registration)Imports the docs module containing the search_mcp_docs function for tool registration.from .tools import docs