mtg-mcp

mtg-mcp

Provides Magic: The Gathering card, deck, provider, and statistical evidence tools for LLMs to make informed deckbuilding decisions.

Category
访问服务器

README

mtg-mcp

<!-- mcp-name: io.github.nccurry/mtg-mcp -->

mtg-mcp gives an LLM grounded Magic: The Gathering card, deck, provider, and statistical evidence. The LLM makes deckbuilding decisions.

The clean-break 0.9.0 server uses stdio. It exposes 93 tools, one capability resource, and no prompts. It does not migrate 0.8.x data or tool schemas.

Status

The evidence-first rewrite is complete. 0.9.0 is the first stable release of the new surface.

Capability Tools Default Writes
Local decks and interchange 28 Yes Local
Scryfall evidence 18 Yes Local cache and corpus
Exact statistics 8 Yes No
Archidekt 23 No Remote
Playgroup 16 No Remote

The packaged acceptance run passed 88 tools live. Two Scryfall corpus operations are fixture-backed, Scryfall rollback awaits a second provider generation, and two Playgroup writes remain fixture-only because the public API has no cleanup. See live acceptance.

Start the server

Bootstrap the repository, then run the MCP smoke test:

.\bootstrap.ps1
task smoke:mcp

On Linux or macOS:

./bootstrap.sh
task smoke:mcp

Use mtg-mcp as the MCP command. The default invocation is equivalent to:

mtg-mcp --mode=local --toolsets=default

Use --smoke for a one-shot configuration check. It does not start an MCP session.

Choose a mode

Modes control authority.

Mode Reads Local writes Remote writes
read-only Yes No No
local Yes Yes No
remote Yes Yes Yes

local is the default. Scryfall cache misses can require a local write for pacing and evidence persistence. In read-only, those misses return local-write-required before HTTP.

Choose toolsets

Toolsets control relevance. They do not grant authority.

Value Result
default or omitted Enable decks, scryfall, and stats
all Enable every implemented toolset
none Expose no tools
Comma-separated list Enable the exact named toolsets

Available toolsets are decks, scryfall, stats, archidekt, and playgroup. Selection is fixed for the MCP session.

Profile read-only local remote
default 32 54 54
all 57 80 93
none 0 0 0

Read mtg://server/capabilities to inspect the active mode, toolsets, counts, credential state, package version, and data-store state. Reading the resource does not contact a provider.

Configure the server

Pass configuration on the command line, in environment variables, or in an optional mtg-mcp.json in the working directory. Command-line values win over environment values. Environment values win over JSON.

Setting Command line Environment JSON key
Operation mode --mode MTGMCP__MODE MODE
Toolsets --toolsets MTGMCP__TOOLSETS TOOLSETS
Data root --data-dir MTGMCP__DATA_DIR DATA_DIR
Scryfall TTL --scryfall-ttl-hours MTGMCP__SCRYFALL_TTL_HOURS SCRYFALL_TTL_HOURS

The default data root is the platform application-data directory under mtg-mcp/v0.9. All MCP processes that use the same root reuse decks.db and scryfall.db. Reads do not create the root.

Configure Archidekt

Use MTGMCP__ARCHIDEKT__USERNAME and MTGMCP__ARCHIDEKT__PASSWORD, or create:

~/.mtg-mcp/archidekt.json

The provider origin is fixed. Authentication output never contains credentials, account identity, or a credential path.

Configure Playgroup

Use MTGMCP__PLAYGROUP__API_KEY, or create:

~/.mtg-mcp/playgroup.json

The file contains one apiKey property. The provider origin is fixed to the official public API.

Work with local decks

The decks toolset supports:

  • revisioned deck, entry, zone, category, and provider-binding changes;
  • atomic ordered batches;
  • guarded backup, restore, and delete;
  • native JSON and generic text import and export;
  • Archidekt and Moxfield manual artifacts;
  • exact Scryfall identity reconciliation; and
  • deterministic tag-rule categorization.

Every existing-deck mutation requires expectedRevision. The store is format-neutral. Validation checks structure, not Commander legality, card quality, or strategic fit.

Use deck_identity_reconcile_preview before apply. Resolution uses printing ID, set and collector number, Oracle ID, then exact name. It never uses fuzzy matching or selects an arbitrary printing.

Use deck_category_rules_validate, deck_category_rules_preview, and deck_category_rules_apply to evaluate caller-owned tag rules. Rules can be inline or use the transparent common-v1 preset. The MCP does not decide what a category means.

