@cyanheads/noaa-spaceweather-mcp-server 0.3.1 → 0.3.2

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/AGENTS.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Server:** noaa-spaceweather-mcp-server
4
- **Version:** 0.3.1
5
- **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
4
+ **Version:** 0.3.2
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.14`
6
6
  **Engines:** Bun ≥1.4.0, Node ≥24.0.0
7
- **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
7
+ **MCP SDK:** `@modelcontextprotocol/server` ^2.2.0 (protocol revisions 2026-07-28 and 2025-*)
8
8
  **Zod:** ^4.6.5
9
9
 
10
10
  > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
@@ -35,7 +35,9 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
35
35
  - **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
36
36
  - **Use `ctx.log`** for request-scoped logging. No `console` calls.
37
37
  - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
38
+ - **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
38
39
  - **Secrets in env vars only** — never hardcoded.
40
+ - **Cut noise.** Add only what earns its place: no speculative generality, no guards for states the framework already prevents (Zod-validated params, classified errors), no abstraction until a third caller proves it, no option nothing sets.
39
41
  - **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
40
42
 
41
43
  ---
@@ -67,6 +69,7 @@ export const getConditions = tool('noaa_spaceweather_get_conditions', {
67
69
  reason: 'feed_unavailable',
68
70
  code: JsonRpcErrorCode.ServiceUnavailable,
69
71
  when: 'SWPC endpoint returns non-OK or times out',
72
+ thrownBy: 'service',
70
73
  recovery: 'Retry in 30–60 s; SWPC feeds occasionally lag during high-activity events.',
71
74
  },
72
75
  ],
@@ -74,13 +77,17 @@ export const getConditions = tool('noaa_spaceweather_get_conditions', {
74
77
  async handler(_input, ctx) {
75
78
  const svc = getSpaceWeatherService();
76
79
  const [scales, kpObserved] = await Promise.all([
77
- svc.getNoaaScales(),
78
- svc.getKpObserved(1),
80
+ svc.getNoaaScales(ctx),
81
+ svc.getKpObserved(ctx),
79
82
  ]);
80
- ctx.log.info('Conditions fetched', { kp: kpObserved[0]?.kp });
83
+ ctx.log.info('Conditions fetched', { kp: kpObserved.at(-1)?.kp });
81
84
  return buildConditionsResponse(scales, kpObserved);
82
85
  },
83
86
 
87
+ // format() populates content[] — the markdown twin of structuredContent.
88
+ // Different clients read different surfaces (Claude Code → structuredContent,
89
+ // Claude Desktop → content[]); both must carry the same data.
90
+ // Enforced at lint time: every field in `output` must appear in the rendered text.
84
91
  format: (result) => [{
85
92
  type: 'text',
86
93
  text: `**Space Weather Status** — ${result.observed_time}\n\n${result.status_summary}`,
@@ -106,13 +113,17 @@ Handlers receive a unified `ctx` object. Key properties:
106
113
 
107
114
  | Property | Description |
108
115
  |:---------|:------------|
109
- | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino and `notifications/message` to the client, so treat it as client-visible. |
110
- | `ctx.fail` | Typed error thrower — `ctx.fail('reason', message, opts?)` maps to declared `errors[]` contract. |
111
- | `ctx.enrich` | Attach advisory fields to a successful response — `ctx.enrich.notice(text)`, `.total(n)`, `.echo(query)`, `.delta({...})`. Requires a declared `enrichment` block on the tool; without one the values are silently stripped. |
112
- | `ctx.recoveryFor` | Spread into an error options object to attach the declared recovery hint: `...ctx.recoveryFor('reason')`. |
116
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
117
+ | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any JSON-serializable value; reads return its JSON form (a `Date` comes back as an ISO string). |
118
+ | `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. Always present. |
119
+ | `ctx.inputs` | The request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped` — limited to what the client declared (`elicitation` and its form/url modes, `sampling`, `roots`). Client-supplied: a consent gate trusts only a `ctx.state` record it stored when it asked, bound to the operation, caller, and target (see the `api-context` skill). |
120
+ | `ctx.clientCapabilities` | What the client declared for this request, `undefined` when no view exists. Decides whether to ask for optional context (e.g. roots); never a reason to skip a consent prompt. |
121
+ | `ctx.fail` | Typed error thrower — `ctx.fail('reason', message, data?)` maps to the declared `errors[]` contract; the framework fills the declared recovery hint. |
122
+ | `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
123
+ | `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
113
124
  | `ctx.signal` | `AbortSignal` for cancellation. |
114
- | `ctx.requestId` | Unique request ID. |
115
- | `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio. |
125
+ | `ctx.requestId` | Request ID — the one every log record of the call carries and its error envelope returns as `data.requestId`. |
126
+ | `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
116
127
 
117
128
  ---
118
129
 
@@ -120,7 +131,7 @@ Handlers receive a unified `ctx` object. Key properties:
120
131
 
121
132
  Handlers throw — the framework catches, classifies, and formats.
122
133
 
123
- **Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
134
+ **Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. The framework puts it on the wire whenever a failure carrying that `reason` arrives without a hint — a bare `ctx.fail('reason')` or a service throw with `data: { reason }` — as `data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim; override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Every error envelope also carries `data.requestId`, the id the server's log records for that call carry, and `content[]` closes with `(reason … · request <id>)`. Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
124
135
 
