@pecot/tools-mcp 0.0.0-stage → 1.0.1
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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kohei Hayakawa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,114 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pecot/tools-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
pecot-tools プラグインの MCP サーバを、npm のパッケージとして単体で配布したものです。プラグインを導入していない環境でも、
|
|
4
|
+
MCP クライアントに 1 エントリ登録するだけで pecot-tools のツールが使えます。
|
|
5
|
+
|
|
6
|
+
公開するのは許可リストで限定した awscli コマンドだけです。許可リストに無いコマンド、S3 への
|
|
7
|
+
アップロード方向の指定、Athena の変更系クエリは、awscli を起動する前に拒否します。
|
|
8
|
+
|
|
9
|
+
## 前提
|
|
10
|
+
|
|
11
|
+
- Node.js 24 系は 24.22.1 以上、26 系は 26.12.1 以上(脆弱性の修正を含まない版では起動しません)
|
|
12
|
+
- awscli v2(2.22 以上)が PATH にあり、認証(SSO プロファイル等)が設定済みであること。
|
|
13
|
+
ツールは awscli をそのまま起動する。シェルで `aws sts get-caller-identity` が通る状態を前提にする
|
|
14
|
+
- Windows ネイティブ環境は対象外です(Linux / macOS / WSL2 で使用してください)
|
|
15
|
+
|
|
16
|
+
## 登録
|
|
17
|
+
|
|
18
|
+
使用する MCP クライアントの設定に次の 1 エントリを追加します。
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"pecot-tools": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "@pecot/tools-mcp"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Windows の MCP クライアントから使う場合は WSL2 経由で起動します。
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"pecot-tools": {
|
|
37
|
+
"command": "wsl",
|
|
38
|
+
"args": ["npx", "-y", "@pecot/tools-mcp"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
WSL 内の npx が非ログインシェルの PATH に無い場合は、`args` を差し替えます。
|
|
45
|
+
差し替え後は `"args": ["-e", "bash", "-lc", "npx -y @pecot/tools-mcp"]` です。
|
|
46
|
+
|
|
47
|
+
版を固定するときは、`@pecot/tools-mcp@1.2.3` のように版を付けます。
|
|
48
|
+
依存は `npm-shrinkwrap.json` で固定されているため、同じ版なら同じ依存が入ります。
|
|
49
|
+
|
|
50
|
+
## 初回の操作
|
|
51
|
+
|
|
52
|
+
SSO で認証するときは、開始と完了確認の 2 つのツールを順に呼びます。
|
|
53
|
+
|
|
54
|
+
1. `aws_sso_login`(任意で `profile`)を呼ぶ。応答の `data` に `verificationUrl` と `userCode` が
|
|
55
|
+
返るので、URL をブラウザで開いてコードを入力し承認する
|
|
56
|
+
2. `aws_sso_login_status`(同じ `profile`)を呼ぶ。`state` が `completed` になれば認証済み
|
|
57
|
+
3. 以降は `aws_sts_get_caller_identity` 等の各ツールを同じ `profile` で呼ぶ
|
|
58
|
+
|
|
59
|
+
開始から 10 分で `timed-out` になります。`timed-out` と `failed` のときは `aws_sso_login` を
|
|
60
|
+
呼び直してください。
|
|
61
|
+
|
|
62
|
+
## ツール
|
|
63
|
+
|
|
64
|
+
| ツール | awscli | 種別 | 読取専用 | ページング |
|
|
65
|
+
|---|---|---|---|---|
|
|
66
|
+
| `aws_sso_login` | `sso login` | auth | false | - |
|
|
67
|
+
| `aws_sso_login_status` | (子プロセス状態の参照) | auth | true | - |
|
|
68
|
+
| `aws_sts_get_caller_identity` | `sts get-caller-identity` | read | true | - |
|
|
69
|
+
| `aws_lambda_list_functions` | `lambda list-functions` | read | true | max-items |
|
|
70
|
+
| `aws_lambda_get_function_configuration` | `lambda get-function-configuration` | read | true | - |
|
|
71
|
+
| `aws_lambda_list_event_source_mappings` | `lambda list-event-source-mappings` | read | true | max-items |
|
|
72
|
+
| `aws_logs_describe_log_groups` | `logs describe-log-groups` | read | true | max-items |
|
|
73
|
+
| `aws_logs_describe_log_streams` | `logs describe-log-streams` | read | true | max-items |
|
|
74
|
+
| `aws_logs_get_log_events` | `logs get-log-events` | read | true | limit / next-token |
|
|
75
|
+
| `aws_logs_filter_log_events` | `logs filter-log-events` | read | true | max-items |
|
|
76
|
+
| `aws_cloudwatch_get_metric_statistics` | `cloudwatch get-metric-statistics` | read | true | - |
|
|
77
|
+
| `aws_sqs_list_queues` | `sqs list-queues` | read | true | max-items |
|
|
78
|
+
| `aws_sqs_get_queue_attributes` | `sqs get-queue-attributes` | read | true | - |
|
|
79
|
+
| `aws_athena_start_query_execution` | `athena start-query-execution` | execute | false | - |
|
|
80
|
+
| `aws_athena_get_query_execution` | `athena get-query-execution` | read | true | - |
|
|
81
|
+
| `aws_athena_get_query_results` | `athena get-query-results` | read | true | max-items |
|
|
82
|
+
| `aws_s3_ls` | `s3 ls` | read | true | - |
|
|
83
|
+
| `aws_s3_cp` | `s3 cp <s3_uri> <local_path>` | fetch | false | - |
|
|
84
|
+
| `aws_s3api_get_object` | `s3api get-object` | fetch | false | - |
|
|
85
|
+
| `aws_rds_describe_events` | `rds describe-events` | read | true | max-items |
|
|
86
|
+
| `aws_rds_describe_db_clusters` | `rds describe-db-clusters` | read | true | max-items |
|
|
87
|
+
| `aws_rds_describe_db_instances` | `rds describe-db-instances` | read | true | max-items |
|
|
88
|
+
| `aws_scheduler_list_schedules` | `scheduler list-schedules` | read | true | max-items |
|
|
89
|
+
| `aws_scheduler_get_schedule` | `scheduler get-schedule` | read | true | - |
|
|
90
|
+
| `aws_ecr_describe_images` | `ecr describe-images` | read | true | max-items |
|
|
91
|
+
| `aws_ec2_describe_instances` | `ec2 describe-instances` | read | true | max-items |
|
|
92
|
+
|
|
93
|
+
全ツールが任意入力 `profile` と `region` を持ちます。指定したときだけ `--profile` / `--region` を
|
|
94
|
+
付けて awscli を起動します。
|
|
95
|
+
|
|
96
|
+
## 失敗したとき
|
|
97
|
+
|
|
98
|
+
失敗した応答は `category` に理由の種別を持ちます。
|
|
99
|
+
|
|
100
|
+
| category | 内容と対処 |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `not-allowed` | 許可リストに無い操作。公開しているツールの範囲で実行する |
|
|
103
|
+
| `invalid-input` | 入力が書式・制約に合わない。message の指摘に従って入力を直す |
|
|
104
|
+
| `awscli-missing` | awscli が見つからない。awscli v2(2.22 以上)を導入して PATH を通す |
|
|
105
|
+
| `auth-missing` | 認証設定が無い。`aws_sso_login` を実行するか `profile` を指定する |
|
|
106
|
+
| `auth-expired` | 認証の有効期限切れ。`aws_sso_login` で再認証する |
|
|
107
|
+
| `permission-denied` | 権限不足。`profile` と AWS 側のロール・許可セットを確認する |
|
|
108
|
+
| `resource-not-found` | 対象が無い。名前とリージョンを確認する |
|
|
109
|
+
| `timeout` | 時間切れ。取得範囲を狭めて再実行する |
|
|
110
|
+
| `other` | 上記以外。応答の `stderr` を確認する |
|
|
111
|
+
|
|
112
|
+
## 版
|
|
113
|
+
|
|
114
|
+
npm の版は pecot-tools プラグインの版と一致します。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
4
|
+
|
|
5
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
6
|
+
// 配布物は MCP サーバ専用エントリ。登録例が引数なしでも mcp として起動させる。
|
|
7
|
+
if (process.argv.length === 2) process.argv.push('mcp')
|
|
8
|
+
// 絶対パスの動的 import は Windows で ERR_UNSUPPORTED_ESM_URL_SCHEME になるため file URL を通す。
|
|
9
|
+
const { main } = await import(pathToFileURL(path.join(root, 'cli/dist/cli.js')).href)
|
|
10
|
+
main()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export declare function createProgram(): Command;
|
|
3
|
+
/**
|
|
4
|
+
commander の既定である process.exit() 直呼びを止め、例外へ振り替える。
|
|
5
|
+
サブコマンドを足したときに取りこぼさないよう再帰で適用する。
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyExitOverrideRecursively(command: Command): void;
|
|
8
|
+
export declare function main(nodeVersion?: string): void;
|
|
9
|
+
//# sourceMappingURL=cli.d.ts.map
|
package/cli/dist/cli.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// pecot-tools CLI のエントリポイント。MCP サーバの起動 (`mcp`) だけを持つ薄い Command で、
|
|
2
|
+
// MCP SDK の読み込みは action 内の dynamic import に閉じる。
|
|
3
|
+
import { realpathSync } from 'node:fs';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { Command, CommanderError } from 'commander';
|
|
6
|
+
import { checkNodeRuntime } from './node-runtime.js';
|
|
7
|
+
import { readVersion } from './version.js';
|
|
8
|
+
export function createProgram() {
|
|
9
|
+
const program = new Command();
|
|
10
|
+
program.name('pecot-tools').version(readVersion());
|
|
11
|
+
const mcp = program
|
|
12
|
+
.command('mcp')
|
|
13
|
+
.description('MCP サーバとして stdio (stdin/stdout) で待ち受ける');
|
|
14
|
+
/* c8 ignore start -- action は dynamic import して実 process.stdin/stdout へ接続する。
|
|
15
|
+
単体テストから起動すると vitest worker の stdout ごと差し替えてしまう。
|
|
16
|
+
tests/e2e/mcp-stdio.test.ts が実プロセスの spawn で担保する。 */
|
|
17
|
+
mcp.action(async () => {
|
|
18
|
+
const { executeMcpServe, mcpServeDefaultDependencies } = await import('./mcp/serve.js');
|
|
19
|
+
executeMcpServe(mcpServeDefaultDependencies);
|
|
20
|
+
});
|
|
21
|
+
/* c8 ignore stop */
|
|
22
|
+
return program;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
commander の既定である process.exit() 直呼びを止め、例外へ振り替える。
|
|
26
|
+
サブコマンドを足したときに取りこぼさないよう再帰で適用する。
|
|
27
|
+
*/
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types -- exitOverride() で変更する
|
|
29
|
+
export function applyExitOverrideRecursively(command) {
|
|
30
|
+
command.exitOverride();
|
|
31
|
+
for (const child of command.commands)
|
|
32
|
+
applyExitOverrideRecursively(child);
|
|
33
|
+
}
|
|
34
|
+
export function main(nodeVersion = process.versions.node) {
|
|
35
|
+
const runtimeError = checkNodeRuntime(nodeVersion);
|
|
36
|
+
if (runtimeError !== undefined) {
|
|
37
|
+
process.stderr.write(`pecot-tools: ${runtimeError}\n`);
|
|
38
|
+
process.exitCode = 1;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const program = createProgram();
|
|
42
|
+
applyExitOverrideRecursively(program);
|
|
43
|
+
try {
|
|
44
|
+
program.parse(process.argv);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
/* c8 ignore start -- commander 以外の例外は握り潰さずに再送出する */
|
|
48
|
+
if (!(error instanceof CommanderError))
|
|
49
|
+
throw error;
|
|
50
|
+
/* c8 ignore stop */
|
|
51
|
+
process.exitCode = error.exitCode === 0 ? 0 : 2;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/* v8 ignore start -- 直接起動時にだけ通る。挙動は tests/e2e/version.test.ts で担保 */
|
|
55
|
+
if (process.argv[1] !== undefined) {
|
|
56
|
+
// import.meta.url は symlink を解決した実体パスを指すため、argv[1] 側も realpath に揃える。
|
|
57
|
+
// 揃えないと bin ラッパー等の symlink 経由起動で一致せず、何もせず exit 0 で終わる。
|
|
58
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- 起動された自分自身のパス
|
|
59
|
+
const selfUrl = pathToFileURL(realpathSync(process.argv[1])).href;
|
|
60
|
+
if (import.meta.url === selfUrl) {
|
|
61
|
+
main();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/* v8 ignore stop */
|
|
65
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
失敗理由の種別(research R4)。
|
|
3
|
+
*/
|
|
4
|
+
export type FailureCategory = 'not-allowed' | 'invalid-input' | 'awscli-missing' | 'auth-missing' | 'auth-expired' | 'permission-denied' | 'resource-not-found' | 'timeout' | 'other';
|
|
5
|
+
/**
|
|
6
|
+
入力 1 項目の値の種類。検証規則と awscli 引数への写し方の双方を決める。
|
|
7
|
+
|
|
8
|
+
`shorthand` だけは、利用者が直接指定する入力ではない。
|
|
9
|
+
他の入力から `Key=value,Key=value` を組み立てる合成項目(`--query-execution-context` 等)。
|
|
10
|
+
|
|
11
|
+
`shorthand-list` は、利用者がオブジェクトの配列で直接指定する入力。
|
|
12
|
+
配列全体が `[{"Name":"…","Value":"…"}]` の JSON 1 トークンになる(`--dimensions` / `--filters` /
|
|
13
|
+
`--image-ids`)。awscli はこれらのフラグを shorthand と JSON の双方で受ける。
|
|
14
|
+
*/
|
|
15
|
+
export type InputKind = 'string' | 'string-list' | 'integer' | 'boolean' | 'enum' | 'abs-path' | 's3-uri' | 's3-list-uri' | 'shorthand' | 'shorthand-list';
|
|
16
|
+
/**
|
|
17
|
+
`shorthand` の構成要素 1 件。同じエントリの入力 `from` の値を `key=<値>` として載せる。
|
|
18
|
+
*/
|
|
19
|
+
export interface ShorthandPart {
|
|
20
|
+
readonly key: string;
|
|
21
|
+
readonly from: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
`shorthand-list` の要素が持てる構成要素 1 件。要素の `field` の値を JSON の `key` として載せる。
|
|
25
|
+
|
|
26
|
+
`ShorthandPart.from` が「同じエントリの別入力」を指すのに対し、こちらは「配列要素の中の
|
|
27
|
+
キー」を指す。意味が違うので型を分ける。`list` が true の構成要素は string[] を受け、
|
|
28
|
+
JSON でも配列のまま載せる(`--filters` の `Values`)。
|
|
29
|
+
*/
|
|
30
|
+
export interface ShorthandElementPart {
|
|
31
|
+
readonly key: string;
|
|
32
|
+
readonly field: string;
|
|
33
|
+
readonly list?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
入力 1 項目の宣言。
|
|
37
|
+
|
|
38
|
+
`awsFlag` を持つ項目は `--flag value`、`positional` を持つ項目は指定順の位置引数として渡す。
|
|
39
|
+
どちらも持たない項目(`overwrite` 等)は検証だけに使い、awscli の引数には現れない。
|
|
40
|
+
*/
|
|
41
|
+
export interface InputSpec {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly kind: InputKind;
|
|
44
|
+
readonly required: boolean;
|
|
45
|
+
/**
|
|
46
|
+
`--log-group-name` のような awscli のオプション名。
|
|
47
|
+
*/
|
|
48
|
+
readonly awsFlag?: string;
|
|
49
|
+
/**
|
|
50
|
+
位置引数の並び順(0 始まり)。
|
|
51
|
+
*/
|
|
52
|
+
readonly positional?: number;
|
|
53
|
+
/**
|
|
54
|
+
未指定時に補う値。
|
|
55
|
+
*/
|
|
56
|
+
readonly default?: string | number | boolean | readonly string[];
|
|
57
|
+
/**
|
|
58
|
+
kind が 'enum' のときの許容値。
|
|
59
|
+
*/
|
|
60
|
+
readonly values?: readonly string[];
|
|
61
|
+
/**
|
|
62
|
+
kind が 'integer' のときの下限・上限(両端を含む)。
|
|
63
|
+
*/
|
|
64
|
+
readonly min?: number;
|
|
65
|
+
readonly max?: number;
|
|
66
|
+
/**
|
|
67
|
+
kind が 'string' / 'string-list' のときの書式。
|
|
68
|
+
*/
|
|
69
|
+
readonly pattern?: Readonly<RegExp>;
|
|
70
|
+
/**
|
|
71
|
+
kind が 'shorthand' のときの組み立て元。値を持つ構成要素だけが `,` 連結で並ぶ。
|
|
72
|
+
*/
|
|
73
|
+
readonly parts?: readonly ShorthandPart[];
|
|
74
|
+
/**
|
|
75
|
+
kind が 'shorthand-list' のときの要素の構成。宣言外のキーは受け付けない。
|
|
76
|
+
*/
|
|
77
|
+
readonly elements?: readonly ShorthandElementPart[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
公開を許可する awscli コマンド 1 件の静的定義(data-model.md の AllowlistEntry)。
|
|
81
|
+
*/
|
|
82
|
+
export interface AllowlistEntry {
|
|
83
|
+
readonly toolName: string;
|
|
84
|
+
readonly service: string;
|
|
85
|
+
readonly subcommand: string;
|
|
86
|
+
readonly kind: 'read' | 'fetch' | 'execute' | 'auth';
|
|
87
|
+
/**
|
|
88
|
+
`--output json` を付与するか(`s3 ls` / `s3 cp` は高レベルコマンドのため false)。
|
|
89
|
+
*/
|
|
90
|
+
readonly jsonOutput: boolean;
|
|
91
|
+
readonly pagination: 'none' | 'max-items' | 'limit-next-token';
|
|
92
|
+
readonly inputs: readonly InputSpec[];
|
|
93
|
+
/**
|
|
94
|
+
同時指定を invalid-input にする入力名の組(例 log_stream_names と log_stream_name_prefix)。
|
|
95
|
+
*/
|
|
96
|
+
readonly exclusive?: readonly (readonly string[])[];
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
`profile` の書式。data-model.md の `^[A-Za-z0-9_.-]+$` と同値(`\w` = `[A-Za-z0-9_]`)。
|
|
100
|
+
|
|
101
|
+
inputSchema へ載せる mcp 層も同じ定数を読む。書式の定義をここ 1 箇所に保つため。
|
|
102
|
+
*/
|
|
103
|
+
export declare const PROFILE_PATTERN: RegExp;
|
|
104
|
+
/**
|
|
105
|
+
`region` の書式(`ap-northeast-1` 等)。
|
|
106
|
+
|
|
107
|
+
先頭は 2〜4 文字。European Sovereign Cloud の `eusc-de-east-1` が 4 文字始まりで、
|
|
108
|
+
2 文字固定だと入力検証エラーで弾かれる。
|
|
109
|
+
契約書の共通規約も `^[a-z]{2,4}(-[a-z]+)+-\d$` で、本パターンと一致している。
|
|
110
|
+
契約書は specs/012-awscli-mcp-server/contracts/mcp-tools.md を指す。
|
|
111
|
+
*/
|
|
112
|
+
export declare const REGION_PATTERN: RegExp;
|
|
113
|
+
/**
|
|
114
|
+
ISO 8601 の日時(`2026-09-01T00:00Z` / `2026-09-01T00:00:00.000+09:00`)。
|
|
115
|
+
|
|
116
|
+
CloudWatch と RDS の timestamp 引数はこの書式で渡す。CloudWatch Logs 系の epoch ミリ秒
|
|
117
|
+
(integer)とは型が異なるので、契約と description にも「ISO 8601」と明記している。
|
|
118
|
+
`Z` とオフセット付きの双方を awscli 2.36.40 が正しく変換することを動作確認済み。
|
|
119
|
+
*/
|
|
120
|
+
export declare const TIMESTAMP_PATTERN: RegExp;
|
|
121
|
+
/**
|
|
122
|
+
全エントリ共通の任意入力 `profile`。
|
|
123
|
+
*/
|
|
124
|
+
export declare const PROFILE_INPUT: InputSpec;
|
|
125
|
+
/**
|
|
126
|
+
全エントリ共通の任意入力 `region`。
|
|
127
|
+
*/
|
|
128
|
+
export declare const REGION_INPUT: InputSpec;
|
|
129
|
+
export declare const STS_GET_CALLER_IDENTITY: AllowlistEntry;
|
|
130
|
+
export declare const LAMBDA_LIST_FUNCTIONS: AllowlistEntry;
|
|
131
|
+
export declare const LAMBDA_GET_FUNCTION_CONFIGURATION: AllowlistEntry;
|
|
132
|
+
/**
|
|
133
|
+
`lambda list-event-source-mappings`。
|
|
134
|
+
|
|
135
|
+
関数とイベントソース(SQS キュー等)の対応を引くために使う。`--event-source-arn` と
|
|
136
|
+
`--function-name` は、片方だけでも両方でも指定できる。
|
|
137
|
+
*/
|
|
138
|
+
export declare const LAMBDA_LIST_EVENT_SOURCE_MAPPINGS: AllowlistEntry;
|
|
139
|
+
export declare const LOGS_DESCRIBE_LOG_GROUPS: AllowlistEntry;
|
|
140
|
+
export declare const LOGS_DESCRIBE_LOG_STREAMS: AllowlistEntry;
|
|
141
|
+
export declare const LOGS_GET_LOG_EVENTS: AllowlistEntry;
|
|
142
|
+
export declare const LOGS_FILTER_LOG_EVENTS: AllowlistEntry;
|
|
143
|
+
/**
|
|
144
|
+
CloudWatch の標準単位(`--unit` の候補。awscli 2.36.40)。
|
|
145
|
+
|
|
146
|
+
許可リストの `values` と mcp 層の `z.enum`、契約テストが同じ配列を読む。3 箇所に写すと
|
|
147
|
+
綴りがずれるので定義をここ 1 箇所に置く。`z.enum` は非空タプルを要求するため型注釈を付ける。
|
|
148
|
+
*/
|
|
149
|
+
export declare const CLOUDWATCH_UNIT_VALUES: readonly [string, ...string[]];
|
|
150
|
+
/**
|
|
151
|
+
`cloudwatch get-metric-statistics`。
|
|
152
|
+
|
|
153
|
+
`--statistics` を必須にすることで `--extended-statistics`(パーセンタイル)を公開しない形に
|
|
154
|
+
閉じている。API は双方の同時指定を拒否するため、片方だけを公開すれば足りる。
|
|
155
|
+
*/
|
|
156
|
+
export declare const CLOUDWATCH_GET_METRIC_STATISTICS: AllowlistEntry;
|
|
157
|
+
export declare const SQS_LIST_QUEUES: AllowlistEntry;
|
|
158
|
+
export declare const SQS_GET_QUEUE_ATTRIBUTES: AllowlistEntry;
|
|
159
|
+
/**
|
|
160
|
+
`athena start-query-execution`。
|
|
161
|
+
|
|
162
|
+
`database` / `catalog` / `output_location` は検証だけに使う。
|
|
163
|
+
awscli へは shorthand の `--query-execution-context` / `--result-configuration` として渡す。利用者に shorthand の
|
|
164
|
+
文字列そのものを書かせると契約外のキー(`ExpectedBucketOwner` 等)を混ぜられるため、
|
|
165
|
+
組み立てはここの宣言に閉じる。
|
|
166
|
+
*/
|
|
167
|
+
export declare const ATHENA_START_QUERY_EXECUTION: AllowlistEntry;
|
|
168
|
+
export declare const ATHENA_GET_QUERY_EXECUTION: AllowlistEntry;
|
|
169
|
+
export declare const ATHENA_GET_QUERY_RESULTS: AllowlistEntry;
|
|
170
|
+
/**
|
|
171
|
+
`s3 ls`。高レベルコマンドで JSON 出力を持たないため jsonOutput は false。
|
|
172
|
+
*/
|
|
173
|
+
export declare const S3_LS: AllowlistEntry;
|
|
174
|
+
/**
|
|
175
|
+
`s3 cp <s3_uri> <local_path>`。
|
|
176
|
+
|
|
177
|
+
入力は「取得元は S3、書き出し先はローカル」の 2 項目に固定されている。
|
|
178
|
+
そのため、アップロード方向は検証で弾くまでもなく表現できない(research R7)。
|
|
179
|
+
*/
|
|
180
|
+
export declare const S3_CP: AllowlistEntry;
|
|
181
|
+
export declare const S3API_GET_OBJECT: AllowlistEntry;
|
|
182
|
+
/**
|
|
183
|
+
イベントを引ける発生元の種別(`--source-type` の候補。awscli 2.36.40)。
|
|
184
|
+
|
|
185
|
+
許可リストの `values` と mcp 層の `z.enum`、契約テストが同じ配列を読む(`CLOUDWATCH_UNIT_VALUES`
|
|
186
|
+
と同型)。
|
|
187
|
+
*/
|
|
188
|
+
export declare const RDS_SOURCE_TYPE_VALUES: readonly [string, ...string[]];
|
|
189
|
+
/**
|
|
190
|
+
`rds describe-events`。
|
|
191
|
+
|
|
192
|
+
DB の停止・フェイルオーバー等のイベント履歴を引く。`--filters` は公開しない
|
|
193
|
+
(API が受ける属性は版で動くので、契約に固定できる範囲へ絞る)。
|
|
194
|
+
|
|
195
|
+
`duration`(現在から遡る分数)は `start_time` / `end_time` と意味が重なるので排他にする。
|
|
196
|
+
*/
|
|
197
|
+
export declare const RDS_DESCRIBE_EVENTS: AllowlistEntry;
|
|
198
|
+
export declare const RDS_DESCRIBE_DB_CLUSTERS: AllowlistEntry;
|
|
199
|
+
export declare const RDS_DESCRIBE_DB_INSTANCES: AllowlistEntry;
|
|
200
|
+
export declare const SCHEDULER_LIST_SCHEDULES: AllowlistEntry;
|
|
201
|
+
export declare const SCHEDULER_GET_SCHEDULE: AllowlistEntry;
|
|
202
|
+
/**
|
|
203
|
+
`ecr describe-images`。
|
|
204
|
+
|
|
205
|
+
`tag_status` は awsFlag を持たない。shorthand の `--filter tagStatus=<値>` へ合成する
|
|
206
|
+
(Athena の `query_execution_context` と同型)。`--filter` の `imageStatus` は公開しない
|
|
207
|
+
ため、未指定時は API 既定の ACTIVE のイメージだけが返る。
|
|
208
|
+
|
|
209
|
+
`image_ids` と `starting_token` は排他。ECR の API が `imageIds` 指定時に `nextToken` を
|
|
210
|
+
受け付けない(botocore のサービスモデル)ため、構文としては通っても実行できない。
|
|
211
|
+
*/
|
|
212
|
+
export declare const ECR_DESCRIBE_IMAGES: AllowlistEntry;
|
|
213
|
+
/**
|
|
214
|
+
`ec2 describe-instances`。
|
|
215
|
+
|
|
216
|
+
応答が大きくなりやすいので、description で max_items か filters による絞り込みを促している。
|
|
217
|
+
`--dry-run` と `--include-managed-resources` は公開しない。
|
|
218
|
+
*/
|
|
219
|
+
export declare const EC2_DESCRIBE_INSTANCES: AllowlistEntry;
|
|
220
|
+
/**
|
|
221
|
+
公開するエントリの一覧。並びは契約表の順で、tools/list の並びもこれに従う。
|
|
222
|
+
*/
|
|
223
|
+
export declare const ALLOWLIST: readonly AllowlistEntry[];
|
|
224
|
+
/**
|
|
225
|
+
ツール名からエントリを引く。見つからなければ undefined(呼び出し側が not-allowed にする)。
|
|
226
|
+
*/
|
|
227
|
+
export declare function findAllowlistEntry(toolName: string, entries?: readonly AllowlistEntry[]): AllowlistEntry | undefined;
|
|
228
|
+
//# sourceMappingURL=allowlist.d.ts.map
|