> For the complete documentation index, see [llms.txt](https://docs.wheelx.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wheelx.fi/sdk-and-widget/mcp-server.md).

# MCP Server

The WheelX **MCP (Model Context Protocol) Server** allows AI assistants and LLM-powered applications to interact with the WheelX DeFi platform — getting quotes, tracking orders, estimating gas, and comparing swap routes — all through a standardized protocol.

Built with [FastMCP](https://github.com/jlowin/fastmcp), it exposes 6 tools and 3 resources for AI agents.

### What You Can Do

#### Tools

| Tool                     | Description                                       |
| ------------------------ | ------------------------------------------------- |
| `get_quote`              | Get swap/bridge quotes with transaction payload   |
| `get_order_status`       | Check the status of submitted orders              |
| `get_supported_chains`   | List all supported blockchain networks            |
| `calculate_token_amount` | Convert human-readable amounts to raw token units |
| `estimate_gas_cost`      | Estimate gas costs for transactions               |
| `compare_quotes`         | Compare quotes with different slippage settings   |

#### Resources

| Resource URI                        | Description                                  |
| ----------------------------------- | -------------------------------------------- |
| `wheelx://chains/{chain_id}/tokens` | Get popular tokens for a specific chain      |
| `wheelx://status`                   | Check WheelX service status and availability |
| `wheelx://docs/usage`               | Usage documentation                          |

### Supported Chains

Ethereum (1), Optimism (10), BNB Smart Chain (56), Polygon (137), Arbitrum One (42161), Base (8453), Avalanche C-Chain (43114)

### Install & Run

```
# Clone the SDK repo
git clone https://github.com/wheelx-fi/wheelx-sdk
cd wheelx-sdk/python

# Install dependencies
pip install fastmcp requests

# Run the server
python mcp_server.py
```

### Configuration

Set via environment variables:

| Variable          | Default                 | Description                          |
| ----------------- | ----------------------- | ------------------------------------ |
| `WHEELX_BASE_URL` | `https://api.wheelx.fi` | API base URL (planned)               |
| `WHEELX_TIMEOUT`  | `30`                    | Request timeout in seconds (planned) |

> Environment variable support is planned for a future release. Currently the server uses built-in defaults: `https://api.wheelx.fi` with a 30-second timeout.

### Usage Example

```
# An AI agent calls the get_quote tool:
quote = await get_quote(
from_chain=1,
to_chain=1,
from_token="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
to_token="0xdAC17F958D2ee523a2206206994597C13D831ec7",
from_address="0x742d35Cc6634C0532925a3b8Dc9F6A7c5D3a7C6a",
to_address="0x742d35Cc6634C0532925a3b8Dc9F6A7c5D3a7C6a",
amount=1000000,
slippage=50
)
# Returns: request_id, amount_out, min_receive, transaction payload, etc.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wheelx.fi/sdk-and-widget/mcp-server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