Import and export decks

Use deck_interchange_formats to inspect preservation limits.

Format Notes
mtg-mcp-json-v1 Lossless native format
generic-text-v1 Quantity, name, zone headings, and printing hints
archidekt-text-v1 Manual import plus native/category companions
moxfield-bulk-edit-v1 Bulk Edit text plus native/tag companions

Provider artifacts do not perform network automation. Excluded entries remain in the native companion and are omitted from provider text.

Query Scryfall

The scryfall toolset supports search, exact card lookup, collection lookup, prints, rulings, sets, catalogs, autocomplete, bulk metadata, tag evidence, immutable snapshots, and explicit corpus lifecycle operations.

The local corpus contains All Cards, Rulings, Oracle Tags, and Art Tags. Corpus sync is explicit. It never runs at startup or in the background.

Freshness policies are default, cache-only, and refresh. The default TTL is 24 hours. Immutable snapshots do not expire.

scryfall_card_collection accepts 150 ordered lookup rows. It uses local corpus hits first, deduplicates provider misses, and sends provider batches of at most 75. Results use stable cursor pagination.

Arbitrary Scryfall queries remain provider-authoritative. The cache reuses only the exact same request. Card facts and community tags remain separate evidence classes.

Calculate exact statistics

The stats toolset provides eight read-only tools for:

  • univariate and multivariate hypergeometric probability;
  • probability-by-turn tables;
  • caller-defined mana-source availability;
  • package and combo assembly;
  • explicit mulligan schedules;
  • minimum-copy and minimum-source solving; and
  • deterministic deck composition summaries.

Every probability returns an exact reduced fraction and a stable decimal. The caller supplies the population, groups, turn draws, mana capabilities, and keep rules. The MCP does not infer legality, roles, or whether a result is good.

Deck-backed statistics can select entries by entry ID, zone name, or category ID. This lets an LLM use existing Archidekt groups or deterministic categories without hiding the selected cards.

Synchronize Archidekt

Enable the archidekt toolset. Use remote mode for remote writes.

The adapter supports owned deck list/get/create/delete, pull, push, diff, folders, and named snapshots. Apply operations require current revisions, fingerprints, and preview evidence. The MCP never chooses a conflict winner.

Requests start at least two seconds apart per configured account. The adapter allows at most 30 starts in 60 seconds and 150 requests per tool invocation. It stops on 403 and 429. Ambiguous mutations are not retried.

Archidekt may renumber category positions. Content equality therefore compares category identity, membership, flags, and primary assignment, not the provider-controlled numeric rank.

Read Playgroup evidence

Enable the playgroup toolset. It exposes the pinned Public API 1.0.0 surface. All modes include 14 safe read tools. remote adds two write tools.

Results preserve provider JSON and include operation, API version, retrieval time, checksums, and limitations. The adapter does not rank decks or infer quality.

Request starts are at least 250 milliseconds apart. Reads have bounded retry. Writes are single-attempt. Live acceptance does not invoke writes because the public API provides no cleanup operation.

Evidence and safety

The server keeps these output classes distinct:

  • provider facts;
  • provider evidence;
  • exact derivations;
  • parser classifications;
  • heuristics; and
  • sampled estimates.

Stable 0.9.0 contains no advisor prompts, intent inference, weak-card judgments, replacement recommendations, blended quality scores, or strategic simulation. Deferred work is listed in Potential Features.

Develop and verify

Use Task as the command menu:

task --list
task lint
task test
task surface:report
task coverage
task pack
task smoke:process
task smoke:mcp
task release:tool-smoke

Normal tests are deterministic and offline. Live tests require explicit opt-in. Each production assembly must maintain at least 90 percent line coverage.

Architecture

Project Ownership
MtgMcp.Core Provider-neutral contracts and evidence
MtgMcp.Decks Local SQLite decks and interchange
MtgMcp.Scryfall Official transport, corpus, snapshots, and pacing
MtgMcp.Archidekt Observed provider contract and synchronization
MtgMcp.Playgroup Pinned official API evidence
MtgMcp.Statistics BCL-only exact calculations
MtgMcp.App MCP host, configuration, composition, and schemas

Read North Star, Design Goals, and the rewrite guide for durable constraints.

License

Licensed under the GNU Affero General Public License v3.0 or later.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选