poker-mcp 1.2.8 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.mcp.json CHANGED
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "supported_materials": {
59
59
  "count": 14,
60
- "types": ["Carbon", "Concrete", "Iron", "Lead", "Aluminum", "Copper", "Tungsten", "Air", "Water", "PyrexGlass", "AcrylicResin", "Polyethylene", "Soil", "VOID"]
60
+ "types": ["Carbon", "Concrete", "Iron", "Lead", "Aluminium", "Copper", "Tungsten", "Air", "Water", "PyrexGlass", "AcrylicResin", "Polyethylene", "Soil", "VOID"]
61
61
  }
62
62
  },
63
63
  "data_configuration": {
@@ -66,14 +66,15 @@
66
66
  "pending_file": "tasks/pending_changes.json",
67
67
  "backup_directory": "backups",
68
68
  "logs_directory": "logs",
69
- "data_directory": "data",
70
69
  "nuclide_database": {
71
- "target_file": "data/ICRP-07.NDX",
70
+ "resolved_file": "${POKER_INSTALL_PATH}/LIB/ICRP-07.NDX",
72
71
  "source_env_var": "POKER_INSTALL_PATH",
73
- "source_relative_path": "lib/ICRP-07.NDX",
72
+ "source_relative_path": "LIB/ICRP-07.NDX",
74
73
  "default_install_path": "C:/Poker",
75
- "skip_if_exists": true,
76
- "fallback_behavior": "error_if_missing"
74
+ "copy_to_workspace": false,
75
+ "legacy_fallback": "${POKER_MCP_HOME}/data/ICRP-07.NDX",
76
+ "fallback_behavior": "warn_then_error_if_missing",
77
+ "note": "v1.4.0 以降、POKER_INSTALL_PATH/LIB を直接参照する。ワークスペースへのコピーは行わない(POKER 更新時に古いコピーを読み続ける問題を回避)"
77
78
  }
78
79
  },
79
80
  "environment_variables": {
@@ -81,7 +82,7 @@
81
82
  "description": "POKERインストールディレクトリのパス",
82
83
  "required": false,
83
84
  "default": "C:/Poker",
84
- "purpose": "lib/ICRP-07.NDXファイルの取得元ディレクトリ指定",
85
+ "purpose": "LIB/ICRP-07.NDX(核種データ)および LIB/lib_material.dat(材料カタログ)の参照元、POKER_CUI.exe / POKER.exe の実行元",
85
86
  "example_windows": "C:/Program Files/POKER",
86
87
  "example_linux": "/usr/local/share/poker"
87
88
  }
package/README.md CHANGED
@@ -4,12 +4,67 @@ YAML-based input file management tool for radiation-shielding calculation code P
4
4
 
5
5
  ## 📋 クイック情報
6
6
 
7
- - **バージョン**: 1.2.8
7
+ - **バージョン**: 1.4.0
8
8
  - **プロトコル**: MCP (Model Context Protocol) 1.0.0 完全準拠
9
9
  - **メインサーバー**: `src/mcp_server_stdio_v4.js`
10
10
  - **データ保存**: `~/.poker-mcp/`(`POKER_MCP_HOME`環境変数で変更可)
11
+ - **核種データ**: `${POKER_INSTALL_PATH}/LIB/ICRP-07.NDX` を直接参照
11
12
  - **実行方式**: STDIO通信(MCPプロトコル標準)
12
13
 