125
136
  ```ts
126
137
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
@@ -132,7 +143,7 @@ errors: [
132
143
  ],
133
144
  async handler(input, ctx) {
134
145
  const item = await db.find(input.id);
135
- if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
146
+ if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
136
147
  return item;
137
148
  }
138
149
  ```
@@ -153,7 +164,7 @@ throw new Error('Invalid query format'); // → ValidationError
153
164
 
154
165
  // McpError — when no factory exists for the code
155
166
  import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
156
- throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
167
+ throw new McpError(JsonRpcErrorCode.InitializationFailed, 'Connection failed', { pool: 'primary' });
157
168
  ```
158
169
 
159
170
  See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table, all available factories, and the contract reference.
@@ -275,7 +286,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
275
286
 
276
287
  ## Bundling
277
288
 
278
- `npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
289
+ `npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
279
290
 
280
291
  **Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match, that every `user_config` option is wired into `mcp_config.env` as `"X": "${user_config.X}"` (the host substitutes nothing else — `"${X}"` reaches the server as that literal string), and that an optional string option carries `"default": ""`.
281
292
 
@@ -312,7 +323,7 @@ security: false # optional — true ONLY for a source
312
323
 
313
324
  ## Publishing
314
325
 
315
- **Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
326
+ **Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the release digest: theme line, `## Changes`, `## Gates`, changelog link last); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
316
327
 
317
328
  ---
318
329
 
package/CLAUDE.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Server:** noaa-spaceweather-mcp-server
4
- **Version:** 0.3.1
5
- **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
4
+ **Version:** 0.3.2
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.14`
6
6
  **Engines:** Bun ≥1.4.0, Node ≥24.0.0
7
- **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
7
+ **MCP SDK:** `@modelcontextprotocol/server` ^2.2.0 (protocol revisions 2026-07-28 and 2025-*)
8
8
  **Zod:** ^4.6.5
9
9
 
10
10
  > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
@@ -35,7 +35,9 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
35
35
  - **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
36
36
  - **Use `ctx.log`** for request-scoped logging. No `console` calls.
37
37
  - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
38
+ - **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
38
39
  - **Secrets in env vars only** — never hardcoded.
40
+ - **Cut noise.** Add only what earns its place: no speculative generality, no guards for states the framework already prevents (Zod-validated params, classified errors), no abstraction until a third caller proves it, no option nothing sets.
39
41
  - **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
40
42
 
41
43
  ---
@@ -67,6 +69,7 @@ export const getConditions = tool('noaa_spaceweather_get_conditions', {
67
69
  reason: 'feed_unavailable',
68
70
  code: JsonRpcErrorCode.ServiceUnavailable,
69
71
  when: 'SWPC endpoint returns non-OK or times out',
72
+ thrownBy: 'service',
70
73
  recovery: 'Retry in 30–60 s; SWPC feeds occasionally lag during high-activity events.',
71
74
  },
72
75
  ],
@@ -74,13 +77,17 @@ export const getConditions = tool('noaa_spaceweather_get_conditions', {
74
77
  async handler(_input, ctx) {
75
78
  const svc = getSpaceWeatherService();
76
79
  const [scales, kpObserved] = await Promise.all([
77
- svc.getNoaaScales(),
78
- svc.getKpObserved(1),
80
+ svc.getNoaaScales(ctx),
81
+ svc.getKpObserved(ctx),
79
82
  ]);
80
- ctx.log.info('Conditions fetched', { kp: kpObserved[0]?.kp });
83
+ ctx.log.info('Conditions fetched', { kp: kpObserved.at(-1)?.kp });
81
84
  return buildConditionsResponse(scales, kpObserved);
82
85
  },
83
86
 
87
+ // format() populates content[] — the markdown twin of structuredContent.
88
+ // Different clients read different surfaces (Claude Code → structuredContent,
89
+ // Claude Desktop → content[]); both must carry the same data.
90
+ // Enforced at lint time: every field in `output` must appear in the rendered text.
84
91
  format: (result) => [{
85
92
  type: 'text',
86
93
  text: `**Space Weather Status** — ${result.observed_time}\n\n${result.status_summary}`,
@@ -106,13 +113,17 @@ Handlers receive a unified `ctx` object. Key properties:
106
113
 
107
114
  | Property | Description |
108
115
  |:---------|:------------|
109
- | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino and `notifications/message` to the client, so treat it as client-visible. |
110
- | `ctx.fail` | Typed error thrower — `ctx.fail('reason', message, opts?)` maps to declared `errors[]` contract. |
111
- | `ctx.enrich` | Attach advisory fields to a successful response — `ctx.enrich.notice(text)`, `.total(n)`, `.echo(query)`, `.delta({...})`. Requires a declared `enrichment` block on the tool; without one the values are silently stripped. |
112
- | `ctx.recoveryFor` | Spread into an error options object to attach the declared recovery hint: `...ctx.recoveryFor('reason')`. |
116
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
117
+ | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any JSON-serializable value; reads return its JSON form (a `Date` comes back as an ISO string). |
118
+ | `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. Always present. |
119
+ | `ctx.inputs` | The request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped` — limited to what the client declared (`elicitation` and its form/url modes, `sampling`, `roots`). Client-supplied: a consent gate trusts only a `ctx.state` record it stored when it asked, bound to the operation, caller, and target (see the `api-context` skill). |
120
+ | `ctx.clientCapabilities` | What the client declared for this request, `undefined` when no view exists. Decides whether to ask for optional context (e.g. roots); never a reason to skip a consent prompt. |
121
+ | `ctx.fail` | Typed error thrower — `ctx.fail('reason', message, data?)` maps to the declared `errors[]` contract; the framework fills the declared recovery hint. |
122
+ | `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
123
+ | `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
113
124
  | `ctx.signal` | `AbortSignal` for cancellation. |
114
- | `ctx.requestId` | Unique request ID. |
115
- | `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio. |
125
+ | `ctx.requestId` | Request ID — the one every log record of the call carries and its error envelope returns as `data.requestId`. |
126
+ | `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
116
127
 
117
128
  ---
118
129
 
@@ -120,7 +131,7 @@ Handlers receive a unified `ctx` object. Key properties:
120
131
 
121
132
  Handlers throw — the framework catches, classifies, and formats.
122
133
 
123
- **Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
134
+ **Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. The framework puts it on the wire whenever a failure carrying that `reason` arrives without a hint — a bare `ctx.fail('reason')` or a service throw with `data: { reason }` — as `data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim; override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Every error envelope also carries `data.requestId`, the id the server's log records for that call carry, and `content[]` closes with `(reason … · request <id>)`. Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
124
135
 
