MegalaniaDocs
Docs menu
  1. Docs
  2. Integrations
  3. LlamaIndex
Integrations

LlamaIndex

llms.txtUpdated 8 Nov 2026

install llama-index-readers-megalania, then MegalaniaReader().load_data(urls). The key comes from MEG_API_KEY. Blocked pages and errors are free.

Install

Python 3.10 or newer.

Shell
pip install llama-index-readers-megalania

Documents

Python
from llama_index.readers.megalania import MegalaniaReader

docs = MegalaniaReader().load_data(["https://docs.megalania.io/"])
print(docs[0].metadata["credits_charged"], docs[0].text[:200])

Each document holds Markdown, with source, request_id, credits_charged and target_status in its metadata. Pass any key of the JSON envelope as a keyword, for example country_code="DE". A blocked page raises MegalaniaError. MegalaniaReader(continue_on_failure=True) skips it instead.

A whole site, through a batch crawl:

Python
from llama_index.readers.megalania import MegalaniaReader

docs = MegalaniaReader().load_data("https://docs.megalania.io/", crawl={"max_pages": 20})
print(len(docs))

Then index them as usual:

Python
from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_documents(docs)
print(index.as_query_engine().query("What does Megalania sell?"))

Agents

LlamaIndex agents use our MCP server through llama-index-tools-mcp. They get every tool, with no extra package:

Python
import asyncio
import os

from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

client = BasicMCPClient("https://mcp.megalania.io/", headers={"Authorization": f"Bearer {os.environ['MEG_API_KEY']}"})
tools = asyncio.run(McpToolSpec(client=client).to_tool_list_async())

The code is MIT licensed at https://github.com/megalania/megalania-python.