poker-mcp 1.2.7 → 1.2.8
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/README.md +17 -2
- package/package.json +1 -1
- package/src/mcp/handlers/guiHandlers.js +124 -0
- package/src/mcp/handlers/index.js +4 -0
- package/src/mcp/tools/guiTools.js +25 -0
- package/src/mcp/tools/index.js +5 -2
package/README.md
CHANGED
|
@@ -4,12 +4,22 @@ YAML-based input file management tool for radiation-shielding calculation code P
|
|
|
4
4
|
|
|
5
5
|
## 📋 クイック情報
|
|
6
6
|
|
|
7
|
-
- **バージョン**: 1.2.
|
|
7
|
+
- **バージョン**: 1.2.8
|
|
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
11
|
- **実行方式**: STDIO通信(MCPプロトコル標準)
|
|
12
12
|
|
|
13
|
+
## 🆕 バージョン1.2.8の新機能
|
|
14
|
+
|
|
15
|
+
### ✨ `poker_openGui` — POKER GUI 起動メソッドを追加
|
|
16
|
+
作成した入力ファイルを POKER.exe でビジュアル確認できます。
|
|
17
|
+
|
|
18
|
+
- 保留中の変更を **自動保存してから** POKER.exe を起動
|
|
19
|
+
- `yaml_file` は省略可(デフォルト: `poker.yaml`)
|
|
20
|
+
- `POKER_INSTALL_PATH/POKER.exe`(デフォルト: `C:/Poker/POKER.exe`)を使用
|
|
21
|
+
- Windows 専用
|
|
22
|
+
|
|
13
23
|
## 🆕 バージョン1.2.7の修正(バグフィックス)
|
|
14
24
|
|
|
15
25
|
### 🐛 `poker_executeCalculation` の yaml_file パス解決を修正
|
|
@@ -345,6 +355,11 @@ POKER_MCP_HOME/
|
|
|
345
355
|
|
|
346
356
|
## 📝 更新履歴
|
|
347
357
|
|
|
358
|
+
### v1.2.8 (2026-05-16)
|
|
359
|
+
- ✨ `poker_openGui` メソッドを新設(POKER.exe でGUI確認)
|
|
360
|
+
- ✨ 起動前に `applyChanges` を自動実行
|
|
361
|
+
- ✨ `yaml_file` 省略可(デフォルト: `poker.yaml`)、`POKER_INSTALL_PATH` 環境変数使用
|
|
362
|
+
|
|
348
363
|
### v1.2.7 (2026-05-16)
|
|
349
364
|
- 🐛 `poker_executeCalculation` の `yaml_file` パス解決バグを修正(スキーマ・ハンドラー間の矛盾)
|
|
350
365
|
- ✨ ファイル名のみの指定で `POKER_MCP_HOME/tasks/` 配下を自動参照
|
|
@@ -385,6 +400,6 @@ POKER_MCP_HOME/
|
|
|
385
400
|
|
|
386
401
|
---
|
|
387
402
|
|
|
388
|
-
**🎯 Poker MCP Server v1.2.
|
|
403
|
+
**🎯 Poker MCP Server v1.2.8**
|
|
389
404
|
**プロトコル**: MCP 1.0.0 完全準拠
|
|
390
405
|
**作者**: Yoshihiro Hirao | **ライセンス**: ISC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poker-mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
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",
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// mcp/handlers/guiHandlers.js
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { promises as fs } from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { logger } from '../../utils/logger.js';
|
|
6
|
+
import { TASKS_DIR, YAML_FILE } from '../../utils/paths.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* POKER.exe のパスを解決する
|
|
10
|
+
* POKER_INSTALL_PATH 環境変数(デフォルト: C:/Poker)配下の POKER.exe を参照
|
|
11
|
+
*/
|
|
12
|
+
function resolvePokerExePath() {
|
|
13
|
+
const installPath = process.env.POKER_INSTALL_PATH || 'C:/Poker';
|
|
14
|
+
return path.win32.join(installPath.replace(/\//g, '\\'), 'POKER.exe');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* yaml_file 引数を絶対パスに解決する
|
|
19
|
+
* ファイル名のみ → TASKS_DIR と結合
|
|
20
|
+
* 絶対パス → そのまま使用(後方互換)
|
|
21
|
+
*/
|
|
22
|
+
function resolveYamlPath(yamlFile) {
|
|
23
|
+
const absolutePathPattern = /^([a-zA-Z]:[\\\/]|\/)/;
|
|
24
|
+
return absolutePathPattern.test(yamlFile)
|
|
25
|
+
? yamlFile
|
|
26
|
+
: path.join(TASKS_DIR, yamlFile);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function createGuiHandlers(taskManager) {
|
|
30
|
+
return {
|
|
31
|
+
async openGui(args) {
|
|
32
|
+
const yamlFile = args?.yaml_file || 'poker.yaml';
|
|
33
|
+
const resolvedYaml = resolveYamlPath(yamlFile);
|
|
34
|
+
const pokerExePath = resolvePokerExePath();
|
|
35
|
+
|
|
36
|
+
logger.info('poker_openGui: 開始', {
|
|
37
|
+
input: yamlFile,
|
|
38
|
+
resolvedYaml,
|
|
39
|
+
pokerExePath
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// ── Step 1: applyChanges を自動実行 ──────────────────────────
|
|
43
|
+
let applyResult;
|
|
44
|
+
try {
|
|
45
|
+
applyResult = await taskManager.applyChanges();
|
|
46
|
+
logger.info('poker_openGui: applyChanges 完了', { result: applyResult });
|
|
47
|
+
} catch (applyError) {
|
|
48
|
+
logger.error('poker_openGui: applyChanges 失敗', { error: applyError.message });
|
|
49
|
+
return {
|
|
50
|
+
success: false,
|
|
51
|
+
error: `変更の保存に失敗しました: ${applyError.message}`,
|
|
52
|
+
error_type: 'APPLY_CHANGES_FAILED',
|
|
53
|
+
suggestion: 'poker_applyChanges を手動で実行してエラー内容を確認してください。'
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ── Step 2: POKER.exe の存在確認 ─────────────────────────────
|
|
58
|
+
try {
|
|
59
|
+
await fs.access(pokerExePath);
|
|
60
|
+
} catch {
|
|
61
|
+
logger.error('poker_openGui: POKER.exe が見つかりません', { pokerExePath });
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
error: `POKER.exe が見つかりません: ${pokerExePath}`,
|
|
65
|
+
error_type: 'POKER_EXE_NOT_FOUND',
|
|
66
|
+
suggestion: 'POKER_INSTALL_PATH 環境変数を正しいインストールディレクトリに設定してください。'
|
|
67
|
+
+ '\n例: "POKER_INSTALL_PATH": "C:\\\\Program Files\\\\POKER"'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ── Step 3: 入力 YAML の存在確認 ─────────────────────────────
|
|
72
|
+
try {
|
|
73
|
+
await fs.access(resolvedYaml);
|
|
74
|
+
} catch {
|
|
75
|
+
logger.error('poker_openGui: YAML ファイルが見つかりません', { resolvedYaml });
|
|
76
|
+
return {
|
|
77
|
+
success: false,
|
|
78
|
+
error: `入力ファイルが見つかりません: ${resolvedYaml}`,
|
|
79
|
+
error_type: 'YAML_FILE_NOT_FOUND',
|
|
80
|
+
suggestion: 'poker_applyChanges を先に実行してください。'
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ── Step 4: POKER.exe をデタッチ起動 ─────────────────────────
|
|
85
|
+
try {
|
|
86
|
+
const child = spawn(pokerExePath, [resolvedYaml], {
|
|
87
|
+
detached: true,
|
|
88
|
+
stdio: 'ignore', // MCPサーバーの stdio を汚染しない
|
|
89
|
+
shell: false
|
|
90
|
+
});
|
|
91
|
+
child.unref(); // MCPサーバーが POKER.exe の終了を待たない
|
|
92
|
+
|
|
93
|
+
logger.info('poker_openGui: POKER.exe 起動成功', {
|
|
94
|
+
pid: child.pid,
|
|
95
|
+
executable: pokerExePath,
|
|
96
|
+
inputFile: resolvedYaml
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
success: true,
|
|
101
|
+
message: 'POKER GUI を起動しました。',
|
|
102
|
+
launched: {
|
|
103
|
+
executable: pokerExePath,
|
|
104
|
+
input_file: resolvedYaml,
|
|
105
|
+
pid: child.pid
|
|
106
|
+
},
|
|
107
|
+
auto_saved: {
|
|
108
|
+
performed: true,
|
|
109
|
+
details: applyResult
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
} catch (launchError) {
|
|
114
|
+
logger.error('poker_openGui: POKER.exe 起動失敗', { error: launchError.message });
|
|
115
|
+
return {
|
|
116
|
+
success: false,
|
|
117
|
+
error: `POKER.exe の起動に失敗しました: ${launchError.message}`,
|
|
118
|
+
error_type: 'POKER_LAUNCH_FAILED',
|
|
119
|
+
suggestion: 'POKER.exe の実行権限および POKER_INSTALL_PATH の設定を確認してください。'
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -9,6 +9,7 @@ import { createUnitHandlers } from './unitHandlers.js';
|
|
|
9
9
|
import { createCalculationHandlers } from './calculationHandlers.js';
|
|
10
10
|
import { resetHandlers } from './resetHandlers.js';
|
|
11
11
|
import { createDaughterNuclideHandler } from './daughterNuclideHandler.js';
|
|
12
|
+
import { createGuiHandlers } from './guiHandlers.js';
|
|
12
13
|
|
|
13
14
|
export function createAllHandlers(taskManager) {
|
|
14
15
|
return {
|
|
@@ -41,6 +42,9 @@ export function createAllHandlers(taskManager) {
|
|
|
41
42
|
|
|
42
43
|
// リセット操作
|
|
43
44
|
resetYaml: resetHandlers.resetYaml(taskManager),
|
|
45
|
+
|
|
46
|
+
// GUI表示操作
|
|
47
|
+
...createGuiHandlers(taskManager),
|
|
44
48
|
|
|
45
49
|
// 共通操作
|
|
46
50
|
async applyChanges(args) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// mcp/tools/guiTools.js
|
|
2
|
+
export const guiTools = [
|
|
3
|
+
{
|
|
4
|
+
name: 'poker_openGui',
|
|
5
|
+
description:
|
|
6
|
+
'YAMLファイルを保存してから POKER.exe でGUI表示します。'
|
|
7
|
+
+ '未保存の変更は自動的に保存(applyChanges)されてから起動します。'
|
|
8
|
+
+ 'POKER_INSTALL_PATH 環境変数(デフォルト: C:/Poker)の POKER.exe を使用します。'
|
|
9
|
+
+ 'Windows専用です。',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
yaml_file: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description:
|
|
16
|
+
'表示する入力ファイル名(省略時は poker.yaml)。'
|
|
17
|
+
+ 'ファイル名のみ指定すると POKER_MCP_HOME/tasks/ 配下を自動参照します。'
|
|
18
|
+
+ '絶対パスも指定可能です。',
|
|
19
|
+
pattern: '^([a-zA-Z0-9_\\-\\.]+\\.(yaml|yml)|([a-zA-Z]:[\\\\\/]|\\/)[^\\\\]+\\.(yaml|yml))$'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
additionalProperties: false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
];
|
package/src/mcp/tools/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { unitTools } from './unitTools.js';
|
|
|
10
10
|
import { calculationTools } from './calculationTools.js';
|
|
11
11
|
import { resetTools } from './resetTools.js';
|
|
12
12
|
import { daughterNuclideTools } from './daughterNuclideTools.js';
|
|
13
|
+
import { guiTools } from './guiTools.js';
|
|
13
14
|
|
|
14
15
|
export const allTools = [
|
|
15
16
|
...bodyTools,
|
|
@@ -22,7 +23,8 @@ export const allTools = [
|
|
|
22
23
|
...unitTools,
|
|
23
24
|
...calculationTools,
|
|
24
25
|
...resetTools,
|
|
25
|
-
...daughterNuclideTools
|
|
26
|
+
...daughterNuclideTools,
|
|
27
|
+
...guiTools
|
|
26
28
|
];
|
|
27
29
|
|
|
28
30
|
export {
|
|
@@ -36,5 +38,6 @@ export {
|
|
|
36
38
|
unitTools,
|
|
37
39
|
calculationTools,
|
|
38
40
|
resetTools,
|
|
39
|
-
daughterNuclideTools
|
|
41
|
+
daughterNuclideTools,
|
|
42
|
+
guiTools
|
|
40
43
|
};
|