# League of Legends MCP Server (`jordan-byte/league-of-legends-mcp-server`) Actor

Connect AI assistants to League of Legends data via MCP. 26 tools cover player profiles, ranked stats, match history, champion mastery, live game, league standings, clash, challenges and AI coaching. No Riot API key needed, and it works with Claude Desktop, ChatGPT and any MCP client.

- **URL**: https://apify.com/jordan-byte/league-of-legends-mcp-server.md
- **Developed by:** [Jordan Byte](https://apify.com/jordan-byte) (community)
- **Categories:** AI, Agents, Automation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## League of Legends MCP Server

Connect AI assistants to League of Legends data via MCP. 26 tools cover player profiles, ranked stats,
match history, champion mastery, live game, league standings, clash, challenges and AI coaching. No
Riot API key needed by end users — you (the operator) supply one — and it works with Claude Desktop,
ChatGPT and any MCP client.

### Architecture

- **Transport**: MCP over Streamable HTTP (`POST /mcp`, stateless — a fresh `McpServer` per request).
- **Runtime**: Apify Actor in [Standby mode](https://docs.apify.com/platform/actors/development/programming-interface/standby)
  — a persistent Express server, not a run-to-completion Actor.
- **Billing**: Apify pay-per-event (`.actor/pay_per_event.json`) — `data-retrieval` ($0.002),
  `match-data` ($0.004), `ai-analysis` ($0.016). Charged only after a tool call succeeds. Prices are
  set for a ~55% profit margin (Apify takes a 20% platform commission on top of the price, so
  `profit = 0.8 × price − cost`, and `price = cost ÷ 0.25` for a 55% margin target). Cost assumptions:
  \~$0.0005 compute per lightweight call, ~$0.001 per match-data call, ~$0.004 per ai-analysis call
  (OpenRouter/Haiku 4.5 tokens + compute). Re-tune if you switch LLM models or your real Apify compute
  usage differs once measured in production.
- **Data sources**: Riot Games REST API (regional + platform routing) and Data Dragon (champion/item/
  rune/summoner-spell name resolution, cached in memory).
- **AI analysis**: the four `lol_analyze_*` / `lol_compare_players` / `lol_get_improvement_tips` tools
  call [OpenRouter](https://openrouter.ai) (OpenAI-compatible), defaulting to a cheap Claude model —
  override with `OPENROUTER_MODEL`.

### Required environment variables (Apify secret input / env vars)

| Variable | Purpose |
| --- | --- |
| `RIOT_API_KEY` | Riot Games API key. Get a free personal key (24h expiry) or apply for a production key (no expiry) at the [Riot Developer Portal](https://developer.riotgames.com/). |
| `OPENROUTER_API_KEY` | Powers the AI-coaching tools. Get one at [openrouter.ai/keys](https://openrouter.ai/keys). |
| `OPENROUTER_MODEL` | Optional. Defaults to `anthropic/claude-haiku-4.5`. |

Never commit real values for these — set them as Apify Actor secrets (Console → Actor → Settings →
Environment variables) or a local `.env` (see `.env.example`).

### Local development

```bash
npm install
npm run build
RIOT_API_KEY=... OPENROUTER_API_KEY=... ACTOR_STANDBY_PORT=4321 node dist/main.js
```

Then point an MCP client at `http://localhost:4321/mcp` with `Authorization: Bearer <apify-token>`
(or `?token=`) — the server validates the token against the Apify API before allowing any tool call.

### Tools (26)

**Account & Profile** (`data-retrieval` / `match-data`): `lol_get_account`, `lol_get_summoner`,
`lol_get_ranked`, `lol_get_player_profile`.

**Match Data** (`match-data`): `lol_get_match_history`, `lol_get_match_details`,
`lol_get_match_timeline`, `lol_get_live_game`.

**Champion Mastery** (`data-retrieval`): `lol_get_champion_mastery`, `lol_get_mastery_by_champion`.

**Leagues & Ranked Ladders** (`data-retrieval`): `lol_get_league_top`, `lol_get_league_entries`,
`lol_get_league_by_id`, `lol_get_league_entries_exp`.

**Clash** (`data-retrieval`): `lol_get_clash_player`, `lol_get_clash_team`, `lol_get_clash_tournaments`.

**Challenges** (`data-retrieval`): `lol_get_challenges`, `lol_get_player_challenges`.

**Utility** (`data-retrieval`): `lol_get_champion_rotation`, `lol_get_featured_games`,
`lol_get_server_status`.

**AI Analysis** (`ai-analysis`): `lol_analyze_performance`, `lol_analyze_champion`,
`lol_get_improvement_tips`, `lol_compare_players`.

### Known limitations of this build

- Rank benchmarks used by the AI-coaching tools (`src/ai/benchmarks.ts`) are heuristic midpoints, not
  official Riot statistics — good for directional coaching, not precise percentile claims.
- Auth performs a live call to `api.apify.com/v2/users/me` to validate the token (cached 5 min); Apify's
  Standby routing layer is expected to be the authoritative gate in production.
- No automated test suite yet — verified via a real MCP handshake (`Client` + `InMemoryTransport`)
  confirming all 26 tools register with valid schemas and the error-handling path works end to end.

# Actor input Schema

## `defaultRegion` (type: `string`):

Select your primary game server.

## `defaultLanguage` (type: `string`):

Language for AI-generated analysis and recommendations.

## `cacheEnabled` (type: `boolean`):

Cache reduces API calls and improves response times. Recommended: enabled.

## Actor input object example

```json
{
  "defaultRegion": "euw1",
  "defaultLanguage": "en",
  "cacheEnabled": true
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("jordan-byte/league-of-legends-mcp-server").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("jordan-byte/league-of-legends-mcp-server").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call jordan-byte/league-of-legends-mcp-server --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jordan-byte/league-of-legends-mcp-server"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/EDYwMUa5dAChOzDKG/builds/J4eTpFmAxLu53854s/openapi.json
