R2-D2

R2-D2

An MCP server for Star Wars Unlimited that provides card search, deck building, format validation, meta analysis, and two-player game simulation through Claude or any MCP-compatible client.

Category
访问服务器

README

R2-D2

A Star Wars Unlimited MCP server built with FastMCP. Search cards, build decks, validate formats, analyze the meta, and simulate two-player games — all through Claude Code, Claude Desktop, or any MCP-compatible client.

Card data comes from the live SWU DB API first and automatically falls back to the bundled local catalog when the API is unavailable.

Capabilities

Card Database

Tool What it does
swu_search_cards Natural text search with typed structured filters (aspect/type/arena/rarity/set as enums; cost/power/hp as {op, value} comparators). Returns a typed SearchResult.
swu_lookup_card Exact lookup by name or set/number. Returns a typed CardDetail.
swu_random_card Random card from a filtered pool. Returns a typed CardSummary.
swu_get_image Front or back art URL for any card.

Typed search filters (v0.3.0)

swu_search_cards, swu_lookup_card, and swu_random_card now return Pydantic models instead of opaque dicts. FastMCP serializes them as both content (human-readable text) and structuredContent (typed JSON) — agents can read .cards[0].cost directly without parsing string keys.

Filters are typed too. Aspect/type/arena/rarity/set are Literal[...] enums, so the agent sees the valid options in the tool schema and typos like aspect="Cunninng" are rejected before the API call. Numeric stats use a structured {op, value} instead of magic strings:

swu_search_cards(
    query="Vader",
    filters={"aspect": "Villainy", "type": "Leader",
             "cost": {"op": ">=", "value": 5}},
)

Deck and game tools still return dict — that refactor is staged for a follow-up.

Deck Building

Tool What it does
swu_upload_deck Parse a decklist into a stateful session
swu_validate_deck Check legality for Premier or Twin Suns (leaders, base, copy limits, aspect penalties)
swu_analyze_deck Resource curve, aspect breakdown, synergy score, role analysis
swu_suggest_cards Targeted card suggestions for a stated goal or matchup
swu_generate_deck First-pass brew from a theme, leaders, and format
swu_export_deck Export a session to a shareable decklist

Game Simulation

Tool What it does
swu_start_game Two-player setup with deck loading
swu_get_game_state Current board state, hand, resources, damage
swu_get_legal_actions Available actions with targeting options
swu_take_game_action Execute an action (play, attack, pass, etc.)
swu_take_ai_turn Let the AI pilot take a full turn
swu_draw_card / swu_view_hand / swu_view_board Card management
swu_play_card / swu_move_card / swu_defeat_card / swu_set_card_state Direct board manipulation
swu_mulligan / swu_resource_phase / swu_sideboard Phase management

Quick Start

uv sync
uv run python scripts/start_stdio.py

Claude Code / Claude Desktop Config

Add to ~/.mcp.json:

{
  "mcpServers": {
    "r2-d2": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/r2-d2",
        "run",
        "python",
        "scripts/start_stdio.py"
      ]
    }
  }
}

Offline Catalog

A bundled card catalog (data/catalog/cards.json) is auto-discovered at startup. The server uses it as a fallback whenever the live API is unavailable — no configuration needed.

To rebuild the catalog from the latest API data:

uv run python scripts/build_catalog.py

Environment Variables

All optional — sensible defaults are built in.

Variable Default Purpose
SWU_MCP_API_BASE_URL https://api.swu-db.com Live card data API
SWU_MCP_CARD_CATALOG_PATH Auto-discovered from data/catalog/ Local JSON fallback
SWU_MCP_CACHE_DIR .swu-mcp-cache Per-card response cache
SWU_MCP_DEFAULT_LIMIT 10 Default search result limit

Format Support

Premier — 1 leader, 1 base, 50+ main deck (3x copy limit), 10-card sideboard, off-aspect penalty reporting.

Twin Suns — 2 leaders sharing Heroism or Villainy, 1 base, 80+ singleton main deck, no sideboard.

Game Engine

The simulator supports two-player games with:

  • Resource turns, unit/event play, leader deployment, combat, base damage
  • Stack/priority loop with targeting and responses
  • Ambush, Sentinel, Saboteur, Overwhelm, Shielded, Restore, Raid, Hidden
  • When Played / On Attack / When Defeated trigger patterns
  • Upgrade attachment with static buffs and keyword grants
  • Basic AI pilot for sparring

This is a pragmatic rules engine for playtesting and AI sparring, not a comprehensive rules simulator. Edge cases around complex upgrade conditions, nested optional triggers, and deep timing interactions are not fully covered.

Example Prompts

  • "Search for all Cunning leaders from Legends of the Force"
  • "Generate a Twin Suns deck with Cad Bane and Jabba the Hutt"
  • "Upload this decklist, analyze it, and suggest swaps for an aggro-heavy meta"
  • "Start a game with my Qui-Gon deck against a generated Villainy aggro deck"
  • "Take my action to play Boba Fett, then let the AI respond"

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选