Skip to main content
Glama
pokemon-mcp

pokemon-mcp

by suirenn0627

pokemon-mcp

正確なポケモンデータと第9世代ダメージ計算を提供する MCP サーバー。 Claude Code が Web 検索の代わりにこれを叩くことで、コンテキスト消費を抑えつつ正確な数値を得る。

なぜ RAG ではなく構造化 + 計算ツールか

ポケモンのデータは大半が構造化(種族値・技威力・タイプ相性)で、数値の正確さが命。 embedding 検索は意味的に近いものを返すため数値を取り違えるリスクがある。よって本プロジェクトは embedding を使わず、exact lookup(SQLite/PokeAPI)+ 計算エンジンで構成する。

Related MCP server: Pokemon Showdown MCP Server

アーキテクチャ

flowchart LR
    CC[Claude Code] -- MCP/stdio --> S[server.py FastMCP]
    S --> D[damage.py 第9世代計算]
    S --> DB[(SQLite)]
    DB -. 未取得なら遅延フェッチ .-> API[PokeAPI]
    D --> TC[type_chart.py]
    D --> NA[natures.py]
  • damage.py — ダメージ式・実数値・多段(トリプルアクセル威力20/40/60)・乱数16通り・KO%(畳み込み)。命中(光の粉等)は別軸。

  • type_chart.py — 第6世代以降のタイプ相性。

  • natures.py — 性格補正(日本語名エイリアス対応)。

  • data.py — SQLite キャッシュ + PokeAPI 遅延フェッチ。

  • server.py — FastMCP でツール公開。

公開ツール(MVP)

ツール

役割

get_pokemon

種族値・タイプ・特性

get_move

威力・命中・タイプ・分類・多段

type_effectiveness

相性倍率

calc_stat

実数値

calc_damage

撃ごと/累計のダメージ・KO%(多段・テラスSTAB・道具・天候対応)

calc_accuracy

命中率・多段の命中回数分布(光の粉/ふくがん/ランク補正)

ポケモン名・技名は英語slug/日本語名どちらも可(日本語名の解決には build_db.py --aliases で索引構築が必要)。 道具(いのちのたま/こだわり系/たつじんのおび/タイプ強化アイテム等)・天候(晴れ/雨/砂/雪)に対応。

セットアップ

uv sync
uv run pytest            # ダメージエンジンの検証(今日の手計算を再現)
uv run pokemon-mcp       # MCPサーバー(stdio)を起動
# 全件オフラインDBを作る場合(任意・数分):
uv run python scripts/build_db.py

Claude Code への登録

# /path/to/pokemon-mcp は clone した実際のパスに置き換える
claude mcp add --scope user pokemon -- uv --directory /path/to/pokemon-mcp run pokemon-mcp

使い方

Claude Code から自然言語で

登録後はそのまま日本語で聞けば、Claude が裏でツールを呼ぶ(Web検索しないのでコンテキストを食わない):

  • 「陽気マスカーニャの変幻自在トリプルアクセル、無振りガブは耐える?」

  • 「トリプルアクセルが光の粉持ちに3発当たる確率は?」

  • 「いのちのたま+晴れのリザードン かえんほうしゃ、フシギバナへのダメージは?」

ツール別の例

calc_damage — 対面ダメージ(撃ごと/累計のレンジ・KO%):

// 入力: 陽気マスカーニャ(変幻自在) A252 トリプルアクセル vs 無振りガブ
{ "attacker": "meowscarada", "defender": "garchomp", "move": "triple-axel",
  "attacker_offense_ev": 252, "attacker_nature": "jolly", "protean": true }

// 出力(抜粋)
{ "per_hit": [ {"hit":1,"min":64,"max":84}, {"hit":2,"min":132,"max":156}, {"hit":3,"min":196,"max":232} ],
  "cumulative": [ {"after_hit":2,"ko_chance":1.0} ],   // 2撃目で確定KO
  "defender_hp": 183, "type_eff": 4.0, "stab": 1.5 }

道具・天候・テラスの例:

{ "attacker":"charizard", "defender":"venusaur", "move":"flamethrower",
  "attacker_offense_ev":252, "attacker_nature":"modest",
  "item":"life-orb", "weather":"sun" }            // 晴れ×いのちのたま ≒ x1.95

calc_accuracy — 命中率・多段の命中回数分布:

{ "move":"triple-axel", "bright_powder": true }
// → per_check_hit_chance 0.81, all_hits_chance 0.531441,
//    hit_count_distribution { "0":0.19, "1":0.1539, "2":0.124659, "3":0.531441 }

calc_stat — 実数値:

{ "base":110, "level":50, "ev":252, "nature":"jolly", "stat":"atk" }   // → 162

type_effectiveness — 相性倍率:

{ "attacking_type":"ice", "defending_types":["ground","dragon"] }      // → 4.0(こうかばつぐん)

get_pokemon / get_move — 素のデータ:

get_pokemon("garchomp")   → base_stats / types / abilities
get_move("triple-axel")   → power 20, accuracy 90, min_hits/max_hits 3, damage_class physical

calc_damage のパラメータ早見

引数

既定

説明

attacker / defender / move

(必須)

名前(英語slug または日本語名)

level

50

レベル(1〜100)

attacker_offense_ev / attacker_iv / attacker_nature

0 / 31 / hardy

攻撃側(物理=A、特殊=Cは技分類から自動)

defender_hp_ev / defender_defense_ev / defender_iv / defender_nature

0 / 0 / 31 / hardy

防御側

protean

false

変幻自在/リベロ(常にSTAB 1.5)

tera_type

null

テラスタイプ(元タイプ一致なら2.0。攻撃側STABのみ)

item

null

life-orb / choice-band / choice-specs / expert-belt / muscle-band / wise-glasses / タイプ強化アイテム(charcoal等)

weather

null

sun / rain / sand / snow(日本語可)

crit

false

急所

other

1.0

その他の手動補正倍率

命中(光の粉等)は別軸。calc_damage は命中前提のダメージ・KO%を返す。命中率は calc_accuracy を使う。 可変多段(2-5発)の ko_chance はヒット数分布で重み付け、ko_chance_all_hits は最大ヒット前提(スキルリンク/こだわりサイコロ時)。

日本語名で引くには

技名は取得時に自動で日本語索引へ登録される。ポケモン名を含めて全件を日本語で引くには、一度だけ索引を構築する:

uv run python scripts/build_db.py --aliases   # 数分・一度きり
# → 以後「ガブリアス」「かえんほうしゃ」等でも引ける

仕様の正確さ

tests/test_damage.py が「陽気マスカーニャ(変幻自在)トリプルアクセル vs 無振りガブリアス Lv50」の 手計算(各撃 64-84 / 132-156 / 196-232、2撃目で確定気絶)を再現することでエンジンを検証している。 補正順序は第5世代以降の公式式(天候 → 急所 → 乱数 → タイプ一致 → 相性)に準拠。

ライセンス

本プロジェクトのソースコードは MIT License で公開している。

免責 (Disclaimer)

これは非公式・非営利のファンプロジェクトです。

  • Pokémon およびポケモンのキャラクター名・技名は、任天堂 / 株式会社クリーチャーズ / 株式会社ゲームフリーク(The Pokémon Company)の商標です。

  • 本プロジェクトは任天堂・The Pokémon Company とは一切関係なく、公認・後援も受けていません。

  • ゲームの画像・音声・アートワーク等の著作物は一切含みません。種族値・技・タイプ相性などの 事実データは PokéAPI から実行時に取得するのみで、本リポジトリには 同梱・再配布していません(data/pokedex.db は .gitignore 済み)。

  • MIT ライセンスは本プロジェクトのコードにのみ適用され、ポケモンのデータ・名称・商標には 及びません。

  • 非営利・個人利用を前提としています。商用利用は権利者の許諾が必要です。

Available Tools

8 tools
calc_accuracyA

