@yawlabs/aws-mcp 1.1.0 → 1.2.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/dist/index.js +35 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54043,11 +54043,8 @@ async function upsertProfile(path, profile, creds) {
|
|
|
54043
54043
|
}
|
|
54044
54044
|
renameSync(tmpPath, path);
|
|
54045
54045
|
if (platform() !== "win32") {
|
|
54046
|
-
|
|
54047
|
-
|
|
54048
|
-
const st = statSync(path);
|
|
54049
|
-
existingMode = st.mode & 511;
|
|
54050
|
-
}
|
|
54046
|
+
const st = statSync(path);
|
|
54047
|
+
const existingMode = st.mode & 511;
|
|
54051
54048
|
if ((existingMode & 63) !== 0) chmodSync(path, 384);
|
|
54052
54049
|
}
|
|
54053
54050
|
} finally {
|
|
@@ -55452,7 +55449,8 @@ var logsTools = [
|
|
|
55452
55449
|
var SIMPLE_STATS = ["Average", "Sum", "Maximum", "Minimum", "SampleCount"];
|
|
55453
55450
|
var EXTENDED_STAT_RE = /^(p|tm|tc|wm|pr|ts|iqm)(\d{1,3}(\.\d{1,3})?)?$/i;
|
|
55454
55451
|
function isValidStatistic(s) {
|
|
55455
|
-
|
|
55452
|
+
const lower = s.toLowerCase();
|
|
55453
|
+
if (SIMPLE_STATS.some((stat) => stat.toLowerCase() === lower)) return true;
|
|
55456
55454
|
return EXTENDED_STAT_RE.test(s);
|
|
55457
55455
|
}
|
|
55458
55456
|
var QUERY_ID_RE = /^[a-z][A-Za-z0-9_]*$/;
|
|
@@ -55517,7 +55515,7 @@ function buildMetricDataQueries(inputs, autoPeriod) {
|
|
|
55517
55515
|
var metricsTools = [
|
|
55518
55516
|
{
|
|
55519
55517
|
name: "aws_metrics_query",
|
|
55520
|
-
description: "Query CloudWatch metrics via GetMetricData (the modern multi-metric / expression-capable API, not the legacy get-metric-statistics). Pass `queries` as a flat array of {id, namespace, metricName, dimensions?, statistic?, period?, expression?, label?}; the tool shapes them into MetricDataQueries for you. `startTime`/`endTime` accept ISO 8601 or relative shorthand ('15m', '1h', '1d', '1w'); endTime defaults to 'now'. Period is auto-picked from the time range when omitted (60s for <=3h, 300s for <=24h, 900s for <=15d, 3600s otherwise) to stay under CloudWatch's ~100,800-datapoint response cap. Returns {series: [{id, label?, timestamps, values, statusCode?}], messages?, periodSeconds}. Use for 'show me the CPU on this instance for the last hour', 'sum lambda invocations across these 3 functions', or expression-based 'p99 latency divided by average latency' lookups.",
|
|
55518
|
+
description: "Query CloudWatch metrics via GetMetricData (the modern multi-metric / expression-capable API, not the legacy get-metric-statistics). Pass `queries` as a flat array of {id, namespace, metricName, dimensions?, statistic?, period?, expression?, label?}; the tool shapes them into MetricDataQueries for you. `startTime`/`endTime` accept ISO 8601 or relative shorthand ('15m', '1h', '1d', '1w'); endTime defaults to 'now'. Period is auto-picked from the time range when omitted (60s for <=3h, 300s for <=24h, 900s for <=15d, 3600s otherwise) to stay under CloudWatch's ~100,800-datapoint response cap. Returns {series: [{id, label?, timestamps, values, statusCode?}], messages?, periodSeconds, profile, region, nextToken, hasMore}. When CloudWatch truncates a large response, `hasMore` is true and `nextToken` carries the resume cursor -- call again with `nextToken` set to fetch the next page (rare for typical agent queries that stay within the per-request cap). Use for 'show me the CPU on this instance for the last hour', 'sum lambda invocations across these 3 functions', or expression-based 'p99 latency divided by average latency' lookups.",
|
|
55521
55519
|
annotations: {
|
|
55522
55520
|
title: "Query CloudWatch metrics (GetMetricData)",
|
|
55523
55521
|
readOnlyHint: true,
|
|
@@ -55552,7 +55550,10 @@ var metricsTools = [
|
|
|
55552
55550
|
endTime: external_exports3.string().optional().describe("ISO 8601 timestamp or relative shorthand. Default 'now'."),
|
|
55553
55551
|
scanBy: external_exports3.enum(["TimestampAscending", "TimestampDescending"]).optional().describe("Sort order for returned datapoints. Default 'TimestampDescending' (matches CloudWatch's default)."),
|
|
55554
55552
|
maxDataPoints: external_exports3.number().int().positive().optional().describe(
|
|
55555
|
-
"Soft cap on returned datapoints across all queries. CloudWatch's hard cap is ~100,800; lower this to keep response sizes manageable."
|
|
55553
|
+
"Soft cap on returned datapoints across all queries. CloudWatch's hard cap is ~100,800; lower this to keep response sizes manageable. Forwarded as CloudWatch's MaxDatapoints (single 'p') field; the camelCase schema name follows this server's convention."
|
|
55554
|
+
),
|
|
55555
|
+
nextToken: external_exports3.string().optional().describe(
|
|
55556
|
+
"Resume cursor from a previous call's `nextToken`. Omit for the first page. Forwarded as CloudWatch's NextToken; only meaningful when a prior call returned `hasMore: true`."
|
|
55556
55557
|
),
|
|
55557
55558
|
profile: external_exports3.string().optional().describe("Override session profile for this call."),
|
|
55558
55559
|
region: external_exports3.string().optional().describe("Override session region for this call."),
|
|
@@ -55560,15 +55561,17 @@ var metricsTools = [
|
|
|
55560
55561
|
}),
|
|
55561
55562
|
handler: async (input) => {
|
|
55562
55563
|
const i = input;
|
|
55563
|
-
const seenIds = /* @__PURE__ */ new
|
|
55564
|
-
for (
|
|
55565
|
-
|
|
55564
|
+
const seenIds = /* @__PURE__ */ new Map();
|
|
55565
|
+
for (let qi = 0; qi < i.queries.length; qi++) {
|
|
55566
|
+
const q = i.queries[qi];
|
|
55567
|
+
const firstIdx = seenIds.get(q.id);
|
|
55568
|
+
if (firstIdx !== void 0) {
|
|
55566
55569
|
return {
|
|
55567
55570
|
ok: false,
|
|
55568
|
-
error: `Duplicate query id '${q.id}'. Each MetricDataQuery.Id must be unique in a batch.`
|
|
55571
|
+
error: `Duplicate query id '${q.id}' at queries[${qi}]; first seen at queries[${firstIdx}]. Each MetricDataQuery.Id must be unique in a batch.`
|
|
55569
55572
|
};
|
|
55570
55573
|
}
|
|
55571
|
-
seenIds.
|
|
55574
|
+
seenIds.set(q.id, qi);
|
|
55572
55575
|
const hasMetricStat = q.namespace !== void 0 || q.metricName !== void 0 || q.dimensions !== void 0;
|
|
55573
55576
|
const hasExpression = q.expression !== void 0;
|
|
55574
55577
|
if (hasMetricStat && hasExpression) {
|
|
@@ -55628,6 +55631,9 @@ var metricsTools = [
|
|
|
55628
55631
|
ScanBy: i.scanBy ?? "TimestampDescending"
|
|
55629
55632
|
};
|
|
55630
55633
|
if (i.maxDataPoints !== void 0) params.MaxDatapoints = i.maxDataPoints;
|
|
55634
|
+
if (i.nextToken !== void 0) params.NextToken = i.nextToken;
|
|
55635
|
+
const effectiveProfile = i.profile ?? getProfile();
|
|
55636
|
+
const effectiveRegion = i.region ?? getRegion();
|
|
55631
55637
|
const result = await runAwsCall({
|
|
55632
55638
|
service: "cloudwatch",
|
|
55633
55639
|
operation: "get-metric-data",
|
|
@@ -55652,14 +55658,19 @@ var metricsTools = [
|
|
|
55652
55658
|
code: m.Code,
|
|
55653
55659
|
value: m.Value
|
|
55654
55660
|
}));
|
|
55661
|
+
const nextToken = typeof raw.NextToken === "string" && raw.NextToken.length > 0 ? raw.NextToken : null;
|
|
55655
55662
|
return {
|
|
55656
55663
|
ok: true,
|
|
55657
55664
|
data: {
|
|
55658
55665
|
command: result.command,
|
|
55666
|
+
profile: effectiveProfile,
|
|
55667
|
+
region: effectiveRegion,
|
|
55659
55668
|
startTime: startDate.toISOString(),
|
|
55660
55669
|
endTime: endDate.toISOString(),
|
|
55661
55670
|
periodSeconds,
|
|
55662
55671
|
series,
|
|
55672
|
+
nextToken,
|
|
55673
|
+
hasMore: nextToken !== null,
|
|
55663
55674
|
...messages && messages.length > 0 ? { messages } : {}
|
|
55664
55675
|
}
|
|
55665
55676
|
};
|
|
@@ -55689,7 +55700,7 @@ async function runWithConcurrency(inputs, concurrency, fn) {
|
|
|
55689
55700
|
var multiRegionTools = [
|
|
55690
55701
|
{
|
|
55691
55702
|
name: "aws_multi_region",
|
|
55692
|
-
description: "Run the same AWS API operation across multiple regions in parallel. Same shape as aws_call (service, operation, params?, query?, outputFormat?, timeoutMs?) but takes `regions: string[]` instead of `region`. Returns an array of `{region, ok, data?, command?, error?, errorKind?}` -- partial failure is expected (services aren't everywhere, perms may be region-scoped). Use for fleet-wide reads: 'describe-instances across all our regions', 'list buckets in every region', 'check IAM password policy everywhere'.",
|
|
55703
|
+
description: "Run the same AWS API operation across multiple regions in parallel. Same shape as aws_call (service, operation, params?, query?, outputFormat?, timeoutMs?) but takes `regions: string[]` instead of `region`. Returns an array of `{region, ok, data?, command?, error?, errorKind?}` -- partial failure is expected (services aren't everywhere, perms may be region-scoped). Duplicate regions in the input are collapsed (first occurrence wins), so `results.length` may be less than `regions.length`; use the returned `regionCount` for the actual count run. Use for fleet-wide reads: 'describe-instances across all our regions', 'list buckets in every region', 'check IAM password policy everywhere'.",
|
|
55693
55704
|
annotations: {
|
|
55694
55705
|
title: "Run an AWS operation across multiple regions in parallel",
|
|
55695
55706
|
// The operation can be anything -- we conservatively annotate as not
|
|
@@ -56753,7 +56764,13 @@ async function runScript(opts, handlers = defaultScriptHandlers()) {
|
|
|
56753
56764
|
Response: void 0,
|
|
56754
56765
|
Headers: void 0,
|
|
56755
56766
|
AbortController: void 0,
|
|
56756
|
-
AbortSignal: void 0
|
|
56767
|
+
AbortSignal: void 0,
|
|
56768
|
+
// BroadcastChannel can post messages to listeners in OTHER vm contexts
|
|
56769
|
+
// or the parent process when a channel with the same name is open
|
|
56770
|
+
// there. The aws-mcp parent doesn't subscribe to any channel, so the
|
|
56771
|
+
// realistic reach is nil -- but a future plugin in the parent could,
|
|
56772
|
+
// and the cost of shadowing is zero. Defense-in-depth.
|
|
56773
|
+
BroadcastChannel: void 0
|
|
56757
56774
|
});
|
|
56758
56775
|
const timeoutMs = Math.min(opts.timeoutMs ?? DEFAULT_TIMEOUT_MS2, MAX_TIMEOUT_MS);
|
|
56759
56776
|
const wrappedSource = `(async () => {
|
|
@@ -56796,10 +56813,10 @@ var scriptTools = [
|
|
|
56796
56813
|
},
|
|
56797
56814
|
inputSchema: external_exports3.object({
|
|
56798
56815
|
code: external_exports3.string().min(1).describe(
|
|
56799
|
-
"JavaScript snippet evaluated inside `(async () => { ... })()`. Use `return <value>` to surface a result.
|
|
56816
|
+
"JavaScript snippet evaluated inside `(async () => { ... })()`. Use `return <value>` to surface a result. Bound globals: aws.call, aws.paginate, aws.paginateAll, aws.resource.{get,list,create,update,delete,status}, aws.logsTail, console (capture), JSON, Math, Date, Promise, Array, Object, String, Number, Boolean, Error, Intl, Atomics, SharedArrayBuffer, WebAssembly (compile blocked). Shadowed (undefined): require, import, process, fs, fetch + family, BroadcastChannel, setTimeout/Interval, queueMicrotask, Buffer, global, globalThis. NOT available (ReferenceError if used): URL, URLSearchParams, TextEncoder, TextDecoder, crypto, structuredClone, EventTarget, MessageChannel, performance. eval/Function are disabled (codeGeneration off). Tool helpers throw on failure -- wrap in try/catch when you want to handle errors per-call."
|
|
56800
56817
|
),
|
|
56801
56818
|
timeoutMs: external_exports3.number().int().positive().max(MAX_TIMEOUT_MS).optional().describe(
|
|
56802
|
-
`Wall-clock timeout in milliseconds. Default ${DEFAULT_TIMEOUT_MS2}; max ${MAX_TIMEOUT_MS}. Covers evaluation plus every awaited aws.* call.`
|
|
56819
|
+
`Wall-clock timeout in milliseconds. Default ${DEFAULT_TIMEOUT_MS2}; max ${MAX_TIMEOUT_MS}. Covers evaluation plus every awaited aws.* call. On timeout the script stops being awaited and the tool returns an error, but any aws.* call already in flight is NOT cancelled -- it continues until its own per-call timeout (default 60s). Plan retries accordingly: a script that timed out mid 'resource.delete' may have completed the delete; re-issuing the same script can double-mutate.`
|
|
56803
56820
|
)
|
|
56804
56821
|
}),
|
|
56805
56822
|
handler: async (input) => {
|
|
@@ -56897,7 +56914,7 @@ var sessionTools = [
|
|
|
56897
56914
|
];
|
|
56898
56915
|
|
|
56899
56916
|
// src/index.ts
|
|
56900
|
-
var version2 = true ? "1.1
|
|
56917
|
+
var version2 = true ? "1.2.1" : (await null).createRequire(import.meta.url)("../package.json").version;
|
|
56901
56918
|
var subcommand = process.argv[2];
|
|
56902
56919
|
if (subcommand === "version" || subcommand === "--version") {
|
|
56903
56920
|
console.log(version2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yawlabs/aws-mcp",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"mcpName": "io.github.YawLabs/aws-mcp",
|
|
5
5
|
"description": "AWS MCP server — call any AWS API from AI assistants, with first-class SSO re-login (no more 'browser won't open' dead ends)",
|
|
6
6
|
"license": "MIT",
|