Skip to main content
Glama
jcdumlao14

FastMCP Documentation & Web Scraping Server

by jcdumlao14

search_docs

Search indexed documentation files to find relevant information by querying the FastMCP documentation index and returning top matching filenames.

Instructions

Search the documentation index and return top filenames for query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • main.py:94-98 (handler)
    The handler function for the 'search_docs' tool. It is registered with the @mcp.tool decorator, calls the core implementation, and returns a list of top filenames matching the query.
    @mcp.tool def search_docs(query: str) -> list: """Search the documentation index and return top filenames for `query`.""" results = search_docs_impl(query, top_k=5) return [r.get('filename') for r in results]
  • main.py:88-92 (helper)
    Core implementation of the search logic. Retrieves the pre-built index and performs similarity search using minsearch, returning the top results.
    def search_docs_impl(query: str, top_k: int = 5): idx = get_index() results = idx.search(query, num_results=top_k) return results
  • main.py:81-86 (helper)
    Lazy-loading helper for the documentation index. Builds it on first use if not cached and returns the index instance.
    def get_index(): global _INDEX_CACHE if _INDEX_CACHE is None: _INDEX_CACHE = build_index_from_zip() return _INDEX_CACHE
  • main.py:69-79 (helper)
    Builds the minsearch index by downloading the FastMCP repo zip (if needed), extracting .md/.mdx files, and indexing their content and filenames.
    def build_index_from_zip(): docs = [] ensure_zip() for fname in os.listdir('.'): if fname.lower().endswith('.zip'): for filename, text in iter_md_files_from_zip(fname): docs.append({'content': text, 'filename': filename}) idx = Index(text_fields=["content"], keyword_fields=["filename"]) idx.fit(docs) return idx
  • main.py:44-53 (helper)
    Downloads the FastMCP GitHub repo zip archive if it doesn't exist locally.
    def ensure_zip(): if os.path.exists(ZIP_NAME): return resp = requests.get(ZIP_URL, stream=True, timeout=60) resp.raise_for_status() with open(ZIP_NAME, "wb") as f: for chunk in resp.iter_content(1024 * 64): if chunk: f.write(chunk)

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jcdumlao14/03-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server