Skip to main content
Glama
watamoo

Crossword MCP Server

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

## 必要環境

- Python 3.11 以降
- [uv](https://github.com/astral-sh/uv)

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

## データ形式

- **グリッド (`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 に本サーバーを追加するには、プロジェクトルートで次のコマンドを実行してください。

```bash
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 の下で提供されます。

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 issues