# EDHREC Magic the Gathering Commander Scraper (`parseforge/edhrec-mtg-commander-scraper`) Actor

Scrape Magic the Gathering Commander deck statistics from EDHREC public JSON endpoints. Get top commanders, average decks, salt scores, inclusion rates per card. No API key required.

- **URL**: https://apify.com/parseforge/edhrec-mtg-commander-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $31.65 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

![ParseForge Banner](https://raw.githubusercontent.com/ParseForge/apify-assets/main/parseforge-banner.png)

## 🐉 EDHREC Magic: The Gathering Commander Scraper

> 🚀 **Pull Commander deck statistics from EDHREC in seconds.** Top commanders ranking, per-deck card categories, inclusion rates, synergy scores, salt, and live price feeds. No API key, no scraping HTML.

> 🕒 **Last updated:** 2026-05-12 · **📊 Up to 23 fields** per record · **🐉 10,000+ commanders** ranked · **🃏 Per-deck card breakdowns** · **💰 TCGplayer + Cardmarket prices**

The **EDHREC MTG Commander Scraper** turns EDHREC's public JSON endpoints into clean datasets across two modes. `topCommanders` returns the ranked list of most-played commanders for a chosen timeframe (week, month, year, 2 years, or all-time) with deck counts and inclusion rates. `commanderDetail` returns the average deck composition for any specific commander, broken down by card category (creatures, lands, removal, ramp, draw, etc.), each with inclusion percentages, synergy scores, and potential-deck counts.

With `fetchDetails` enabled, top-commander records gain color identity, converted mana cost, primary type, rarity, salt score, layout, legal status, Scryfall image URLs, and live prices from TCGplayer, Card Kingdom, and Cardmarket. EDHREC aggregates statistics from hundreds of thousands of public decks, making this the largest community deck statistics source for the Commander format.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| EDH/Commander players, MTG content creators, deck-building tools, LGS event organizers, card-price arbitrage analysts, brewing communities, Magic data scientists | Meta tracking, deck-building AI, price-trend analysis, salt-score audits, content research, format health monitoring, brewing tool data feeds |

---

### 📋 What the EDHREC MTG Commander Scraper does

Two scraping modes plus optional detail enrichment:

- 🏆 **Top commanders ranking.** Pull the ranked list of most-played commanders for the chosen timeframe.
- ⏳ **6 timeframe slices.** Past week, past month, past year, past 2 years, alternative 2-year slug, or all-time.
- 🃏 **Per-commander deck composition.** Drill into one commander to see average card picks by category with inclusion and synergy.
- 💰 **Optional price + image enrichment.** Toggle `fetchDetails` to add color identity, salt, rarity, mana cost, layout, and live prices from three vendors.

Top-commander records include rank, name, slug, EDHREC URL, Scryfall card ID, deck count, inclusion count, and timeframe. With `fetchDetails`, you also get color identity, CMC, primary type, rarity, salt score, layout, legal-commander flag, normal and art-crop image URLs, Scryfall URI, and USD prices from TCGplayer, Card Kingdom, and Cardmarket. Per-commander detail records include card category, card name, slug, ID, inclusion rate, deck count, synergy score, and potential decks.

> 💡 **Why it matters:** EDHREC is the single largest source of Commander meta statistics. Manual data extraction means parsing fragile HTML on rotating pages. This Actor hits the canonical JSON endpoints directly and returns structured ranking, composition, salt, and pricing data ready for analytics, deck-builders, or content research.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded Commander stats dataset._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td><code>mode</code></td><td>string</td><td><code>"topCommanders"</code></td><td>Either <code>topCommanders</code> for the ranking, or <code>commanderDetail</code> for a single commander's card breakdown.</td></tr>
<tr><td><code>timeframe</code></td><td>string</td><td><code>"year"</code></td><td>For <code>topCommanders</code> only. One of <code>week</code>, <code>month</code>, <code>year</code>, <code>2years</code>, <code>past2years</code>, <code>alltime</code>.</td></tr>
<tr><td><code>commanderSlug</code></td><td>string</td><td><code>"the-ur-dragon"</code></td><td>For <code>commanderDetail</code> only. EDHREC URL slug (e.g. <code>atraxa-praetors-voice</code>).</td></tr>
<tr><td><code>fetchDetails</code></td><td>boolean</td><td><code>false</code></td><td>For <code>topCommanders</code> only. Adds color identity, mana cost, rarity, salt, prices, and image URLs. One extra API call per commander.</td></tr>
<tr><td><code>maxItems</code></td><td>integer</td><td><code>10</code></td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
</tbody>
</table>

**Example: top 100 commanders of the past year with prices.**

```json
{
    "mode": "topCommanders",
    "timeframe": "year",
    "fetchDetails": true,
    "maxItems": 100
}
````

**Example: full Atraxa deck composition by category.**

```json
{
    "mode": "commanderDetail",
    "commanderSlug": "atraxa-praetors-voice",
    "maxItems": 1000
}
```

> ⚠️ **Good to Know:** EDHREC aggregates from public decklists only, so ultra-fringe brews may not appear. Slugs are case-sensitive lowercase with hyphens. Find them in the EDHREC URL after `/commanders/`.

***

### 📊 Output

Each record contains up to **23 fields** depending on mode. Download the dataset as CSV, Excel, JSON, or XML.

#### 🧾 Schema

**topCommanders mode:**

| Field | Type | Example |
|---|---|---|
| 🏷️ `mode` | string | `"topCommanders"` |
| 🏆 `rank` | number | `1` |
| 📌 `name` | string | `"The Ur-Dragon"` |
| 🔗 `slug` | string | `"the-ur-dragon"` |
| 🔗 `url` | string | `"https://edhrec.com/commanders/the-ur-dragon"` |
| 🆔 `id` | string | `"10d42b35-844f-4a64-9981-c6118d45e826"` |
| 🃏 `numDecks` | number | `46794` |
| 📊 `inclusion` | number | `46794` |
| ⏳ `timeframe` | string | `"year"` |
| 🎨 `colorIdentity` | string\[] | undefined | `["W","U","B","R","G"]` |
| 🔢 `cmc` | number | undefined | `7` |
| 🃏 `primaryType` | string | undefined | `"Creature"` |
| 💎 `rarity` | string | undefined | `"mythic"` |
| 🧂 `salt` | number | undefined | `1.83` |
| 📐 `layout` | string | undefined | `"normal"` |
| ✅ `legalCommander` | boolean | undefined | `true` |
| 🖼️ `imageUrl` | string | undefined | `"https://cards.scryfall.io/normal/..."` |
| 🖼️ `artCropUrl` | string | undefined | `"https://cards.scryfall.io/art_crop/..."` |
| 🔗 `scryfallUri` | string | undefined | `"https://scryfall.com/card/..."` |
| 💰 `priceUsdTcgplayer` | number | undefined | `12.49` |
| 💰 `priceUsdCardkingdom` | number | undefined | `14.99` |
| 💰 `priceUsdCardmarket` | number | undefined | `9.85` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-12T16:30:11.540Z"` |

**commanderDetail mode:**

| Field | Type | Example |
|---|---|---|
| 🏷️ `mode` | string | `"commanderDetail"` |
| 🔗 `commanderSlug` | string | `"atraxa-praetors-voice"` |
| 📌 `commanderName` | string | `"Atraxa, Praetors' Voice"` |
| 🏷️ `category` | string | `"creatures"` |
| 🃏 `cardName` | string | `"Doubling Season"` |
| 🔗 `cardSlug` | string | `"doubling-season"` |
| 🆔 `cardId` | string | `"e30a1733-95e1-4e75-..."` |
| 🔗 `cardUrl` | string | `"https://edhrec.com/cards/doubling-season"` |
| 📊 `inclusion` | number | null | `89` |
| 🃏 `numDecks` | number | null | `5832` |
| 🤝 `synergyScore` | number | null | `0.21` |
| 🃏 `potentialDecks` | number | null | `6500` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-12T16:30:11.540Z"` |

#### 📦 Sample records

<details>
<summary><strong>🏆 The Ur-Dragon (#1 over past year, 46,794 decks)</strong></summary>

```json
{
    "mode": "topCommanders",
    "rank": 1,
    "name": "The Ur-Dragon",
    "slug": "the-ur-dragon",
    "url": "https://edhrec.com/commanders/the-ur-dragon",
    "id": "10d42b35-844f-4a64-9981-c6118d45e826",
    "numDecks": 46794,
    "inclusion": 46794,
    "timeframe": "year",
    "scrapedAt": "2026-05-12T16:30:11.540Z"
}
```

</details>

<details>
<summary><strong>🩸 Edgar Markov (#2, vampire tribal staple)</strong></summary>

```json
{
    "mode": "topCommanders",
    "rank": 2,
    "name": "Edgar Markov",
    "slug": "edgar-markov",
    "url": "https://edhrec.com/commanders/edgar-markov",
    "id": "a577ba08-0aa8-45be-aa83-d5078770127c",
    "numDecks": 45855,
    "inclusion": 45855,
    "timeframe": "year",
    "scrapedAt": "2026-05-12T16:30:11.540Z"
}
```

</details>

<details>
<summary><strong>🦋 Atraxa, Praetors' Voice (#3, classic 4-color superfriends shell)</strong></summary>

```json
{
    "mode": "topCommanders",
    "rank": 3,
    "name": "Atraxa, Praetors' Voice",
    "slug": "atraxa-praetors-voice",
    "url": "https://edhrec.com/commanders/atraxa-praetors-voice",
    "id": "d0d33d52-3d28-4635-b985-51e126289259",
    "numDecks": 41085,
    "inclusion": 41085,
    "timeframe": "year",
    "scrapedAt": "2026-05-12T16:30:11.540Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🏆 | **Live meta ranking.** Top commanders ordered by deck count across 6 timeframe slices. |
| 🃏 | **Per-deck composition.** Drill into one commander for category-by-category card picks with inclusion and synergy. |
| 🧂 | **Salt score.** EDHREC's community salt rating tells you which commanders provoke groans at the table. |
| 💰 | **Three-vendor pricing.** TCGplayer, Card Kingdom, and Cardmarket USD prices in one row. |
| 🎨 | **Color identity ready.** Brewing tools can immediately filter by WUBRG combos. |
| 🖼️ | **Scryfall art URLs.** Normal and art-crop images for thumbnails and card galleries. |
| 🔓 | **No login or API key.** Hits public JSON endpoints only. |

> 📊 EDHREC aggregates from hundreds of thousands of public Commander decklists for the most comprehensive format snapshot.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| **⭐ EDHREC MTG Commander Scraper** *(this Actor)* | $5 free credit, then pay-per-use | **10,000+ commanders** | **Live per run** | timeframe, slug, fetchDetails | ⚡ 2 min |
| Manual HTML scraping of EDHREC pages | Free | Subset | Manual | None | 🐢 Days |
| Paid card-price APIs | $25+/month | Prices only | Daily | Price-related | ⏳ Hours |
| Community spreadsheet snapshots | Free | One-off | Rarely | None | 🕒 Variable |

Pick this Actor when you need the full EDHREC stats dataset with prices and Scryfall images in clean JSON.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the EDHREC MTG Commander Scraper page on the Apify Store.
3. 🎯 **Set input.** Pick a mode, choose a timeframe or commander slug, optionally toggle `fetchDetails`, and set `maxItems`.
4. 🚀 **Run it.** Click **Start** and let the Actor pull the rankings or deck composition.
5. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 🃏 Deck-Building Tools

- Auto-recommend cards by inclusion rate
- Color-identity filtering with WUBRG flags
- Synergy-score weighting for AI brewers
- Average-deck templates as starter lists

</td>
<td width="50%" valign="top">

#### 📊 Format Analytics

- Meta share tracking across timeframes
- Salt-score audits for casual leagues
- Diversity metrics for format health reports
- Rotation impact studies after new sets

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 💰 Card Pricing & Arbitrage

- Cross-vendor price comparisons in one query
- Trend monitoring for staples
- Inclusion-driven price prediction models
- Investment-card watchlists

</td>
<td width="50%" valign="top">

#### 🎥 Content & Coverage

- Top-commander rankings for tier lists
- Deck-tech research with category breakdowns
- Tournament prep dossiers
- LGS event commentary support

</td>
</tr>
</table>

***

### 🌟 Beyond business use cases

Data like this powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Empirical datasets for papers, thesis work, and coursework
- Longitudinal studies tracking changes across snapshots
- Reproducible research with cited, versioned data pulls
- Classroom exercises on data analysis and ethical scraping

</td>
<td width="50%">

#### 🎨 Personal and creative

- Side projects, portfolio demos, and indie app launches
- Data visualizations, dashboards, and infographics
- Content research for bloggers, YouTubers, and podcasters
- Hobbyist collections and personal trackers

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Transparency reporting and accountability projects
- Advocacy campaigns backed by public-interest data
- Community-run databases for local issues
- Investigative journalism on public records

</td>
<td width="50%">

#### 🧪 Experimentation

- Prototype AI and machine-learning pipelines with real data
- Validate product-market hypotheses before engineering spend
- Train small domain-specific models on niche corpora
- Test dashboard concepts with live input

</td>
</tr>
</table>

***

### 🔌 Automating EDHREC MTG Commander Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. Weekly or monthly refreshes keep meta dashboards and deck-building tools in sync automatically.

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

Pick a mode and either a timeframe (for top commanders) or a commander slug (for deck composition), click Start, and the Actor hits EDHREC's public JSON endpoints, paginates through the data, and emits clean structured records.

#### 🧂 What is the salt score?

Salt is EDHREC's community-driven rating of how annoying or unfun a card is. It is gathered from player upvotes and downvotes and ranges roughly from 0 (rarely complained about) to 4+ (table-flip territory). Useful for setting expectations in casual playgroups.

#### 🔁 How often is the data refreshed?

EDHREC updates its rankings and composition stats daily. Every run of this Actor pulls the latest values. Schedule the Actor weekly or daily for a fresh mirror.

#### 🎨 What is `colorIdentity`?

An array of WUBRG letters describing the commander's color identity. For example, Atraxa's identity is `["W","U","B","G"]`. Use this to filter commanders that match a chosen color pie.

#### 🏆 What timeframes are available?

`week`, `month`, `year`, `2years`, `past2years` (alternative slug), and `alltime`. Pick a recent slice for current meta or `alltime` for the historical leaderboard.

#### ⏰ Can I schedule regular runs?

Yes. Use Apify Schedules to run this Actor on any cron interval (hourly, daily, weekly) and keep a downstream database in sync.

#### ⚖️ Is this data legal to use?

EDHREC publishes its statistics publicly. Card names, prices, and inclusion percentages are factual aggregations and are commonly used by deck-building tools and content creators. Card images on EDHREC come from Scryfall and Wizards of the Coast and remain under their licensing terms.

#### 💼 Can I use this data commercially?

Statistical aggregates are commercial-fair-use in most jurisdictions. Card art and proprietary scoring algorithms may be subject to additional terms. Consult counsel for your specific use case.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit and gives you access to scheduling, higher concurrency, and larger datasets.

#### 🔁 What happens if a run fails or gets interrupted?

Apify automatically retries transient errors. If a run still fails, you can inspect the log in the Runs tab, fix the input, and re-run. Partial datasets from failed runs are preserved so you never lose progress.

#### 🆘 What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.

***

### 🔌 Integrate with any app

EDHREC MTG Commander Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Get run notifications in your channels
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe MTG data into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh meta data into your deck-building app, or alert your team in Slack.

***

### 🔗 Recommended Actors

- [**🃏 Scryfall MTG Card Scraper**](https://apify.com/parseforge/scryfall-mtg-card-scraper) - Magic: The Gathering card data, prints, and prices
- [**🃏 MTGGoldfish Scraper**](https://apify.com/parseforge/mtggoldfish-scraper) - Magic deck prices, tournament results, and meta
- [**🎮 BoardGameGeek Scraper**](https://apify.com/parseforge/boardgamegeek-scraper) - Board game ratings, rankings, and reviews
- [**🎲 Lichess Chess Users Scraper**](https://apify.com/parseforge/lichess-chess-users-scraper) - Chess player profiles and rating statistics
- [**🎯 Manifold Prediction Markets Scraper**](https://apify.com/parseforge/manifold-prediction-markets-scraper) - Public prediction market questions and probabilities

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more games and hobby-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by EDHREC, Wizards of the Coast, or any card publisher. Magic: The Gathering is a trademark of Wizards of the Coast LLC. Only publicly available statistical aggregates are collected.

# Actor input Schema

## `mode` (type: `string`):

What to scrape

## `timeframe` (type: `string`):

Timeframe slice for the top commanders list

## `commanderSlug` (type: `string`):

EDHREC URL slug for the commander (e.g. 'the-ur-dragon', 'atraxa-praetors-voice'). Find slugs on edhrec.com/commanders

## `fetchDetails` (type: `boolean`):

If enabled, fetches each commander's color identity, mana cost, rarity, salt, prices, and image (1 extra API call per commander).

## `maxItems` (type: `integer`):

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## Actor input object example

```json
{
  "mode": "topCommanders",
  "timeframe": "year",
  "commanderSlug": "the-ur-dragon",
  "fetchDetails": false,
  "maxItems": 10
}
```

# Actor output Schema

## `overview` (type: `string`):

Overview of scraped data

## `fullData` (type: `string`):

Complete dataset

# 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 = {
    "mode": "topCommanders",
    "timeframe": "year",
    "commanderSlug": "the-ur-dragon",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/edhrec-mtg-commander-scraper").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 = {
    "mode": "topCommanders",
    "timeframe": "year",
    "commanderSlug": "the-ur-dragon",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/edhrec-mtg-commander-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "mode": "topCommanders",
  "timeframe": "year",
  "commanderSlug": "the-ur-dragon",
  "maxItems": 10
}' |
apify call parseforge/edhrec-mtg-commander-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/edhrec-mtg-commander-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "EDHREC Magic the Gathering Commander Scraper",
        "description": "Scrape Magic the Gathering Commander deck statistics from EDHREC public JSON endpoints. Get top commanders, average decks, salt scores, inclusion rates per card. No API key required.",
        "version": "0.0",
        "x-build-id": "T0ociXR2J2Yx6Yw1z"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~edhrec-mtg-commander-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-edhrec-mtg-commander-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~edhrec-mtg-commander-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-edhrec-mtg-commander-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~edhrec-mtg-commander-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-edhrec-mtg-commander-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "topCommanders",
                            "commanderDetail"
                        ],
                        "type": "string",
                        "description": "What to scrape",
                        "default": "topCommanders"
                    },
                    "timeframe": {
                        "title": "Top commanders timeframe (for topCommanders mode)",
                        "enum": [
                            "year",
                            "month",
                            "week",
                            "2years",
                            "past2years",
                            "alltime"
                        ],
                        "type": "string",
                        "description": "Timeframe slice for the top commanders list",
                        "default": "year"
                    },
                    "commanderSlug": {
                        "title": "Commander slug (for commanderDetail mode)",
                        "type": "string",
                        "description": "EDHREC URL slug for the commander (e.g. 'the-ur-dragon', 'atraxa-praetors-voice'). Find slugs on edhrec.com/commanders"
                    },
                    "fetchDetails": {
                        "title": "Fetch card detail (topCommanders mode)",
                        "type": "boolean",
                        "description": "If enabled, fetches each commander's color identity, mana cost, rarity, salt, prices, and image (1 extra API call per commander).",
                        "default": false
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
