Skip to main content
Glama
Crossword MCP Server

Crossword MCP Server

by watamoo

クロスワード MCP サーバー

このリポジトリは、クロスワード支援MCPサーバーです。盤面とカギ定義が記載されたテキストファイルを読み込み、候補語の登録、整合性チェック、最終盤面の描画などを行えます。

必要環境

  • Python 3.11 以降

  • uv

依存関係は uv run 経由でインストールされるため、事前に手動で pip install する必要はありません。

Related MCP server: z3-solver-mcp-server

データ形式

  • グリッド (data/grid-*.txt)

    • 全角数字で行・列番号を記載

    • 入力可能なマスは全角の「?」

    • 黒マスは全角の「#」

  • カギ (data/clue-*.txt)

    • 1 行 1 レコードの JSON Lines

    • id, direction ("across" / "down"), row, col, length, clue をすべて指定

data/フォルダに、サンプルのgridとclueのペアを記載しています。別の問題を解かせたい場合は、このファイルを参考にgrid, clueのファイルを作成してください。

提供ツール

MCP サーバーは次のツール(メソッド)を提供します。

ツール名

説明

setup

グリッドとカギ定義を読み込み、状態を初期化します。

register_candidates

文字数が一致する候補語を追加登録します。既存候補は保持され、重複は無視されます。

get_candidates

指定した clue_id の候補語リストを取得します。

search_consistent_sets

現在の候補語から整合性を満たす組合せを全探索します。

render_solution

全カギの解答(ひらがなのみ)を盤面に反映し、整形済みのグリッドを描画します。

solve_crossword

上記ツール群を組み合わせて解法を進めるためのプロンプトです。

Claude Code への登録と利用方法

Claude Code に本サーバーを追加するには、プロジェクトルートで次のコマンドを実行してください。

claude mcp add crossword_tools --scope project -- uv run --with fastmcp fastmcp run src/server.py

(crossword_tools はこのサーバーに付与する MCP 名称です。必要に応じて変更してください)

登録後は、Claude Code においてカスタムスラッシュコマンド /crossword_tools を選択し、引数としてグリッドとカギのファイル(またはテキスト)を指定してください。 プロンプトに沿って、Claude Codeが自律的に状態の初期化や候補語の追加、整合性チェックを行い、最終解答にたどり着いた場合はその解答の描画・レポート作成を行います。

/crossword_tools:solve_crossword (MCP) grid-001.txt clue-001.txt

ライセンス

本リポジトリは MIT License の下で提供されます。

Available Tools

5 tools
get_candidatesA

登録済みの候補語リストを取得する。

Args: clue_id (str): 取得対象のカギ ID。事前に register_candidates で候補を登録して いる必要がある。

Returns: list[str]: 登録済み候補語のリスト。登録時に渡した文字列を順序どおりに返す。

Raises: ValueError: clue_id が空の場合。 KeyError: 指定した clue_id の候補が未登録の場合。

Inputs: clue_id (required). Returns: result

register_candidatesA

指定したカギに対して文字数がマッチする候補語を追加登録する。登録済みと除外された語をまとめて返す。

Args: clue_id (str): 登録対象のカギ ID。setup で読み込んだカギ定義に存在している 必要がある。前後の空白は自動で除去される。 candidates (list[str]): 追加したい候補語のリスト。空文字は許容されない。 カギの length と文字数が一致しない語は登録されず、除外リストに入る。

Returns: dict[str, list[str]]: registered に登録後の候補語リスト(過去の登録分を含む)、 rejected に長さ不一致で追加できなかった語のリストを格納する辞書。

Notes: 長さが一致した語のみ状態に追加され、既存の候補リストは保持したまま追記される。 同じ語が既に登録済みの場合は無視される。

Raises: RuntimeError: setup をまだ呼び出していない場合。 ValueError: clue_id が空、または候補語が空文字だった場合。 KeyError: 指定した clue_id のカギが存在しない場合。

Inputs: clue_id (required), candidates (required). Returns: object

