# Connect LlamaIndex to aicharged.io

> LlamaIndex: BasicMCPClient with headers, then McpToolSpec turns the tools into LlamaIndex tools.

## At a glance

| Kind | Sign-in | Platforms | Status | Verified |
|---|---|---|---|---|
| SDKs & frameworks | API key (Bearer), OAuth sign-in | macOS, Linux, Windows | works today | 2026-10-22 |

- MCP: `https://aicharged.io/api/v1/mcp`
- Docs: https://developers.llamaindex.ai/python/framework-api-reference/tools/mcp

## Recipe

Client code:

```python
import asyncio, os
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

async def main():
    client = BasicMCPClient("https://aicharged.io/api/v1/mcp", headers={"Authorization": f"Bearer {os.environ['AICHARGED_API_KEY']}"})
    tools = await McpToolSpec(client=client).to_tool_list_async()
    print([tool.metadata.name for tool in tools])

asyncio.run(main())
```

Install the package:

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

[Client documentation](https://developers.llamaindex.ai/python/framework-api-reference/tools/mcp)

## Authentication

- Send `Authorization: Bearer <API_KEY>` with every request. Create a key at https://aicharged.io/admin/account/api-keys.
- OAuth 2.1 (PKCE S256) is available for clients that cannot send a static key (ChatGPT).
- Without a key the endpoint answers 401 with a WWW-Authenticate header that points to https://aicharged.io/.well-known/oauth-protected-resource.

All 51 clients: https://aicharged.io/connect.md

HTML version: https://aicharged.io/connect/llamaindex