14
+ ## 🆕 バージョン1.4.0の新機能
15
+
16
+ ### ☢️ 子孫核種の自動管理
17
+ 親核種を指定すると子孫核種が自動生成され、**親の更新・削除に追随します**。
18
+ Cs137 を入れれば Ba137m が分岐比 0.9439 で自動的に付き、Cs137 の放射能を
19
+ 2倍にすれば Ba137m も2倍になります。親を削除すれば娘も消えます。
20
+
21
+ 発火タイミングを `executeCalculation` 時から `proposeSource` / `updateSource`
22
+ 時へ移しました。モデル構築を終えた最後の段階で計算が中断することはなくなります。
23
+
24
+ 平衡型は親娘の半減期比で判定します(永続 / 過渡 / 平衡なし)。平衡が成立しない
25
+ 組み合わせは推定せず、警告を返して生成を見送ります。除外は線源ごとに記録され、
26
+ 親を何度更新しても復活しません。
27
+
28
+ 詳細は [docs/DAUGHTER_NUCLIDE_MANAGEMENT.md](./docs/DAUGHTER_NUCLIDE_MANAGEMENT.md)。
29
+
30
+ > **POKER 2.1.0 以降が必要です。** 出自情報を保持する `x_meta` ノードを
31
+ > POKER が受理する必要があります(`source` 直下と `inventory` 要素直下)。
32
+
33
+ ### 🐛 ICRP-07 パーサの重大な修正
34
+ 固定長の列位置が実データと一致しておらず、**全1252核種で子孫核種を1件も
35
+ 取得できていませんでした**。半減期も単位が崩壊形式側へ流出し、Cs137 を
36
+ 30.17年ではなく 30.17 **秒**と解釈していました(9桁の誤り)。
37
+
38
+ 修正後は 808 核種が子孫核種を持ちます。平衡判定は従来まったく機能して
39
+ いなかったことになります。
40
+
41
+ ### 🐛 `reject` のグローバル無効化を修正
42
+ 1つの線源で子孫核種を拒否すると、セッション終了まで全線源の検出が無効に
43
+ なっていました。線源ごとの管理に変更しています。
44
+
45
+ ### 🔧 核種データベースの参照先を LIB へ統一
46
+ `POKER_MCP_HOME/data/` へのコピーを廃止し、`POKER_INSTALL_PATH/LIB/` を
47
+ 直接参照します。従来は「コピー先が存在すればスキップ」だったため、POKER を
48
+ 更新しても古いコピーを読み続けていました。
49
+
50
+ 詳細は [CHANGELOG.md](./CHANGELOG.md) を参照。
51
+
52
+ ## 🆕 バージョン1.3.0の新機能
53
+
54
+ ### ✨ `poker_getDoseMap` — グリッド検出器の線量マップ取得
55
+ グリッド(線/面/体積 = 1D/2D/3D)検出器の全評価点の線量を `.dose` ファイルから取得します。サマリーはグリッド点を間引く(`一部省略`)ため、完全なマップは本ツールで取得します。戻り値は `points[]`(i/j/k・座標・線量)+入れ子 `grid`(1D→[i], 2D→[j][i], 3D→[k][j][i])+ `min/max/max_at`。
56
+
57
+ ### ✨ `executeCalculation` の構造化結果
58
+ 応答に `.summary`(YAML) から抽出した構造化 `result_total`(検出器ごとの座標+E(AP)/DskinM(AP)/H*(10) の内訳)、`dose_columns`、`calculation_warnings`、`calculation_notes` を追加。
59
+
60
+ ### 🐛 `updateSource` の division/geometry/cutoff_rate 対応
61
+ ツールスキーマ・検証が弾いていたフィールドを解放し、線源の in-place 更新(分割の収束スタディ等)が可能に。
62
+
63
+ ### 🔧 マニフェスト↔実行時ドリフト検出
64
+ `npm run check:manifest` でツール定義とマニフェストの乖離を検出。
65
+
66
+ 詳細は [CHANGELOG.md](./CHANGELOG.md) を参照。
67
+
13
68
  ## 🆕 バージョン1.2.8の新機能
14
69
 
15
70
  ### ✨ `poker_openGui` — POKER GUI 起動メソッドを追加
@@ -20,6 +75,14 @@ YAML-based input file management tool for radiation-shielding calculation code P
20
75
  - `POKER_INSTALL_PATH/POKER.exe`(デフォルト: `C:/Poker/POKER.exe`)を使用
21
76
  - Windows 専用
22
77
 
78
+ ### 最新のPOKER_CUI.exeの機能でPOKER-MCPがカバーしていない部分について
79
+ POKER本体は随時バージョンアップされており、下記の機能についてPOKER-MCPのツールは未対応です。
80
+ それらについてAIアプリが入力を編集しようとするとツールの制約によって拒否されることがあります。必要に応じて手動で入力を修正してください。
81
+
82
+ - 二重層・三重層ビルドアップ係数の指定(現状では単層のみ)
83
+ - 線源にエネルギースペクトルを指定(現状では核種指定のみ)
84
+ - 材料ゾーン・ビルドアップに**任意組成のカスタム材料**を指定(lib_material.dat の標準13+ユーザ材料には対応済み。詳細は docs/manuals/MATERIAL_SYSTEM.md)
85
+
23
86
  ## 🆕 バージョン1.2.7の修正(バグフィックス)
24
87
 
25
88
  ### 🐛 `poker_executeCalculation` の yaml_file パス解決を修正
@@ -86,7 +149,12 @@ npx poker-mcp
86
149
  **未設定時は `~/.poker-mcp/` が自動的に使用されます。**
87
150
 
88
151
  #### `POKER_INSTALL_PATH`(オプション)
89
- ICRP-07.NDX 核種データベースのコピー元を指定します。
152
+ POKERのインストールディレクトリを指定します。以下の2つの用途で参照されます。
153
+
154
+ - **ICRP-07.NDX の参照先**: `{POKER_INSTALL_PATH}/LIB/ICRP-07.NDX` を直接参照(v1.4.0以降、コピーなし)
155
+ - **POKER.exe の場所**: `{POKER_INSTALL_PATH}/POKER.exe`(`poker_openGui` 使用時)
156
+
157
+ **デフォルト値**: `C:/Poker`(未設定時は `C:/Poker` を使用)
90
158
 
