> For the complete documentation index, see [llms.txt](https://doc.thordata.com/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.thordata.com/doc/scraping/serp-api/integration/mcp-integration/llamaindex-integration.md).

# LlamaIndex Integration

Integrate Thordata MCP Server with LlamaIndex to give AI agents access to real-time SERP data and structured search results.

Connect LlamaIndex agents to the ThorData MCP server to add real-time web search, scraping, and structured data retrieval to your RAG and indexing pipelines.

#### Hosted MCP

{% stepper %}
{% step %}
**Get your API token**

* Go to [SERP API-API Token](https://dashboard.thordata.com/serp-api/get-started) to create an API Token;
* Copy your API Token (format as: `sk_7qBRe***************************`）
  {% endstep %}

{% step %}
**Install the LlamaIndex MCP toolkit**

```
pip install llama-index-tools-mcp
```

{% endstep %}

{% step %}
**Configure your MCP server**

```
import asyncio
from llama_index.tools.mcp import BasicMCPClient

async def main():
    http_client = BasicMCPClient("https://mcp.thordata.com/API_TOKEN/mcp")

    # List tools
    tools = await http_client.list_tools()
    print("Tools:", tools)

    # Call a tool
    result = await http_client.call_tool("scrape_as_markdown", {"url":"https://docs.llamaindex.ai/en/stable/examples/tools/mcp/"})
    print("Result:", result)

asyncio.run(main())

```

{% endstep %}

{% step %}
**Test to see if it works.**

* Run your LlamaIndex script using the manual tool.
* You should be able to see the requested URL in Markdown.
  {% endstep %}

{% step %}
**Monitor usage**

View your API usage in the [ThorData SERP API usage logs](https://dashboard.thordata.com/serp-api/get-started).
{% endstep %}
{% endstepper %}