125
136
  ```ts
126
137
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
@@ -132,7 +143,7 @@ errors: [
132
143
  ],
133
144
  async handler(input, ctx) {
134
145
  const item = await db.find(input.id);
135
- if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
146
+ if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
136
147
  return item;
137
148
  }
138
149
  ```
@@ -153,7 +164,7 @@ throw new Error('Invalid query format'); // → ValidationError
153
164
 
154
165
  // McpError — when no factory exists for the code
155
166
  import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
156
- throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
167
+ throw new McpError(JsonRpcErrorCode.InitializationFailed, 'Connection failed', { pool: 'primary' });
157
168
  ```
158
169
 
159
170
  See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table, all available factories, and the contract reference.
@@ -275,7 +286,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
275
286
 
276
287
  ## Bundling
277
288
 
278
- `npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
289
+ `npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
279
290
 
280
291
  **Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match, that every `user_config` option is wired into `mcp_config.env` as `"X": "${user_config.X}"` (the host substitutes nothing else — `"${X}"` reaches the server as that literal string), and that an optional string option carries `"default": ""`.
281
292
 
@@ -312,7 +323,7 @@ security: false # optional — true ONLY for a source
312
323
 
313
324
  ## Publishing
314
325
 
315
- **Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
326
+ **Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the release digest: theme line, `## Changes`, `## Gates`, changelog link last); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
316
327
 
317
328
  ---
318
329
 
package/Dockerfile CHANGED
@@ -4,10 +4,17 @@
4
4
  # This stage installs all dependencies (including dev), builds the TypeScript
5
5
  # source code into JavaScript, and prepares the production assets.
6
6
  #
7
- # The build emits platform-independent JavaScript, so keep this stage native to
8
- # the builder instead of running Bun under cross-architecture emulation.
7
+ # Pinned to $BUILDPLATFORM rather than the target platform: `bun run build` emits
8
+ # JavaScript, and only `dist/` crosses into the production stage. Built for the
9
+ # target instead, the non-native leg of a `--platform linux/amd64,linux/arm64`
10
+ # build runs under QEMU, where bun >= 1.4 aborts with a JavaScriptCore allocator
11
+ # assertion and fails the multi-arch push.
12
+ #
13
+ # The constraint this assumes: the build stage produces platform-independent
14
+ # output. A stage that compiles a native addon needs the target-arch toolchain
15
+ # and cannot cross-compile this way — drop the flag there.
9
16
  # ==============================================================================