91
159
  ```bash
92
160
  # Windows(コマンドプロンプト)
@@ -163,7 +231,7 @@ Claude Desktopで以下のようにテストできます:
163
231
  ## 🏆 主要機能
164
232
 
165
233
  ### ✅ **MCP完全対応**
166
- - **29メソッド完全実装**: 全ての放射線遮蔽計算入力管理機能
234
+ - **30メソッド完全実装**: 全ての放射線遮蔽計算入力管理機能
167
235
  - **JSON-RPC 2.0準拠**: 標準プロトコル完全対応
168
236
  - **STDIO通信**: MCPクライアントとの標準通信方式
169
237
  - **自動バックアップ・ロールバック**: 企業品質のデータ保護
@@ -182,7 +250,7 @@ Claude Desktopで以下のようにテストできます:
182
250
 
183
251
  ## 🎯 API構成
184
252
 
185
- ### 🔧 **29メソッド完全実装**
253
+ ### 🔧 **30メソッド完全実装**
186
254
 
187
255
  | **カテゴリ** | **メソッド数** | **機能** | **主要操作** |
188
256
  |-------------|---------------|----------|-------------|
@@ -193,9 +261,9 @@ Claude Desktopで以下のようにテストできます:
193
261
  | **📡 Source** | 3個 | 線源管理 | propose・update・delete |
194
262
  | **🎯 Detector** | 3個 | 検出器管理 | propose・update・delete |
195
263
  | **📏 Unit** | 5個 | 単位設定管理 | propose・get・update・validateIntegrity・analyzeConversion |
196
- | **⚙️ System** | 5個 | システム制御 | applyChanges・executeCalculation・resetYaml・confirmDaughterNuclides・各種検証 |
264
+ | **⚙️ System** | 6個 | システム制御 | applyChanges・executeCalculation・resetYaml・confirmDaughterNuclides・openGui・各種検証 |
197
265
 
198
- ### 📋 **全29メソッド一覧**
266
+ ### 📋 **全30メソッド一覧**
199
267
  ```
200
268
  Body系 (3): poker_proposeBody, poker_updateBody, poker_deleteBody
201
269
  Zone系 (3): poker_proposeZone, poker_updateZone, poker_deleteZone
@@ -206,8 +274,8 @@ Source系 (3): poker_proposeSource, poker_updateSource, poker_deleteSourc
206
274
  Detector系 (3): poker_proposeDetector, poker_updateDetector, poker_deleteDetector
207
275
  Unit系 (5): poker_proposeUnit, poker_getUnit, poker_updateUnit,
208
276
  poker_validateUnitIntegrity, poker_analyzeUnitConversion
