# Connect smolagents to aicharged.io

> Hugging Face smolagents: MCPClient over streamable-http; its docs do not show the headers key.

## At a glance

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

- MCP: `https://aicharged.io/api/v1/mcp`
- Docs: https://huggingface.co/docs/smolagents/en/tutorials/tools

## Recipe

Client code:

```python
import os
from smolagents import MCPClient

server = {
    "url": "https://aicharged.io/api/v1/mcp",
    "transport": "streamable-http",
    "headers": {"Authorization": f"Bearer {os.environ['AICHARGED_API_KEY']}"},
}
with MCPClient(server) as tools:
    print([tool.name for tool in tools])
```

Unverified: smolagents passes this dict to the streamablehttp_client of the MCP SDK, so headers should work, but its docs do not show the key.

Install the package:

```sh
pip install "smolagents[mcp]"
```

[Client documentation](https://huggingface.co/docs/smolagents/en/tutorials/tools)

## 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/smolagents