10
- FROM --platform=$BUILDPLATFORM oven/bun:1.4.0 AS build
17
+ FROM --platform=$BUILDPLATFORM oven/bun:1.4.2 AS build
11
18
 
12
19
  WORKDIR /usr/src/app
13
20
 
@@ -26,68 +33,133 @@ COPY . .
26
33
  RUN bun run build
27
34
 
28
35
 
36
+ # ==============================================================================
37
+ # Production Dependencies Stage
38
+ #
39
+ # Installs the production dependency tree for the target platform. Every step
40
+ # here can run JavaScript — bunfig.toml's security scanner runs as a Bun
41
+ # program, and so do the OTel and musl-prune scripts — so the stage runs on
42
+ # $BUILDPLATFORM and cross-installs with `--os`/`--cpu`, which pick each
43
+ # platform-specific optional dependency (native bindings such as DuckDB's) for
44
+ # the target. Only `node_modules` leaves this stage.
45
+ #
46
+ # A clean image rather than `FROM build`: the build stage's node_modules holds
47
+ # devDependencies.
48
+ # ==============================================================================
49
+ FROM --platform=$BUILDPLATFORM oven/bun:1.4.2 AS deps
50
+
51
+ WORKDIR /usr/src/app
52
+
53
+ # Copy dependency manifests. `bunfig.toml` rides along so every install below
54
+ # passes its release-age gate and security scanner, as a local install does.
55
+ COPY package.json bun.lock bunfig.toml ./
56
+
57
+ # The scanner bunfig.toml names is a devDependency, and Bun installs a missing
58
+ # scanner through the same production-filtered install, which omits it and
59
+ # aborts. Seed it from the build stage's full install instead. Remove this line,
60
+ # and the `rm` at the end of this stage, if bunfig.toml stops naming a scanner.
61
+ COPY --from=build /usr/src/app/node_modules/@socketsecurity/bun-security-scanner ./node_modules/@socketsecurity/bun-security-scanner
62
+
63
+ # Docker names the target architecture `amd64`/`arm64`; Bun's `--cpu` takes
64
+ # `x64`/`arm64`. Mapped once here, read by both installs below. `oven/bun`
65
+ # publishes only these two architectures, so any other target fails here.
66
+ ARG TARGETOS
67
+ ARG TARGETARCH
68
+ RUN case "$TARGETARCH" in \
69
+ amd64) echo x64 ;; \
70
+ arm64) echo arm64 ;; \
71
+ *) echo "Unsupported TARGETARCH '$TARGETARCH': expected amd64 or arm64" >&2; exit 1 ;; \
72
+ esac > .bun-cpu
73
+
74
+ # Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
75
+ # that are not needed in the final production image.
76
+ # `--omit=peer` drops the framework's optional peer tiers (test runner, service
77
+ # SDKs, parsers) that Bun would otherwise auto-install. Anything this server
78
+ # actually imports belongs in its own `dependencies`, so nothing needed at
79
+ # runtime is lost.
80
+ RUN --mount=type=cache,target=/root/.bun/install/cache \
81
+ bun install --production --omit=peer --frozen-lockfile --ignore-scripts \
82
+ --os="$TARGETOS" --cpu="$(cat .bun-cpu)"
83
+
84
+ # Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
85
+ # Installed by default. Omit them for a leaner image at build time
86
+ # with: docker build --build-arg OTEL_ENABLED=false
87
+ # The script reads the list and each range from the installed framework's
88
+ # `peerDependencies` and passes the target flags on to its `bun install`.
89
+ COPY scripts/install-otel.ts ./scripts/
90
+ ARG OTEL_ENABLED=true
91
+ RUN --mount=type=cache,target=/root/.bun/install/cache \
92
+ if [ "$OTEL_ENABLED" = "true" ]; then \
93
+ bun scripts/install-otel.ts --os="$TARGETOS" --cpu="$(cat .bun-cpu)"; \
94
+ fi
95
+
96
+ # `--os`/`--cpu` have no libc counterpart, so a native dependency published in
97
+ # glibc and musl variants (DuckDB's bindings, for one) installs both. The
98
+ # runtime image is Debian (glibc) and never loads the musl copy; the script
99
+ # deletes every package whose own `libc` admits only musl. It follows every
100
+ # install, since a later `bun install` restores what it removes. A server on a
101
+ # musl (Alpine) runtime image drops these two lines.
102
+ COPY scripts/prune-musl-packages.ts ./scripts/
103
+ RUN bun scripts/prune-musl-packages.ts
104
+
105
+ # The seeded scanner served only the installs above; keep it out of the image.
106
+ RUN rm -rf node_modules/@socketsecurity/bun-security-scanner
107
+
108
+
29
109
  # ==============================================================================
30
110
  # Production Stage
31
111
  #