209
- System系 (5): poker_applyChanges, poker_executeCalculation, poker_resetYaml,
210
- poker_confirmDaughterNuclides, 内部検証メソッド群
277
+ System系 (6): poker_applyChanges, poker_executeCalculation, poker_resetYaml,
278
+ poker_confirmDaughterNuclides, poker_openGui, 内部検証メソッド群
211
279
  ```
212
280
 
213
281
  ## 📁 プロジェクト構造
@@ -400,6 +468,6 @@ POKER_MCP_HOME/
400
468
 
401
469
  ---
402
470
 
403
- **🎯 Poker MCP Server v1.2.8**
471
+ **🎯 Poker MCP Server v1.4.0**
404
472
  **プロトコル**: MCP 1.0.0 完全準拠
405
473
  **作者**: Yoshihiro Hirao | **ライセンス**: ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poker-mcp",
3
- "version": "1.2.8",
3
+ "version": "1.4.0",
4
4
  "description": "YAML-based input file management tool for radiation shielding calculation code POKER with MCP support - Enhanced with collision detection, daughter nuclide auto-completion, and environment variable support",
5
5
  "main": "src/mcp_server_stdio_v4.js",
6
6
  "type": "module",
@@ -10,7 +10,8 @@
10
10
  "scripts": {
11
11
  "start": "node src/mcp_server_stdio_v4.js",
12
12
  "dev": "nodemon src/mcp_server_stdio_v4.js",
13
- "prepare": "echo 'NPX ready: npx poker-mcp'"
13
+ "prepare": "echo 'NPX ready: npx poker-mcp'",
14
+ "check:manifest": "node scripts/check-manifest-sync.mjs"
14
15
  },
15
16
  "keywords": [
16
17
  "mcp",
@@ -41,7 +42,7 @@
41
42
  "node": ">=18.0.0"
42
43
  },
43
44
  "dependencies": {
44
- "@modelcontextprotocol/sdk": "^1.7.0",
45
+ "@modelcontextprotocol/sdk": "^1.29.0",
45
46
  "js-yaml": "^4.1.0",
46
47
  "winston": "^3.17.0",
47
48
  "zod": "^3.24.2"
@@ -81,7 +81,7 @@ export function createBodyHandlers(taskManager) {
81
81
  async deleteBody(args) {
82
82
  try {
83
83
  if (!args.name) throw new ValidationError('立体名は必須です', 'name', args.name);
84
- const result = await taskManager.deleteBody(args.name);
84
+ const result = await taskManager.deleteBody(args.name, args.cascade === true);
85
85
  return { success: true, message: result };
86
86
  } catch (error) {
87
87
  logger.error('deleteBodyハンドラーエラー', { args, error: error.message });
@@ -33,7 +33,8 @@ export function createBuildupFactorHandlers(taskManager) {
33
33
  const result = await taskManager.proposeBuildupFactor(
34
34
  args.material,
35
35
  useSlantCorrection,
36
- useFiniteMediumCorrection
36
+ useFiniteMediumCorrection,
37
+ args.equivalent
37
38
  );
38
39
  return { success: true, message: result };
39
40
  } catch (error) {
@@ -4,11 +4,40 @@ import { ValidationError, CalculationError } from '../../utils/errors.js';
4
4
  import { logger } from '../../utils/logger.js';
5
5
  import path from 'path';
6
6
  import { TASKS_DIR } from '../../utils/paths.js';
7
+ import { parseDoseSummary } from '../../utils/summaryParser.js';
8
+ import { parseDoseMap } from '../../utils/doseMapParser.js';
7
9
 
8
10
  export function createCalculationHandlers(taskManager) {
9
11
  const calculationService = new CalculationService();
10
12
 
11
13
  return {
14
+ async getDoseMap(args) {
15
+ try {
16
+ if (!args.detector_name) {
17
+ throw new ValidationError('detector_name is required', 'detector_name', args.detector_name);
18
+ }
19
+ const yamlFile = args.yaml_file || 'poker.yaml';
20
+ const absolutePathPattern = /^([a-zA-Z]:[\\\/]|\/)/;
21
+ const resolvedYamlFile = absolutePathPattern.test(yamlFile) ? yamlFile : path.join(TASKS_DIR, yamlFile);
22
+ const dosePath = resolvedYamlFile + '.dose';
23
+ // .dose は poker_cui 完了直後に書き込まれるが、完了検知からディスク反映までに数秒の
24
+ // ばらつきがある。実運用(executeCalculation とは別コール)では準備済みだが、直後呼び出しに
25
+ // 備え、準備できるまで最大約10秒リトライする(未準備時のみ待機)。
26
+ let map = parseDoseMap(dosePath, args.detector_name, { doseType: args.dose_type, ray: args.ray });
27
+ for (let attempt = 0; attempt < 20 && !map; attempt++) {
28
+ await new Promise(r => setTimeout(r, 500));
29
+ map = parseDoseMap(dosePath, args.detector_name, { doseType: args.dose_type, ray: args.ray });
30
+ }
31
+ if (!map) {
32
+ return { success: false, error: `.dose の解析に失敗、または検出器 '${args.detector_name}' が見つかりません`, dose_file: dosePath };
33
+ }
34
+ return { success: true, ...map, dose_file: dosePath };
35
+ } catch (error) {
36
+ logger.error('getDoseMap handler error', { args, error: error.message });
37
+ throw error;
38
+ }
39
+ },
40
+
12
41
  async executeCalculation(args) {
13
42
  try {
14
43
  // 引数検証
@@ -157,6 +186,25 @@ export function createCalculationHandlers(taskManager) {
157
186
  response.warnings = ['Some output files were not generated. Check calculation logs for details.'];
158
187
  }
159
188
 
189
+ // .summary(YAML) をパースして構造化 result_total を付加
190
+ try {
191
+ const summaryPath = (resolvedOutputFiles && resolvedOutputFiles.summary_file)
192
+ ? resolvedOutputFiles.summary_file
193
+ : resolvedYamlFile + '.summary';
194
+ const parsed = parseDoseSummary(summaryPath);
195
+ if (parsed) {
196
+ response.result_total = parsed.result_total;
197
+ response.dose_columns = parsed.columns;
198
+ if (parsed.notes && parsed.notes.length) response.calculation_notes = parsed.notes;
199
+ if (parsed.elapsed_time) response.calculation.elapsed_time = parsed.elapsed_time;
200
+ if (parsed.warnings && parsed.warnings.length) {
201
+ response.calculation_warnings = parsed.warnings;
202
+ }
203
+ }
204
+ } catch (e) {
205
+ logger.warn('summary 構造化パースをスキップ', { error: e.message });
206
+ }
207
+
160
208
  logger.info('Calculation completed successfully', {
161
209
  yamlFile: resolvedYamlFile,
162
210
  executionTime: result.executionTime,