技の命中率を計算。光の粉(x0.9)・ふくがん(x1.3)・命中/回避ランクに対応。

トリプルアクセル/トリプルキックは各撃ごとに独立判定するため、当たった回数の分布と 「全段命中する確率」も返す(例: トリプルアクセル vs 光の粉 = 各撃81%、3発命中 53.1%)。

Inputs: move (required), bright_powder, compound_eyes, accuracy_stage, +1 more.

calc_damageA

対面のダメージを計算(多段対応)。撃ごと/累計のレンジとKO%を返す。

  • 物理/特殊は技の分類から自動判定(物理=こうげき/ぼうぎょ、特殊=とくこう/とくぼう)。

  • protean=True で変幻自在/リベロのSTAB。tera_type 指定でテラスタルのSTAB(元タイプ一致なら2.0)。

  • item: 攻撃側の持ち物(life-orb / choice-band / choice-specs / expert-belt / muscle-band / wise-glasses / charcoal 等のタイプ強化アイテム)。

  • weather: sun/rain/sand/snow(晴れ/雨/砂/雪。日本語可)。晴れ雨は炎水技、砂雪は岩氷の防御に影響。

  • 攻守のポケモン名・技名は英語slug/日本語名どちらも可(日本語は要 build_db --aliases)。

  • tera_type は攻撃側のSTABのみに反映(防御側の相性計算には影響しない)。

  • 命中(光の粉等)は別軸。本ツールは命中前提のダメージ・KO%を返す(命中率は calc_accuracy)。 可変多段(2-5発)の ko_chance はヒット数分布で重み付け、ko_chance_all_hits は最大ヒット前提。

Inputs: attacker (required), defender (required), move (required), level, +13 more.

calc_statC

実数値を計算。stat は hp/atk/def/spa/spd/spe。nature は英名/日本語名どちらも可。

Inputs: base (required), level, iv, ev, +2 more.

get_abilityC

特性の効果テキストを返す(例: protean)。

Inputs: name (required).

get_itemA

持ち物の効果テキストを返す(例: bright-powder)。

Inputs: name (required).

get_moveB

技の威力・命中・タイプ・分類(物理/特殊)・多段ヒット情報を返す(例: triple-axel)。

Inputs: name (required).

get_pokemonA

ポケモンの種族値・タイプ・特性を返す(例: garchomp, meowscarada)。

Inputs: name (required).

type_effectivenessA

攻撃タイプ x 防御タイプ(複合可)の相性倍率。例: ice vs [ground, dragon] = 4.0

Inputs: attacking_type (required), defending_types (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a unique, clearly defined purpose: accuracy calculation, damage calculation, stat calculation, and information retrieval for abilities, items, moves, Pokémon, and type effectiveness. No overlap in functionality.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern: calc_ for calculations, get_ for data retrieval, and type_effectiveness. This makes the set predictable and easy to navigate.

    Tool Count5/5

    With 8 tools, the server is well-scoped for Pokémon battle simulation and reference. Each tool provides essential functionality without redundancy or bloat.

    Completeness4/5

    The tool set covers core battle calculations (damage, accuracy, stats) and key data lookups (Pokémon, moves, abilities, items, type effectiveness). Minor gaps exist, such as no move search by type or ability list, but these are non-critical.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      D
      maintenance
      Enables interaction with live Pokémon data through PokeAPI, providing comprehensive Pokémon information, battle calculations, moveset validation, and team analysis. Supports searching Pokémon and moves, calculating stats, checking type effectiveness, and analyzing team synergies with in-memory caching for improved performance.
      9
      -
    • A
      license
      A
      quality
      D
      maintenance
      Provides Pokemon Showdown competitive battle data to AI assistants, enabling lookup of Pokemon stats, moves, abilities, items, type matchups, and strategic information through natural language queries.
      8
      5
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Simulates a Pokemon battle system by providing tools for managing Pokemon, executing turn-based combat, and analyzing type effectiveness. It enables AI models to facilitate interactive battles, generate random creatures, and implement complex battle strategies.
      6 npm
      ISC