32
112
  # This stage creates a minimal, optimized, and secure image for running the
33
113
  # application. It uses a slim base image and only includes production
34
- # dependencies and build artifacts.
114
+ # dependencies and build artifacts. Its only Bun invocations are HEALTHCHECK
115
+ # and CMD, which run on the real target at container start.
35
116
  # ==============================================================================
36
- FROM oven/bun:1.4.0-slim AS production
117
+ FROM oven/bun:1.4.2-slim AS production
37
118
 
38
119
  WORKDIR /usr/src/app
39
120
 
40
- # Set the environment to production for performance and to ensure only
41
- # production dependencies are installed.
121
+ # Set the environment to production for performance.
42
122
  ENV NODE_ENV=production
43
123
 
44
- ARG APP_VERSION
45
-
46
124
  # OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
125
+ ARG APP_VERSION
47
126
  LABEL org.opencontainers.image.title="noaa-spaceweather-mcp-server"
48
127
  LABEL org.opencontainers.image.description="Query NOAA SWPC space weather: geomagnetic storm scales, Kp index, aurora forecasts, solar wind, solar activity, and alerts via MCP. STDIO or Streamable HTTP."
49
- LABEL org.opencontainers.image.source="https://github.com/cyanheads/noaa-spaceweather-mcp-server"
50
128
  LABEL org.opencontainers.image.licenses="Apache-2.0"
51
129
  LABEL org.opencontainers.image.version="${APP_VERSION}"
130
+ LABEL org.opencontainers.image.source="https://github.com/cyanheads/noaa-spaceweather-mcp-server"
52
131
 
53
- # Copy dependency manifests
54
- COPY package.json bun.lock ./
55
-
56
- # Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
57
- # that are not needed in the final production image.
58
- # `--omit=peer` drops the framework's optional peer tiers. Anything this server
59
- # imports belongs in its own dependencies. The OTEL step carries the same flag
60
- # so that install does not pull optional peers back into the runtime image.
61
- RUN --mount=type=cache,target=/root/.bun/install/cache \
62
- bun install --production --omit=peer --frozen-lockfile --ignore-scripts
63
-
64
- # Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
65
- # These are not bundled by default to keep the base image lean. Enable at build time
66
- # with: docker build --build-arg OTEL_ENABLED=true
67
- ARG OTEL_ENABLED=true
68
- RUN --mount=type=cache,target=/root/.bun/install/cache \
69
- if [ "$OTEL_ENABLED" = "true" ]; then \
70
- bun add --omit=dev --omit=peer --ignore-scripts @hono/otel \
71
- @opentelemetry/instrumentation-http \
72
- @opentelemetry/exporter-metrics-otlp-http \
73
- @opentelemetry/exporter-trace-otlp-http \
74
- @opentelemetry/instrumentation-pino \
75
- @opentelemetry/resources \
76
- @opentelemetry/sdk-metrics \
77
- @opentelemetry/sdk-node \
78
- @opentelemetry/sdk-trace-node \
79
- @opentelemetry/semantic-conventions; \
80
- fi
132
+ # The manifest comes from the build context: the deps stage's copy was rewritten
133
+ # by the OTel install, and the runtime reads only its name, version, and type.
134
+ COPY package.json ./
135
+ COPY --from=deps /usr/src/app/node_modules ./node_modules
81
136
 
82
137
  # Copy the compiled application code from the build stage
83
138
  COPY --from=build /usr/src/app/dist ./dist
84
139
 
140
+ # Mirror CLI (MirrorService adopters only — Tier 3, opt-in):
141
+ # Copy your mirror lifecycle scripts and emit a runtime tsconfig so Bun resolves
142
+ # the @/ path alias against ./dist/ rather than ./src/.
143
+ # See the api-mirror skill for the full recipe.
144
+ #
145
+ # COPY --from=build /usr/src/app/scripts/<your>-mirror-init.ts \
146
+ # /usr/src/app/scripts/<your>-mirror-refresh.ts \
147
+ # /usr/src/app/scripts/<your>-mirror-verify.ts \
148
+ # /usr/src/app/scripts/_mirror-context.ts \
149
+ # ./scripts/
150
+ # RUN echo '{"compilerOptions":{"baseUrl":".","paths":{"@/*":["./dist/*"]}}}' > tsconfig.json
151
+
85
152
  # The 'oven/bun' image already provides a non-root user named 'bun'.
86
153
  # We will use this existing user for enhanced security.
87
154
 
88
155
  # Create and set permissions for the log directory, assigning ownership to the 'bun' user.
89
156
  RUN mkdir -p /var/log/noaa-spaceweather-mcp-server && chown -R bun:bun /var/log/noaa-spaceweather-mcp-server
90
157
 
