Shogi MCP Server
将棋AIエンジンのHTTP APIブリッジおよびMCP(Model Context Protocol)サーバー実装です。
https://github.com/user-attachments/assets/cdff97b9-d60f-411b-b81f-9cabd8e62d62
将棋AIエンジンのREST APIおよびMCP(Model Context Protocol)サーバー実装です。
現時点のLLMとUSI形式の将棋AIの統合し、指し手の説明をさせるためのサンプルプログラムです。
概要
このプロジェクトは、ネイティブの将棋エンジンバイナリをラップし、以下の2つのインターフェースを提供します:
- HTTP API Bridge: HTTPエンドポイント経由での将棋局面解析
- MCP Server: AIエージェント統合のためのModel Context Protocolサーバー
必要要件
- Node.js 18.0.0以上
- USIプロトコル対応の将棋エンジン
- 評価関数ファイル(nn.bin)
インストール
セットアップ
- 将棋エンジンバイナリを
engine/engine
に配置 - 評価関数ファイルを
eval/nn.bin
に配置
使用方法
Claude Desktop
claude_desktop_config.jsonに以下を追記
ブリッジサーバーの起動
デフォルトでポート8787で起動します。
APIエンドポイント
GET /health
- ヘルスチェック用エンドポイント
GET /analyze
- 局面解析エンドポイント
パラメータ:
sfen
(必須): SFEN形式の局面depth
: 探索深さ(デフォルト: 30、最大: 30)multipv
: 候補手の数(デフォルト: 10、最大: 10)threads
: 使用スレッド数(デフォルト: 1、最大: 8)forceMove
: 指定した手を指した後の局面を解析
例:
MCPサーバーの起動
MCPサーバーはstdio経由で通信し、以下のツールを提供します:
ping
: 疎通確認analyze
: 局面の完全解析(MultiPV)eval_at
: 特定の手を指した後の局面評価
環境変数
変数名 | 説明 | デフォルト値 |
---|---|---|
ENGINE_PATH | 将棋エンジンのパス | ./engine/engine |
PORT | ブリッジサーバーのポート | 8787 |
REST_BASE | MCPサーバーが使用するブリッジAPIのベースURL | http://localhost:8787 |
DEBUG | エンジン通信のデバッグログを有効化("1"で有効) | - |
EVAL_FILE | 評価関数ファイルのパス | - |
EVAL_DIR | 評価関数ディレクトリのパス | - |
プロジェクト構成
開発
テスト
ブリッジAPIのテスト例:
トラブルシューティング
評価関数が読み込めない場合
環境変数で明示的にパスを指定してください:
エンジンが起動しない場合
- エンジンバイナリの実行権限を確認
- エンジンパスを環境変数で指定
ライセンス
MIT
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables AI agents to analyze shogi (Japanese chess) positions and moves by integrating with USI protocol engines. Provides position analysis, move evaluation, and game state assessment through HTTP API bridge and MCP tools.
Related MCP Servers
- -securityAlicense-qualityActs as a bridge between AI models and Google's PageSpeed Insights API, enabling detailed performance analysis of websites.Last updated -6676JavaScriptMIT License
- -securityAlicense-qualityHelps you analyze chess positions and get professional evaluations using Stockfish.Last updated -114TypeScriptMIT License
- AsecurityAlicenseAqualityProvides access to Shodan API functionality, enabling AI assistants to query information about internet-connected devices for cybersecurity research and threat intelligence.Last updated -2325JavaScriptMIT License
- -securityFlicense-qualityA protocol server that bridges AI assistants with Unity projects, allowing them to analyze code, parse scenes, generate scripts, and perform other Unity operations through specialized tools.Last updated -TypeScript