render_solutionA

全カギの解答を盤面へ反映し、整合性チェックを通過した描画結果を返す。

Args: assignments (dict[str, str]): clue_id をキーとした解答文字列の辞書。setup 済みのすべてのカギに対して、黒マス以外のセルを埋める語を指定する。 各文字列は純粋なひらがなのみで構成されている必要がある。

Returns: str: 列・行番号付きで整形したグリッド文字列。交差が一致している場合のみ 返される。

Raises: RuntimeError: setup が未実行の場合。 ValueError: 未指定または未知の clue_id がある、解答が空文字、長さ不一致、 ひらがな以外の文字が含まれている、あるいは黒マスとの衝突・既存文字との 矛盾が発生した場合。

Inputs: assignments (required). Returns: result

search_consistent_setsA

登録済み候補から交差条件を満たす割当てを探索する。

Args: target_clue_ids (list[str] | None): 探索対象とするカギ ID のリスト。None または 空リストを渡した場合は、候補が登録済みのすべてのカギを対象とする。

Returns: list[dict[str, str]]: 整合性が取れた解集合のリスト。各要素は clue_id をキー、 採用した候補語を値とする辞書。複数の最大解が存在する場合は重複しない 形で列挙し、整合するカギが 1 件も無い場合は空リストを返す。

Raises: RuntimeError: setup が未実行、または候補語が一件も登録されていない場合。 KeyError: target_clue_ids に含まれる ID がカギ定義または候補登録に存在しない 場合。

Inputs: target_clue_ids. Returns: result

setupA

クロスワードの盤面とカギ定義を読み込み、状態を初期化する。

Args: grid_text (str): 行番号つきの盤面テキスト。列・行番号は全角数字で表記し、 文字が入るマスは "?"、黒マスは "#" で記述する。各行のマス数が一致している 必要がある。 clue_text (str): JSON Lines 形式のカギ定義。各行は id/direction/row/col /length/clue を持つ辞書で、direction は "across" か "down"。row と col は 1 起点の正整数。

Returns: list[list[str]]: 正規化済みセル行列。各要素は "?" または "#" のシンボル。

Raises: ValueError: 盤面の行長不一致・未知のセル記号・カギ定義の欠損や不正値など、 入力内容が検証に失敗した場合。

Notes: この関数を呼び出すと既存の候補リストは破棄され、状態が再初期化される。

Inputs: grid_text (required), clue_text (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.5/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap. setup initializes the puzzle, register_candidates adds word candidates, get_candidates retrieves them, search_consistent_sets finds solutions, and render_solution displays the final grid. The tools form a logical workflow without ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case: setup, register_candidates, get_candidates, search_consistent_sets, and render_solution. The naming is predictable and readable throughout the set.

    Tool Count5/5

    Five tools are well-scoped for a crossword puzzle server, covering initialization, candidate management, solution search, and rendering. Each tool earns its place without redundancy or gaps, typical for a focused domain.

    Completeness5/5

    The tool set provides complete coverage for crossword puzzle solving: setup for loading, register/get_candidates for word management, search_consistent_sets for finding solutions, and render_solution for output. There are no obvious gaps in the lifecycle from setup to solution rendering.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to solve Rubik's Cube puzzles through systematic manipulation with standard cube notation moves. Features real-time 3D visualization and interactive controls for tracking solving progress.
      4
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Enables solving constraint satisfaction problems, mathematical equations, and logic puzzles using the Z3 SMT solver through natural language.
      1
      3
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for puzzle generation: word search generator, crossword generator, and sudoku generator + solver, with printable PDF worksheets, themed word banks, and verifiable LLM evals. Works with Claude Desktop, Cursor, Windsurf, and any Model Context Protocol client. From the makers of puzzletide.com.
      92 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to generate uniquely-solvable Sudoku puzzles, validate partial or complete grids, and solve puzzles using SMT solving with Z3, all through stateless MCP tools.
      4
      25 PyPI
      MIT