158
+ # Writable data dirs for on-disk SQLite stores (catalog index / observations
159
+ # mirror), owned by the runtime user. Mount a volume over either in production.
160
+ RUN mkdir -p /usr/src/app/.cache /usr/src/app/.mirror \
161
+ && chown -R bun:bun /usr/src/app/.cache /usr/src/app/.mirror
162
+
91
163
  # Switch to the non-root user
92
164
  USER bun
93
165
 
@@ -103,11 +175,11 @@ ENV MCP_TRANSPORT_TYPE="http"
103
175
  ENV MCP_SESSION_MODE="stateless"
104
176
  ENV MCP_LOG_LEVEL="info"
105
177
  ENV LOGS_DIR="/var/log/noaa-spaceweather-mcp-server"
106
- ENV MCP_FORCE_CONSOLE_LOGGING="true"
107
178
 
108
179
  # Expose the port the server listens on
109
180
  EXPOSE ${MCP_HTTP_PORT}
110
181
 
182
+ # Health check using a bun-native fetch (slim image ships no curl/wget)
111
183
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 CMD bun -e "fetch('http://localhost:'+(process.env.MCP_HTTP_PORT??'3010')+'/healthz').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
112
184
 
113
185
  # The command to start the server
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div align="center">
9
9
 
10
- [![Version](https://img.shields.io/badge/Version-0.3.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/noaa-spaceweather-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/noaa-spaceweather-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/noaa-spaceweather-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.0-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.3.2-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/noaa-spaceweather-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.2.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/noaa-spaceweather-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/noaa-spaceweather-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.2-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -46,70 +46,47 @@ Space weather from NOAA's Space Weather Prediction Center (SWPC) — geomagnetic
46
46
 
47
47
  ### `noaa_spaceweather_get_conditions` <sub>tool</sub>
48
48
 
49
- - `include_discussion` (bool, default false) is the only input — otherwise a single call composing storm scales and current Kp into one snapshot
50
- - Returns today's observed R/S/G storm levels plus SWPC's 3-day forecast series, which starts with today
51
- - `yesterday` carries the R/S/G levels SWPC assessed for the previous UTC day, with its date and no time — the feed states only when it was generated. Null when the feed carries no previous-day period
52
- - Forecast days carry what SWPC issues: a G level, and for R and S a probability — R1–R2, R3 or greater, S1 or greater — with no level. A null level means SWPC forecasts none for that day, which is not the same as level 0
53
- - Current Kp with G-scale equivalent and aurora-visibility latitude guidance
49
+ - `include_discussion` (bool, default false) is the only input; one call composes the `noaa-scales.json` and `noaa-planetary-k-index.json` feeds, plus the `discussion.txt` product when the discussion is requested
50
+ - Returns current Kp with its G-scale equivalent and aurora-latitude guidance, today's observed R/S/G levels, `yesterday` (the previous UTC day's assessed levels, null when the feed carries none), and SWPC's 3-day forecast starting today — forecast R and S carry probabilities rather than levels, and a null level means none was forecast, not level 0
54
51
  - With `include_discussion`, the forecaster-written Forecast Discussion split into its topic sections (Solar Activity, Energetic Particle, Solar Wind, Geospace), each with its 24-hour summary and 3-day forecast text
55
- - Data sourced from the `noaa-scales.json` + `noaa-planetary-k-index.json` feeds, plus the `discussion.txt` product when the discussion is requested
56
52
 
57
53
  ---
58
54
 
59
55
  ### `noaa_spaceweather_get_kp_index` <sub>tool</sub>
60
56
 
61
- - `window_days` (1–7, default 1) bounds the observed series; the forecast series is always SWPC's full 3-day forecast
62
- - Each observed/forecast record carries Kp, G-scale equivalent, G-scale label, and aurora-latitude guidance
63
- - G levels follow SWPC's minus-third band floors — G1 starts at Kp 4.67 (5−), G4 runs through 8.67 (9−), and only Kp 9 is G5
64
- - Forecast excludes the feed's embedded historical "observed" entries — only forward-looking `estimated`/`predicted` rows
65
- - `observedCount` reports how many observed readings matched the window
57
+ - `window_days` (1–7, default 1) bounds the observed series, and `observedCount` reports how many readings matched; the forecast is always SWPC's full 3-day series of forward-looking `estimated`/`predicted` rows
58
+ - Each record carries Kp, its G level and label, and aurora-latitude guidance. G levels follow SWPC's minus-third band floors — G1 starts at Kp 4.67 (5−), and only Kp 9 is G5
66
59
 
67
60
  ---
68
61
 
69
62
  ### `noaa_spaceweather_get_aurora_forecast` <sub>tool</sub>
70
63
 
71
- - Without coordinates: global metadata only — grid point count, global peak probability, peak region
72
- - With `latitude`/`longitude` (WGS84, required together): nearest 1°-grid lookup, the centered-dipole geomagnetic latitude those coordinates convert to, the minimum Kp and G level needed at that geomagnetic latitude, and a plain-language go/no-go verdict
73
- - Darkness gating: the sun's elevation at the coordinates at the forecast time (`sunElevationDeg`) and the sky state it implies (`darkness`: `day`, `civil_twilight`, `nautical_twilight`, `dark`). In daylight the verdict reports aurora as not visible whatever the model probability; in twilight it adds that only bright aurora will show
74
- - Horizon view: the strongest reading within 1000 km poleward and ±2° longitude (`horizonMaxPercent`, `horizonMaxLatitude`, `horizonDistanceKm`). When it reaches 10% and beats the overhead reading outside daylight, the verdict adds that aurora may be visible low on the poleward horizon
75
- - `invalid_coordinates` error when only one of the pair is supplied
76
- - OVATION model updates every ~5 minutes; forecast horizon is ~30–60 minutes ahead
64
+ - `latitude`/`longitude` (WGS84) are optional but required together — one alone fails `invalid_coordinates`. Without them the call returns global metadata only: grid point count, global peak probability, and peak region
65
+ - With coordinates, `localLookup` carries the nearest 1°-grid probability, the geomagnetic latitude, the minimum Kp and G level needed there, the sun's elevation and `darkness` state (`day`, `civil_twilight`, `nautical_twilight`, `dark`) at the forecast time, the strongest reading within 1000 km poleward (`horizonMaxPercent`, `horizonMaxLatitude`, `horizonDistanceKm`), and a go/no-go `verdict` — not visible in daylight, whatever the model probability
66
+ - The OVATION model updates every ~5 minutes and forecasts ~30–60 minutes ahead
77
67
 
78
68
  ---
79
69
 
80
70
  ### `noaa_spaceweather_get_solar_wind` <sub>tool</sub>
81
71
 
82
- - `window_hours` (1–168, default 3) slices client-side from a feed that carries roughly the last 24 hours at ~1-minute cadence
83
- - `resolution` (`summary`, `reduced` default, or `full`) sets the series detail. `reduced` bounds each returned series to 200 records: the window is bucketed by record count and one real measurement is emitted per bucket — the bucket's fastest speed for plasma, its most southward Bz for mag — with the newest record in the window always last. A series already inside the bound comes back untouched, so a default 3-hour call is unaffected; `full` returns every record (~1,400 per series over 24 hours); `summary` returns both series empty and keeps every headline field, about 2 KB whatever the window
84
- - Plasma (speed, density, temperature) and magnetic field (Bx/By/Bz/Bt GSM) returned as separate oldest-first series
85
- - `bzStatus` surfaces southward Bz (the storm driver) as a plain-language field, and `bzMinInWindow` with its time tag reports the window's most southward reading
86
- - Window statistics: `speedMaxInWindow` with its time tag, `densityMaxInWindow`, `btMaxInWindow`, and `bzSouthMinutesInWindow` — the count of 1-minute records with Bz below 0, so a gap in the feed adds nothing. Every headline field is computed from the full window, before any reduction, at every resolution
72
+ - `window_hours` (1–168, default 3) slices a feed that carries roughly the last 24 hours at ~1-minute cadence. `resolution` sets series detail: `reduced` (default) caps each series at 200 records, keeping each bucket's fastest speed and most southward Bz; `full` returns every record (~1,400 per series over 24 hours); `summary` returns empty series and every headline field, about 2 KB
73
+ - Returns oldest-first plasma (speed, density, temperature) and magnetic-field (Bx/By/Bz/Bt GSM) series, each record naming its spacecraft, plus headline fields computed over the full window at every resolution: `bzStatus`, `bzMinInWindow`, `speedMaxInWindow`, `densityMaxInWindow`, `btMaxInWindow`, and `bzSouthMinutesInWindow`
87
74
  - `latestFeedPlasmaTime`/`latestFeedMagTime`/`feedStalenessHours` distinguish an empty window from a stale feed
88
- - Every record names its reporting spacecraft — no satellite is assumed as "the" active one
89
75
 
90
76
  ---
91
77
 
92
78
  ### `noaa_spaceweather_get_solar_activity` <sub>tool</sub>
93
79
 
94
- - `include_regions` (default true) toggles per-region active-solar-region detail to control response size
95
- - `flare_hours` (1–168, default 24) bounds the discrete flare events returned, filtered on each flare's onset; the feed keeps a rolling 7 days, so 168 returns everything it carries
96
- - Flare events come with the classes SWPC publishes — onset, peak, and decay, each with magnitude — the peak flux, and the NOAA R-scale level (0–5) that flux implies. Decay time and class are null while a flare is still in progress, and an empty window names the newest flare the feed holds
97
- - GOES X-ray flux (0.1–0.8 nm) with flare-class letter (A/B/C/M/X), the class with magnitude (`flareClassFull`, derived by SWPC's truncation rule so it agrees with the published flare classes), and the unformatted flux alongside the display string; recent readings cover the past hour
98
- - Daily F10.7 cm solar radio flux in sfu with its 90-day mean, from the Noon Penticton report — the value SWPC reports for the day. It can be up to ~24 h old, so its observation time rides with it
99
- - 3-day C/M/X flare-class and proton-event probabilities under date-neutral names (`cClassProbability`, `mClassProbability`, `xClassProbability`, `protonEventProbability`); the deprecated `*1Day` names still carry the same values in `structuredContent`
100
- - Each active region carries the C/M/X flare counts SWPC attributed to it on its observation day — the flare events carry no region, so these name the region driving current activity — its sunspot area in millionths of the hemisphere, and when SWPC first recorded it. Its flare probabilities cover the following day. A spotless region (plage) reads as such, with a null area
101
- - Integral proton flux (≥10 MeV) drives the reported NOAA S-scale (0–5)
102
- - Data sourced from the `goes/primary/xrays-6-hour.json`, `goes/primary/xray-flares-7-day.json`, `f107_cm_flux.json`, `solar_probabilities.json`, `goes/primary/integral-protons-plot-3-day.json`, and `solar_regions.json` feeds
80
+ - `flare_hours` (1–168, default 24) bounds the flare events returned by onset over the feed's rolling 7 days; `include_regions` (default true) toggles per-region detail to control response size
81
+ - Returns discrete flare events with onset, peak, and decay classes, peak flux, and the NOAA R level (0–5) it implies (decay is null while a flare is in progress; peak fields are null when SWPC recorded no peak); GOES X-ray flux with its flare class (`flareClassFull`); the daily F10.7 cm radio flux with its observation time; 3-day C/M/X flare and proton-event probabilities (`cClassProbability`, `mClassProbability`, `xClassProbability`, `protonEventProbability` — the deprecated `*1Day` names still carry them in `structuredContent`); and the S level from ≥10 MeV proton flux
82
+ - With `include_regions`, each active region's sunspot area, the C/M/X flare counts SWPC attributed to it on its observation day, and its next-day flare probabilities
103
83
 
104
84
  ---
105
85
 
106
86
  ### `noaa_spaceweather_get_alerts` <sub>tool</sub>
107
87
 
108
- - `active_only` (default true) — in-force Warnings/Watches/Alerts only. A product stays in force until the feed says otherwise, so this also drops any product a later cancellation names by serial, and all but the newest Watch carrying `THIS SUPERSEDES ANY/ALL PRIOR WATCHES IN EFFECT` — alongside cancellations, Summaries, and products whose validity end has passed
109
- - `max_age_hours` (1–720, default 48) bounds how far back to look for candidates; the SWPC feed itself has no expiry. Under `active_only=true` it does not cut off a product whose validity end is still ahead, so a multi-day Watch survives until the last day it forecasts a storm for ends; under `active_only=false` it is a literal age cutoff
110
- - Each record carries product type, NOAA scale + level (0 means "no scale stated," not zero severity), serial number, parsed validity window, and full message text
111
- - `cancelled` flags a record that cancels a prior product rather than being active; the product it cancels is a separate record, excluded by the serial link rather than by this flag
112
- - Under `active_only=true` the response echoes the applied window and counts what it excluded, by reason — so an empty result reads as "quiet" or "everything was filtered" without a second call
88
+ - `active_only` (default true) keeps in-force Warnings/Watches/Alerts, dropping cancelled and superseded products, Summaries, and products whose validity has ended. `max_age_hours` (1–720, default 48) bounds how far back candidates reach — under `active_only` a product whose validity end is still ahead survives it; otherwise it is a literal age cutoff
89
+ - Each record carries product type, NOAA scale and level (0 means "no scale stated," not zero severity), serial number, parsed validity window, `cancelled`, and full message text. Under `active_only` the response also counts what it excluded, by reason, so an empty result reads as "quiet" or "everything was filtered"
113
90
 
114
91
  ---
115
92
 
@@ -216,7 +193,7 @@ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
216
193
 
217
194
  ### Prerequisites
218
195
 
219
- - [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).
196
+ - [Bun v1.4.0](https://bun.sh/) or higher (or Node.js v24+).
220
197
  - No API keys required — all SWPC feeds are public.
221
198
 
222
199
  ### Installation
@@ -260,6 +237,7 @@ cp .env.example .env
260
237
  | `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
261
238
  | `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |
262
239
  | `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |
240
+ | `LOG_TOOL_FAILURE_PAYLOADS` | Log each failed tool call's arguments and result, redacted by key name and capped at `LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES` (default `16384`). A secret inside a free-form value is not redacted. | `false` |
263
241
  | `STORAGE_PROVIDER_TYPE` | Storage backend. | `in-memory` |
264
242
  | `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
265
243