@pecot/tools-mcp 0.0.0-stage → 1.0.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/.claude-plugin/plugin.json +8 -0
- package/LICENSE +21 -0
- package/README.md +113 -2
- package/bin/pecot-tools-mcp.mjs +10 -0
- package/cli/dist/cli.d.ts +9 -0
- package/cli/dist/cli.js +65 -0
- package/cli/dist/domain/allowlist.d.ts +228 -0
- package/cli/dist/domain/allowlist.js +657 -0
- package/cli/dist/domain/arguments.d.ts +37 -0
- package/cli/dist/domain/arguments.js +453 -0
- package/cli/dist/domain/athena-query.d.ts +22 -0
- package/cli/dist/domain/athena-query.js +191 -0
- package/cli/dist/domain/failure.d.ts +22 -0
- package/cli/dist/domain/failure.js +99 -0
- package/cli/dist/domain/redact.d.ts +5 -0
- package/cli/dist/domain/redact.js +38 -0
- package/cli/dist/domain/s3-input.d.ts +20 -0
- package/cli/dist/domain/s3-input.js +50 -0
- package/cli/dist/domain/sso-output.d.ts +23 -0
- package/cli/dist/domain/sso-output.js +70 -0
- package/cli/dist/infra/awscli.d.ts +104 -0
- package/cli/dist/infra/awscli.js +245 -0
- package/cli/dist/infra/ignore-rejection.d.ts +6 -0
- package/cli/dist/infra/ignore-rejection.js +13 -0
- package/cli/dist/infra/local-file.d.ts +9 -0
- package/cli/dist/infra/local-file.js +21 -0
- package/cli/dist/infra/sso/login-registry.d.ts +99 -0
- package/cli/dist/infra/sso/login-registry.js +314 -0
- package/cli/dist/mcp/executor.d.ts +14 -0
- package/cli/dist/mcp/executor.js +44 -0
- package/cli/dist/mcp/result.d.ts +57 -0
- package/cli/dist/mcp/result.js +53 -0
- package/cli/dist/mcp/serve.d.ts +70 -0
- package/cli/dist/mcp/serve.js +185 -0
- package/cli/dist/mcp/server.d.ts +69 -0
- package/cli/dist/mcp/server.js +115 -0
- package/cli/dist/mcp/tools/_shared.d.ts +141 -0
- package/cli/dist/mcp/tools/_shared.js +290 -0
- package/cli/dist/mcp/tools/athena.d.ts +4 -0
- package/cli/dist/mcp/tools/athena.js +82 -0
- package/cli/dist/mcp/tools/cloudwatch.d.ts +4 -0
- package/cli/dist/mcp/tools/cloudwatch.js +46 -0
- package/cli/dist/mcp/tools/ec2.d.ts +4 -0
- package/cli/dist/mcp/tools/ec2.js +31 -0
- package/cli/dist/mcp/tools/ecr.d.ts +4 -0
- package/cli/dist/mcp/tools/ecr.js +37 -0
- package/cli/dist/mcp/tools/index.d.ts +7 -0
- package/cli/dist/mcp/tools/index.js +37 -0
- package/cli/dist/mcp/tools/lambda.d.ts +4 -0
- package/cli/dist/mcp/tools/lambda.js +36 -0
- package/cli/dist/mcp/tools/logs.d.ts +4 -0
- package/cli/dist/mcp/tools/logs.js +74 -0
- package/cli/dist/mcp/tools/rds.d.ts +4 -0
- package/cli/dist/mcp/tools/rds.js +60 -0
- package/cli/dist/mcp/tools/s3.d.ts +4 -0
- package/cli/dist/mcp/tools/s3.js +96 -0
- package/cli/dist/mcp/tools/scheduler.d.ts +4 -0
- package/cli/dist/mcp/tools/scheduler.js +44 -0
- package/cli/dist/mcp/tools/sqs.d.ts +4 -0
- package/cli/dist/mcp/tools/sqs.js +33 -0
- package/cli/dist/mcp/tools/sso.d.ts +11 -0
- package/cli/dist/mcp/tools/sso.js +240 -0
- package/cli/dist/mcp/tools/sts.d.ts +4 -0
- package/cli/dist/mcp/tools/sts.js +15 -0
- package/cli/dist/node-runtime.d.ts +20 -0
- package/cli/dist/node-runtime.js +84 -0
- package/cli/dist/package.json +1 -0
- package/cli/dist/version.d.ts +19 -0
- package/cli/dist/version.js +44 -0
- package/npm-shrinkwrap.json +67 -0
- package/package.json +21 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// 起動する Node.js の版判定。既知の脆弱性の修正を含まない版では CLI と MCP サーバを起動しない。
|
|
2
|
+
// MCP サーバの stderr は利用者の目に入らないため、警告ではなく起動拒否にする。
|
|
3
|
+
// 層構成(domain ← infra ← mcp)のどこにも属さない起動前の確認なので src 直下に置く。
|
|
4
|
+
//
|
|
5
|
+
// このファイルは Node.js 24 の型除去(type stripping)でそのまま実行できる構文だけで書く。
|
|
6
|
+
// enum・namespace・パラメータプロパティを使わず、他モジュールを import しない。
|
|
7
|
+
// ランチャーと hook が node から直接読み込んで checkNodeRuntime を呼ぶため。
|
|
8
|
+
//
|
|
9
|
+
// 判定は cli.ts の main() で行う。静的 import の評価後に動くため、import の段階で落ちる
|
|
10
|
+
// 古い major(23 以前)では案内を出せないことがある。判定だけのエントリモジュールには分けない。
|
|
11
|
+
/**
|
|
12
|
+
系列(major)ごとの最低版。2026-10-21 の Node.js セキュリティリリース
|
|
13
|
+
(Brotli 展開の RCE CVE-2026-111497 ほか)の修正版。25 系はサポート終了で修正版が無い。
|
|
14
|
+
次のセキュリティリリースで上げるときは、現行の版を次のコマンドで列挙する。
|
|
15
|
+
`grep -rn '24.22.1' plugins .githooks`(node_modules・アイコン SVG のヒットは除く)。
|
|
16
|
+
ヒットした箇所を同じ変更で更新する。
|
|
17
|
+
表・engines・フックの期待値・両プラグインの複製の一致は node-runtime.test.ts が検証する。
|
|
18
|
+
*/
|
|
19
|
+
export const MINIMUM_NODE_VERSIONS = {
|
|
20
|
+
24: '24.22.1',
|
|
21
|
+
26: '26.12.1',
|
|
22
|
+
};
|
|
23
|
+
function parseVersion(version) {
|
|
24
|
+
const withoutBuild = (version.split('+', 1)[0] ?? '').replace(/^v/, '');
|
|
25
|
+
const hyphen = withoutBuild.indexOf('-');
|
|
26
|
+
const core = hyphen === -1 ? withoutBuild : withoutBuild.slice(0, hyphen);
|
|
27
|
+
const parts = core.split('.');
|
|
28
|
+
if (parts.length !== 3 || parts.some(part => !/^\d+$/.test(part)))
|
|
29
|
+
return undefined;
|
|
30
|
+
const [major, minor, patch] = parts.map(Number);
|
|
31
|
+
return major === undefined || minor === undefined || patch === undefined ? undefined : { tuple: [major, minor, patch], prerelease: hyphen !== -1 };
|
|
32
|
+
}
|
|
33
|
+
// semver ではプレリリースは同じ major.minor.patch の release より前になる。
|
|
34
|
+
function isAtLeast(actual, minimum) {
|
|
35
|
+
const [major, minor, patch] = actual.tuple;
|
|
36
|
+
const [minimumMajor, minimumMinor, minimumPatch] = minimum;
|
|
37
|
+
if (major !== minimumMajor)
|
|
38
|
+
return major > minimumMajor;
|
|
39
|
+
if (minor !== minimumMinor)
|
|
40
|
+
return minor > minimumMinor;
|
|
41
|
+
if (patch !== minimumPatch)
|
|
42
|
+
return patch > minimumPatch;
|
|
43
|
+
return !actual.prerelease;
|
|
44
|
+
}
|
|
45
|
+
function requiredVersionsText() {
|
|
46
|
+
return Object.entries(MINIMUM_NODE_VERSIONS)
|
|
47
|
+
.map(([major, minimum]) => `${major} 系は ${minimum} 以上`)
|
|
48
|
+
.join('、');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
案内に載せる更新先の版。表の最小 major の最低版。
|
|
52
|
+
*/
|
|
53
|
+
export function suggestedNodeVersion() {
|
|
54
|
+
const majors = Object.keys(MINIMUM_NODE_VERSIONS).map(Number);
|
|
55
|
+
const lowest = MINIMUM_NODE_VERSIONS[Math.min(...majors)];
|
|
56
|
+
return lowest ?? '';
|
|
57
|
+
}
|
|
58
|
+
function guidance(version) {
|
|
59
|
+
return [
|
|
60
|
+
`Node.js ${version} は既知の脆弱性の修正を含まないため起動しません。`,
|
|
61
|
+
` 必要な版: ${requiredVersionsText()}`,
|
|
62
|
+
` Node.js を更新して再実行してください(nvm の例: nvm install ${suggestedNodeVersion()})。`,
|
|
63
|
+
].join('\n');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
起動してよい版なら undefined、止めるべき版なら利用者向けの案内文を返す。
|
|
67
|
+
表に無い major は、表の最大 major より新しければ修正後のリリースとみなして許可し、
|
|
68
|
+
それ以外(24 未満・サポート終了の 25 系)は止める。
|
|
69
|
+
*/
|
|
70
|
+
export function checkNodeRuntime(version) {
|
|
71
|
+
const actual = parseVersion(version);
|
|
72
|
+
if (actual === undefined)
|
|
73
|
+
return guidance(version);
|
|
74
|
+
const minimum = MINIMUM_NODE_VERSIONS[actual.tuple[0]];
|
|
75
|
+
if (minimum === undefined) {
|
|
76
|
+
const newest = Math.max(...Object.keys(MINIMUM_NODE_VERSIONS).map(Number));
|
|
77
|
+
return actual.tuple[0] > newest ? undefined : guidance(version);
|
|
78
|
+
}
|
|
79
|
+
const minimumVersion = parseVersion(minimum);
|
|
80
|
+
if (minimumVersion === undefined)
|
|
81
|
+
return guidance(version);
|
|
82
|
+
return isAtLeast(actual, minimumVersion.tuple) ? undefined : guidance(version);
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=node-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
plugin ルート(`plugins/pecot-tools/`)を返す。
|
|
3
|
+
|
|
4
|
+
`CLAUDE_PLUGIN_ROOT` が最優先。
|
|
5
|
+
bin/pecot-tools は cli を実行用ミラー(`${データ置き場}/runtime/<hash>/cli/dist/`)から起動する。
|
|
6
|
+
そのため source 相対で解決すると、plugin.json の無いミラー側を指す。wrapper が env を必ず渡す。
|
|
7
|
+
|
|
8
|
+
env が無いとき(`node dist/cli.js` の直叩き・単体配布・テスト)は source 相対。本ファイルは
|
|
9
|
+
src 直下 / dist 直下(tsconfig.build.json の rootDir: src で平坦化)/ 配布ツリーのいずれでも
|
|
10
|
+
plugin ルートから 2 階層下に置かれる。
|
|
11
|
+
src 直下から動かすとこの相対解決が成り立たなくなるため、階層は version.test.ts で固定する。
|
|
12
|
+
*/
|
|
13
|
+
export declare function pluginRoot(): string;
|
|
14
|
+
/**
|
|
15
|
+
plugin.json の version を返す。読めなければ開発用の既定値。
|
|
16
|
+
*/
|
|
17
|
+
export declare function readVersion(): string;
|
|
18
|
+
export declare function loadVersionFromPluginJson(manifestPath: string): string | undefined;
|
|
19
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// プラグイン版数の解決。cli.ts と今後の mcp の双方から参照するため、cli.ts から独立させている
|
|
2
|
+
// (mcp → cli.ts の import は循環になる)。
|
|
3
|
+
// 層構成は domain ← infra ← mcp。本ファイルはどの層にも属さない共通モジュールとして src 直下に置く。
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
const DEFAULT_VERSION = '0.0.0+dev';
|
|
8
|
+
/**
|
|
9
|
+
plugin ルート(`plugins/pecot-tools/`)を返す。
|
|
10
|
+
|
|
11
|
+
`CLAUDE_PLUGIN_ROOT` が最優先。
|
|
12
|
+
bin/pecot-tools は cli を実行用ミラー(`${データ置き場}/runtime/<hash>/cli/dist/`)から起動する。
|
|
13
|
+
そのため source 相対で解決すると、plugin.json の無いミラー側を指す。wrapper が env を必ず渡す。
|
|
14
|
+
|
|
15
|
+
env が無いとき(`node dist/cli.js` の直叩き・単体配布・テスト)は source 相対。本ファイルは
|
|
16
|
+
src 直下 / dist 直下(tsconfig.build.json の rootDir: src で平坦化)/ 配布ツリーのいずれでも
|
|
17
|
+
plugin ルートから 2 階層下に置かれる。
|
|
18
|
+
src 直下から動かすとこの相対解決が成り立たなくなるため、階層は version.test.ts で固定する。
|
|
19
|
+
*/
|
|
20
|
+
export function pluginRoot() {
|
|
21
|
+
const fromEnvironment = process.env['CLAUDE_PLUGIN_ROOT']?.trim();
|
|
22
|
+
return fromEnvironment === undefined || fromEnvironment === '' ? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..') : fromEnvironment;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
plugin.json の version を返す。読めなければ開発用の既定値。
|
|
26
|
+
*/
|
|
27
|
+
export function readVersion() {
|
|
28
|
+
/* v8 ignore next -- 同梱 plugin.json は常在。読めない場合は loadVersionFromPluginJson の単体テストで担保 */
|
|
29
|
+
return loadVersionFromPluginJson(path.join(pluginRoot(), '.claude-plugin/plugin.json')) ?? DEFAULT_VERSION;
|
|
30
|
+
}
|
|
31
|
+
export function loadVersionFromPluginJson(manifestPath) {
|
|
32
|
+
let parsed;
|
|
33
|
+
try {
|
|
34
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- 環境変数か import.meta.url 由来のパス
|
|
35
|
+
parsed = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line no-restricted-syntax -- 直後の typeof で narrowing する
|
|
41
|
+
const version = parsed?.version;
|
|
42
|
+
return typeof version === 'string' && version !== '' ? version : undefined;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pecot/tools-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "@pecot/tools-mcp",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
13
|
+
"commander": "^14.0.3",
|
|
14
|
+
"zod": "^4.6.7"
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"pecot-tools-mcp": "bin/pecot-tools-mcp.mjs"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": "^24.22.1 || >=26.12.1"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"node_modules/@modelcontextprotocol/core": {
|
|
24
|
+
"version": "2.4.0",
|
|
25
|
+
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.4.0.tgz",
|
|
26
|
+
"integrity": "sha512-z8QBKqdfXLPzkLQuG4xp8hrVEMm1PZ1IgxMN2sMbJiFiAKOWXnAzogXn2W4aqIBlP1ea6U5yiqVquvUNM1Cj6Q==",
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"zod": "^4.2.0"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"node_modules/@modelcontextprotocol/server": {
|
|
36
|
+
"version": "2.4.0",
|
|
37
|
+
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/server/-/server-2.4.0.tgz",
|
|
38
|
+
"integrity": "sha512-rgR9yxSaAJ+bcsi/XroT/S2AfPiIWloXAnrdfYSCms9ivVju0ishu/wW0J21Ho6+ZOR1r7RyeRbjiRuF87ix5Q==",
|
|
39
|
+
"license": "Apache-2.0",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@modelcontextprotocol/core": "2.4.0",
|
|
42
|
+
"zod": "^4.2.0"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"node_modules/commander": {
|
|
49
|
+
"version": "14.0.3",
|
|
50
|
+
"resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",
|
|
51
|
+
"integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=20"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"node_modules/zod": {
|
|
58
|
+
"version": "4.6.7",
|
|
59
|
+
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
|
|
60
|
+
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"funding": {
|
|
63
|
+
"url": "https://github.com/sponsors/colinhacks"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pecot/tools-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "pecot-tools MCP server (standalone distribution)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/pecotcraft/pecot.git",
|
|
10
|
+
"directory": "plugins/pecot-tools"
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"pecot-tools-mcp": "bin/pecot-tools-mcp.mjs"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "^24.22.1 || >=26.12.1"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
20
|
+
"commander": "^14.0.3",
|
|
21
|
+
"zod": "^4.6.7"
|
|
22
|
+
}
|
|
23
|
+
}
|