@cyanheads/noaa-marine-mcp-server 0.3.0 → 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 +71 -49
- package/CLAUDE.md +71 -49
- package/Dockerfile +10 -5
- package/LICENSE +1 -1
- package/README.md +75 -81
- package/changelog/0.3.x/0.3.1.md +29 -0
- package/changelog/0.3.x/0.3.2.md +30 -0
- package/changelog/template.md +62 -40
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/noaa-marine-station.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/noaa-marine-station.resource.js +1 -0
- package/dist/mcp-server/resources/definitions/noaa-marine-station.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-find-stations.tool.d.ts +23 -23
- package/dist/mcp-server/tools/definitions/noaa-marine-get-conditions.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-conditions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-current-profile.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-current-profile.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-currents.tool.d.ts +2 -2
- package/dist/mcp-server/tools/definitions/noaa-marine-get-currents.tool.js +2 -2
- package/dist/mcp-server/tools/definitions/noaa-marine-get-currents.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-ocean-observations.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-ocean-observations.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-tide-predictions.tool.d.ts +5 -5
- package/dist/mcp-server/tools/definitions/noaa-marine-get-tide-predictions.tool.js +2 -2
- package/dist/mcp-server/tools/definitions/noaa-marine-get-tide-predictions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/noaa-marine-get-water-level.tool.d.ts +5 -5
- package/dist/mcp-server/tools/definitions/noaa-marine-get-water-level.tool.js +2 -2
- package/dist/mcp-server/tools/definitions/noaa-marine-get-water-level.tool.js.map +1 -1
- package/dist/services/coops/coops-service.d.ts.map +1 -1
- package/dist/services/coops/coops-service.js.map +1 -1
- package/dist/services/ndbc/ndbc-service.d.ts.map +1 -1
- package/dist/services/ndbc/ndbc-service.js +3 -1
- package/dist/services/ndbc/ndbc-service.js.map +1 -1
- package/package.json +12 -11
- package/server.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** noaa-marine-mcp-server
|
|
4
|
-
**Version:** 0.3.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/
|
|
8
|
-
**Zod:** ^4.4
|
|
4
|
+
**Version:** 0.3.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.2`
|
|
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-*)
|
|
8
|
+
**Zod:** ^4.6.4
|
|
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.
|
|
11
11
|
|
|
@@ -35,8 +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
|
-
- **
|
|
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.
|
|
39
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.
|
|
40
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.
|
|
41
42
|
|
|
42
43
|
---
|
|
@@ -104,6 +105,7 @@ export const noaaMarineStationResource = resource('noaa-marine://station/{statio
|
|
|
104
105
|
name: 'noaa_marine_station',
|
|
105
106
|
description: 'Metadata for a CO-OPS or NDBC station by ID: name, coordinates, source, capabilities, and state.',
|
|
106
107
|
mimeType: 'application/json',
|
|
108
|
+
cacheHint: { ttlMs: 21_600_000, cacheScope: 'public' },
|
|
107
109
|
params: z.object({
|
|
108
110
|
station_id: z.string().describe('CO-OPS numeric/alphanumeric ID or 5-char NDBC buoy ID.'),
|
|
109
111
|
}),
|
|
@@ -142,9 +144,15 @@ export function getServerConfig() {
|
|
|
142
144
|
|
|
143
145
|
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`NOAA_APPLICATION_ID`) not the path (`applicationId`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
144
146
|
|
|
145
|
-
### Server instructions
|
|
147
|
+
### Server identity and instructions
|
|
146
148
|
|
|
147
|
-
`createApp(
|
|
149
|
+
This server's `createApp()` identity is the bare repository name in both `name` and `title`: `noaa-marine-mcp-server`. Never add `description` or `websiteUrl` — the framework derives canonical metadata from `package.json`, and a copy in `createApp()` is drift. `instructions` is optional server-level orientation sent to clients on every `initialize`; use it for deployment guidance and cross-tool workflows instead of repeating the same context across tool descriptions.
|
|
150
|
+
|
|
151
|
+
### Session posture and shutdown
|
|
152
|
+
|
|
153
|
+
`createApp({ sessionMode: 'stateless' })` declares the HTTP session posture in `src/` rather than leaving it to a deployment's `MCP_SESSION_MODE`, which still wins whenever it carries a meaningful value (an empty string and an unsubstituted `${…}` placeholder read as unset and fall through to the option). Stateless is correct here: no tool gates on `ctx.requestInput`. A server that does gain one declares `{ default: 'stateful', require: 'stateful' }` so startup fails with a `ConfigurationError` instead of serving a mode a 2025-era HTTP client can never answer in. Stdio is never refused.
|
|
154
|
+
|
|
155
|
+
`teardown(core)` is the `setup()` counterpart — it releases a watcher, socket, or non-`unref()`'d timer after the transport stops and before the logger closes. Neither service here allocates one (both hold an in-memory station cache and nothing else), so the hook is unused; add it the moment a service acquires a handle it must close. `SIGTERM`/`SIGINT` exit the process explicitly once shutdown settles.
|
|
148
156
|
|
|
149
157
|
---
|
|
150
158
|
|
|
@@ -154,14 +162,15 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
154
162
|
|
|
155
163
|
| Property | Description |
|
|
156
164
|
|:---------|:------------|
|
|
157
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
158
|
-
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
159
|
-
| `ctx.
|
|
160
|
-
| `ctx.
|
|
165
|
+
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino and `notifications/message`, so treat it as client-visible. |
|
|
166
|
+
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
167
|
+
| `ctx.requestInput` | Suspend and ask the caller for more input. Return it; never await it. Always present, though this server currently has no call sites. |
|
|
168
|
+
| `ctx.inputs` | Reader over a retried request's responses. Empty on the first round. |
|
|
169
|
+
| `ctx.enrich` | Success-path agent context that reaches both `structuredContent` and `content[]` when the definition declares `enrichment`. |
|
|
170
|
+
| `ctx.content` | Non-text image/audio content blocks prepended to `content[]`; never enters `structuredContent`. |
|
|
161
171
|
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
162
|
-
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
163
172
|
| `ctx.requestId` | Unique request ID. |
|
|
164
|
-
| `ctx.tenantId` | Tenant ID from JWT
|
|
173
|
+
| `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
|
|
165
174
|
|
|
166
175
|
---
|
|
167
176
|
|
|
@@ -169,7 +178,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
169
178
|
|
|
170
179
|
Handlers throw — the framework catches, classifies, and formats.
|
|
171
180
|
|
|
172
|
-
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` 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
|
|
181
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` 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, and the 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); override with an explicit hint when runtime context matters. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
173
182
|
|
|
174
183
|
```ts
|
|
175
184
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
@@ -181,7 +190,7 @@ errors: [
|
|
|
181
190
|
],
|
|
182
191
|
async handler(input, ctx) {
|
|
183
192
|
const item = await db.find(input.id);
|
|
184
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
193
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
|
|
185
194
|
return item;
|
|
186
195
|
}
|
|
187
196
|
```
|
|
@@ -230,6 +239,8 @@ src/
|
|
|
230
239
|
noaa-marine-get-water-level.tool.ts # noaa_marine_get_water_level
|
|
231
240
|
noaa-marine-get-currents.tool.ts # noaa_marine_get_currents
|
|
232
241
|
noaa-marine-get-conditions.tool.ts # noaa_marine_get_conditions
|
|
242
|
+
noaa-marine-get-current-profile.tool.ts # noaa_marine_get_current_profile
|
|
243
|
+
noaa-marine-get-ocean-observations.tool.ts # noaa_marine_get_ocean_observations
|
|
233
244
|
resources/definitions/
|
|
234
245
|
noaa-marine-station.resource.ts # noaa-marine://station/{station_id}
|
|
235
246
|
```
|
|
@@ -249,9 +260,9 @@ src/
|
|
|
249
260
|
|
|
250
261
|
## Skills
|
|
251
262
|
|
|
252
|
-
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
263
|
+
Skills are modular instructions in `framework-skills/` at the project root. Read them directly when a task matches — e.g., `framework-skills/add-tool/SKILL.md` when adding a tool. `bun run list-skills` prints the full registry. The directory is deliberately not `skills/`: Claude Code and Codex auto-load a plugin's root `skills/`, so a server that ships `.claude-plugin/` or `.codex-plugin/` would hand these development skills to every agent that installs it. Keep `skills/` free for skills meant for those agents.
|
|
253
264
|
|
|
254
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
265
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `framework-skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
255
266
|
|
|
256
267
|
Available skills:
|
|
257
268
|
|
|
@@ -270,27 +281,28 @@ Available skills:
|
|
|
270
281
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
271
282
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
272
283
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
273
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
274
|
-
| `release-
|
|
284
|
+
| `git-wrapup` | Land working-tree changes as a commit stack — version bump, changelog, verify, commit by concern, release commit on top. No tag, no push to main; opens the release PR when the project declares release PR mode |
|
|
285
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixup commits autosquashed into the stack, PR body kept in sync. Release PR mode only |
|
|
286
|
+
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
275
287
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
276
288
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
277
289
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
278
290
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
291
|
+
| `techniques` | Catalog of response/data-shaping techniques — overflow handling, payload shaping, retrieval patterns |
|
|
279
292
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
280
293
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
281
294
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
282
|
-
| `api-context` | Context interface, logger, state,
|
|
295
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
283
296
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
284
297
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
285
298
|
| `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
|
|
286
299
|
| `api-services` | LLM, Speech, Graph services |
|
|
287
|
-
| `api-testing` | createMockContext,
|
|
288
|
-
| `techniques` | Reusable response/data-shaping patterns (outline-on-overflow, etc.) |
|
|
300
|
+
| `api-testing` | createMockContext, test patterns |
|
|
289
301
|
| `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
|
|
290
302
|
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
291
303
|
| `api-workers` | Cloudflare Workers runtime |
|
|
292
304
|
|
|
293
|
-
**Chaining skills into pipelines.** When the user wants a multi-phase effort — build this server out, QA-and-fix the surface, update-and-ship — *and you can spawn sub-agents*, `skills/orchestrations/SKILL.md` sequences the task skills above into a gated pipeline with verification at each step. Read it to drive the run. Optional: skip it if you can't orchestrate sub-agents, and ignore it entirely if you were *spawned* as one — you've already been scoped to a single phase.
|
|
305
|
+
**Chaining skills into pipelines.** When the user wants a multi-phase effort — build this server out, QA-and-fix the surface, update-and-ship — *and you can spawn sub-agents*, `framework-skills/orchestrations/SKILL.md` sequences the task skills above into a gated pipeline with verification at each step. Read it to drive the run. Optional: skip it if you can't orchestrate sub-agents, and ignore it entirely if you were *spawned* as one — you've already been scoped to a single phase.
|
|
294
306
|
|
|
295
307
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
296
308
|
|
|
@@ -298,34 +310,38 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
298
310
|
|
|
299
311
|
## Commands
|
|
300
312
|
|
|
301
|
-
**Runtime:** Scripts use
|
|
313
|
+
**Runtime:** Scripts use Bun's native TypeScript execution — `bun run <cmd>` is the standard invocation. `npm run <cmd>` also works (npm delegates to Bun).
|
|
302
314
|
|
|
303
315
|
| Command | Purpose |
|
|
304
316
|
|:--------|:--------|
|
|
305
|
-
| `
|
|
306
|
-
| `
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `bun run audit:
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
| `
|
|
313
|
-
| `
|
|
314
|
-
| `
|
|
315
|
-
| `
|
|
316
|
-
| `
|
|
317
|
-
| `
|
|
318
|
-
| `
|
|
317
|
+
| `bun run build` | Compile TypeScript |
|
|
318
|
+
| `bun run rebuild` | Clean + build |
|
|
319
|
+
| `bun run clean` | Remove build artifacts |
|
|
320
|
+
| `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
321
|
+
| `bun run audit:fix` | `bun audit fix` — upgrade vulnerable packages to the lowest safe version within existing ranges (`--dry-run` previews, `--latest` rewrites ranges). First response when `devcheck` flags a transitive advisory; then `bun update <name>`, then `bun dedupe` |
|
|
322
|
+
| `bun run audit:refresh` | Delete `bun.lock` and reinstall. Last resort after `audit:fix`, `bun update <name>`, and `bun dedupe` — re-resolves every ranged dep (the framework pin included) and rewrites the lockfile as `lockfileVersion: 2` |
|
|
323
|
+
| `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
|
|
324
|
+
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity, README version-badge parity (run by devcheck) |
|
|
325
|
+
| `bun run list-skills` | Print the skill registry |
|
|
326
|
+
| `bun run tree` | Generate directory structure doc |
|
|
327
|
+
| `bun run format` | Auto-fix formatting (safe fixes only) |
|
|
328
|
+
| `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior |
|
|
329
|
+
| `bun run test` | Run tests (Vitest — use `bun run test`, not `bun test`) |
|
|
330
|
+
| `bun run start:stdio` | Production mode (stdio) |
|
|
331
|
+
| `bun run start:http` | Production mode (HTTP) |
|
|
332
|
+
| `bun run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
|
|
333
|
+
| `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
334
|
+
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
319
335
|
|
|
320
336
|
---
|
|
321
337
|
|
|
322
338
|
## Bundling
|
|
323
339
|
|
|
324
|
-
`
|
|
340
|
+
`bun 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.
|
|
325
341
|
|
|
326
|
-
**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.
|
|
342
|
+
**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": ""`.
|
|
327
343
|
|
|
328
|
-
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
344
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `framework-skills/polish-docs-meta/references/readme.md`.
|
|
329
345
|
|
|
330
346
|
---
|
|
331
347
|
|
|
@@ -339,23 +355,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
339
355
|
---
|
|
340
356
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
341
357
|
breaking: false # optional — true flags breaking changes
|
|
342
|
-
security: false # optional — true
|
|
358
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
343
359
|
---
|
|
344
360
|
|
|
345
361
|
# 0.1.0 — YYYY-MM-DD
|
|
346
362
|
...
|
|
347
363
|
```
|
|
348
364
|
|
|
349
|
-
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section. When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
365
|
+
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section — set it only for a security fix in this server's *own source code*, never for a routine dependency or transitive CVE bump (record those under `## Dependencies`). When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
350
366
|
|
|
351
367
|
`agent-notes` is an optional free-form field for maintenance agents processing the release downstream. Content here won't appear in the rendered CHANGELOG — it's consumed by agents running the `maintenance` skill. Use it for adoption instructions that don't fit the human-facing sections: new files to create, fields to populate, one-time migration steps. Omit entirely when there's nothing to say.
|
|
352
368
|
|
|
353
|
-
**Section order
|
|
369
|
+
**Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Include only sections with entries — don't ship empty headers.
|
|
354
370
|
|
|
355
371
|
**Tag annotations** render as GitHub Release bodies via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject omits the version number (GitHub prepends it). See `changelog/template.md` for the full format reference.
|
|
356
372
|
|
|
357
373
|
---
|
|
358
374
|
|
|
375
|
+
## Publishing
|
|
376
|
+
|
|
377
|
+
**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.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
359
381
|
## Imports
|
|
360
382
|
|
|
361
383
|
```ts
|
|
@@ -382,7 +404,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
382
404
|
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
383
405
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
384
406
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
385
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
386
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
387
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
388
|
-
- [ ] `
|
|
407
|
+
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = the unscoped repo name (never the npm scope — `lint:packaging` enforces this); `interface.shortDescription` from `package.json` description
|
|
408
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key is the unscoped repo name; every user-supplied variable (API key, contact email, instance URL) is listed in `env_vars` so Codex forwards it from the user's environment. Never write `"KEY": ""` into `env` — an empty value replaces the user's exported key and is read as unset
|
|
409
|
+
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `author`, `repository`, `license`, `keywords` from `package.json`; inline `mcpServers` entry keyed by the unscoped repo name. Every user-supplied variable is declared under `userConfig` (`type`, `title`, `description`; `sensitive: true` for keys and tokens; `required: true` or `default: ""`) and referenced from `env` as `"KEY": "${user_config.<option>}"` — mirror the `user_config` block in `manifest.json`. Never write `"KEY": ""` into `env`
|
|
410
|
+
- [ ] `bun run devcheck` passes
|
package/CLAUDE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** noaa-marine-mcp-server
|
|
4
|
-
**Version:** 0.3.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/
|
|
8
|
-
**Zod:** ^4.4
|
|
4
|
+
**Version:** 0.3.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.2`
|
|
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-*)
|
|
8
|
+
**Zod:** ^4.6.4
|
|
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.
|
|
11
11
|
|
|
@@ -35,8 +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
|
-
- **
|
|
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.
|
|
39
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.
|
|
40
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.
|
|
41
42
|
|
|
42
43
|
---
|
|
@@ -104,6 +105,7 @@ export const noaaMarineStationResource = resource('noaa-marine://station/{statio
|
|
|
104
105
|
name: 'noaa_marine_station',
|
|
105
106
|
description: 'Metadata for a CO-OPS or NDBC station by ID: name, coordinates, source, capabilities, and state.',
|
|
106
107
|
mimeType: 'application/json',
|
|
108
|
+
cacheHint: { ttlMs: 21_600_000, cacheScope: 'public' },
|
|
107
109
|
params: z.object({
|
|
108
110
|
station_id: z.string().describe('CO-OPS numeric/alphanumeric ID or 5-char NDBC buoy ID.'),
|
|
109
111
|
}),
|
|
@@ -142,9 +144,15 @@ export function getServerConfig() {
|
|
|
142
144
|
|
|
143
145
|
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`NOAA_APPLICATION_ID`) not the path (`applicationId`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
144
146
|
|
|
145
|
-
### Server instructions
|
|
147
|
+
### Server identity and instructions
|
|
146
148
|
|
|
147
|
-
`createApp(
|
|
149
|
+
This server's `createApp()` identity is the bare repository name in both `name` and `title`: `noaa-marine-mcp-server`. Never add `description` or `websiteUrl` — the framework derives canonical metadata from `package.json`, and a copy in `createApp()` is drift. `instructions` is optional server-level orientation sent to clients on every `initialize`; use it for deployment guidance and cross-tool workflows instead of repeating the same context across tool descriptions.
|
|
150
|
+
|
|
151
|
+
### Session posture and shutdown
|
|
152
|
+
|
|
153
|
+
`createApp({ sessionMode: 'stateless' })` declares the HTTP session posture in `src/` rather than leaving it to a deployment's `MCP_SESSION_MODE`, which still wins whenever it carries a meaningful value (an empty string and an unsubstituted `${…}` placeholder read as unset and fall through to the option). Stateless is correct here: no tool gates on `ctx.requestInput`. A server that does gain one declares `{ default: 'stateful', require: 'stateful' }` so startup fails with a `ConfigurationError` instead of serving a mode a 2025-era HTTP client can never answer in. Stdio is never refused.
|
|
154
|
+
|
|
155
|
+
`teardown(core)` is the `setup()` counterpart — it releases a watcher, socket, or non-`unref()`'d timer after the transport stops and before the logger closes. Neither service here allocates one (both hold an in-memory station cache and nothing else), so the hook is unused; add it the moment a service acquires a handle it must close. `SIGTERM`/`SIGINT` exit the process explicitly once shutdown settles.
|
|
148
156
|
|
|
149
157
|
---
|
|
150
158
|
|
|
@@ -154,14 +162,15 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
154
162
|
|
|
155
163
|
| Property | Description |
|
|
156
164
|
|:---------|:------------|
|
|
157
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
158
|
-
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
159
|
-
| `ctx.
|
|
160
|
-
| `ctx.
|
|
165
|
+
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino and `notifications/message`, so treat it as client-visible. |
|
|
166
|
+
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
167
|
+
| `ctx.requestInput` | Suspend and ask the caller for more input. Return it; never await it. Always present, though this server currently has no call sites. |
|
|
168
|
+
| `ctx.inputs` | Reader over a retried request's responses. Empty on the first round. |
|
|
169
|
+
| `ctx.enrich` | Success-path agent context that reaches both `structuredContent` and `content[]` when the definition declares `enrichment`. |
|
|
170
|
+
| `ctx.content` | Non-text image/audio content blocks prepended to `content[]`; never enters `structuredContent`. |
|
|
161
171
|
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
162
|
-
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
163
172
|
| `ctx.requestId` | Unique request ID. |
|
|
164
|
-
| `ctx.tenantId` | Tenant ID from JWT
|
|
173
|
+
| `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
|
|
165
174
|
|
|
166
175
|
---
|
|
167
176
|
|
|
@@ -169,7 +178,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
169
178
|
|
|
170
179
|
Handlers throw — the framework catches, classifies, and formats.
|
|
171
180
|
|
|
172
|
-
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` 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
|
|
181
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` 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, and the 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); override with an explicit hint when runtime context matters. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
173
182
|
|
|
174
183
|
```ts
|
|
175
184
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
@@ -181,7 +190,7 @@ errors: [
|
|
|
181
190
|
],
|
|
182
191
|
async handler(input, ctx) {
|
|
183
192
|
const item = await db.find(input.id);
|
|
184
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
193
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
|
|
185
194
|
return item;
|
|
186
195
|
}
|
|
187
196
|
```
|
|
@@ -230,6 +239,8 @@ src/
|
|
|
230
239
|
noaa-marine-get-water-level.tool.ts # noaa_marine_get_water_level
|
|
231
240
|
noaa-marine-get-currents.tool.ts # noaa_marine_get_currents
|
|
232
241
|
noaa-marine-get-conditions.tool.ts # noaa_marine_get_conditions
|
|
242
|
+
noaa-marine-get-current-profile.tool.ts # noaa_marine_get_current_profile
|
|
243
|
+
noaa-marine-get-ocean-observations.tool.ts # noaa_marine_get_ocean_observations
|
|
233
244
|
resources/definitions/
|
|
234
245
|
noaa-marine-station.resource.ts # noaa-marine://station/{station_id}
|
|
235
246
|
```
|
|
@@ -249,9 +260,9 @@ src/
|
|
|
249
260
|
|
|
250
261
|
## Skills
|
|
251
262
|
|
|
252
|
-
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
263
|
+
Skills are modular instructions in `framework-skills/` at the project root. Read them directly when a task matches — e.g., `framework-skills/add-tool/SKILL.md` when adding a tool. `bun run list-skills` prints the full registry. The directory is deliberately not `skills/`: Claude Code and Codex auto-load a plugin's root `skills/`, so a server that ships `.claude-plugin/` or `.codex-plugin/` would hand these development skills to every agent that installs it. Keep `skills/` free for skills meant for those agents.
|
|
253
264
|
|
|
254
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
265
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `framework-skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
255
266
|
|
|
256
267
|
Available skills:
|
|
257
268
|
|
|
@@ -270,27 +281,28 @@ Available skills:
|
|
|
270
281
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
271
282
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
272
283
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
273
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
274
|
-
| `release-
|
|
284
|
+
| `git-wrapup` | Land working-tree changes as a commit stack — version bump, changelog, verify, commit by concern, release commit on top. No tag, no push to main; opens the release PR when the project declares release PR mode |
|
|
285
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixup commits autosquashed into the stack, PR body kept in sync. Release PR mode only |
|
|
286
|
+
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
275
287
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
276
288
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
277
289
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
278
290
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
291
|
+
| `techniques` | Catalog of response/data-shaping techniques — overflow handling, payload shaping, retrieval patterns |
|
|
279
292
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
280
293
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
281
294
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
282
|
-
| `api-context` | Context interface, logger, state,
|
|
295
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
283
296
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
284
297
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
285
298
|
| `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
|
|
286
299
|
| `api-services` | LLM, Speech, Graph services |
|
|
287
|
-
| `api-testing` | createMockContext,
|
|
288
|
-
| `techniques` | Reusable response/data-shaping patterns (outline-on-overflow, etc.) |
|
|
300
|
+
| `api-testing` | createMockContext, test patterns |
|
|
289
301
|
| `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
|
|
290
302
|
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
291
303
|
| `api-workers` | Cloudflare Workers runtime |
|
|
292
304
|
|
|
293
|
-
**Chaining skills into pipelines.** When the user wants a multi-phase effort — build this server out, QA-and-fix the surface, update-and-ship — *and you can spawn sub-agents*, `skills/orchestrations/SKILL.md` sequences the task skills above into a gated pipeline with verification at each step. Read it to drive the run. Optional: skip it if you can't orchestrate sub-agents, and ignore it entirely if you were *spawned* as one — you've already been scoped to a single phase.
|
|
305
|
+
**Chaining skills into pipelines.** When the user wants a multi-phase effort — build this server out, QA-and-fix the surface, update-and-ship — *and you can spawn sub-agents*, `framework-skills/orchestrations/SKILL.md` sequences the task skills above into a gated pipeline with verification at each step. Read it to drive the run. Optional: skip it if you can't orchestrate sub-agents, and ignore it entirely if you were *spawned* as one — you've already been scoped to a single phase.
|
|
294
306
|
|
|
295
307
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
296
308
|
|
|
@@ -298,34 +310,38 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
298
310
|
|
|
299
311
|
## Commands
|
|
300
312
|
|
|
301
|
-
**Runtime:** Scripts use
|
|
313
|
+
**Runtime:** Scripts use Bun's native TypeScript execution — `bun run <cmd>` is the standard invocation. `npm run <cmd>` also works (npm delegates to Bun).
|
|
302
314
|
|
|
303
315
|
| Command | Purpose |
|
|
304
316
|
|:--------|:--------|
|
|
305
|
-
| `
|
|
306
|
-
| `
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `bun run audit:
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
| `
|
|
313
|
-
| `
|
|
314
|
-
| `
|
|
315
|
-
| `
|
|
316
|
-
| `
|
|
317
|
-
| `
|
|
318
|
-
| `
|
|
317
|
+
| `bun run build` | Compile TypeScript |
|
|
318
|
+
| `bun run rebuild` | Clean + build |
|
|
319
|
+
| `bun run clean` | Remove build artifacts |
|
|
320
|
+
| `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
321
|
+
| `bun run audit:fix` | `bun audit fix` — upgrade vulnerable packages to the lowest safe version within existing ranges (`--dry-run` previews, `--latest` rewrites ranges). First response when `devcheck` flags a transitive advisory; then `bun update <name>`, then `bun dedupe` |
|
|
322
|
+
| `bun run audit:refresh` | Delete `bun.lock` and reinstall. Last resort after `audit:fix`, `bun update <name>`, and `bun dedupe` — re-resolves every ranged dep (the framework pin included) and rewrites the lockfile as `lockfileVersion: 2` |
|
|
323
|
+
| `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
|
|
324
|
+
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity, README version-badge parity (run by devcheck) |
|
|
325
|
+
| `bun run list-skills` | Print the skill registry |
|
|
326
|
+
| `bun run tree` | Generate directory structure doc |
|
|
327
|
+
| `bun run format` | Auto-fix formatting (safe fixes only) |
|
|
328
|
+
| `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior |
|
|
329
|
+
| `bun run test` | Run tests (Vitest — use `bun run test`, not `bun test`) |
|
|
330
|
+
| `bun run start:stdio` | Production mode (stdio) |
|
|
331
|
+
| `bun run start:http` | Production mode (HTTP) |
|
|
332
|
+
| `bun run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
|
|
333
|
+
| `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
334
|
+
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
319
335
|
|
|
320
336
|
---
|
|
321
337
|
|
|
322
338
|
## Bundling
|
|
323
339
|
|
|
324
|
-
`
|
|
340
|
+
`bun 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.
|
|
325
341
|
|
|
326
|
-
**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.
|
|
342
|
+
**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": ""`.
|
|
327
343
|
|
|
328
|
-
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
344
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `framework-skills/polish-docs-meta/references/readme.md`.
|
|
329
345
|
|
|
330
346
|
---
|
|
331
347
|
|
|
@@ -339,23 +355,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
339
355
|
---
|
|
340
356
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
341
357
|
breaking: false # optional — true flags breaking changes
|
|
342
|
-
security: false # optional — true
|
|
358
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
343
359
|
---
|
|
344
360
|
|
|
345
361
|
# 0.1.0 — YYYY-MM-DD
|
|
346
362
|
...
|
|
347
363
|
```
|
|
348
364
|
|
|
349
|
-
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section. When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
365
|
+
`breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section — set it only for a security fix in this server's *own source code*, never for a routine dependency or transitive CVE bump (record those under `## Dependencies`). When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
350
366
|
|
|
351
367
|
`agent-notes` is an optional free-form field for maintenance agents processing the release downstream. Content here won't appear in the rendered CHANGELOG — it's consumed by agents running the `maintenance` skill. Use it for adoption instructions that don't fit the human-facing sections: new files to create, fields to populate, one-time migration steps. Omit entirely when there's nothing to say.
|
|
352
368
|
|
|
353
|
-
**Section order
|
|
369
|
+
**Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Include only sections with entries — don't ship empty headers.
|
|
354
370
|
|
|
355
371
|
**Tag annotations** render as GitHub Release bodies via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject omits the version number (GitHub prepends it). See `changelog/template.md` for the full format reference.
|
|
356
372
|
|
|
357
373
|
---
|
|
358
374
|
|
|
375
|
+
## Publishing
|
|
376
|
+
|
|
377
|
+
**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.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
359
381
|
## Imports
|
|
360
382
|
|
|
361
383
|
```ts
|
|
@@ -382,7 +404,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
382
404
|
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
383
405
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
384
406
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
385
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
386
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
387
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
388
|
-
- [ ] `
|
|
407
|
+
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = the unscoped repo name (never the npm scope — `lint:packaging` enforces this); `interface.shortDescription` from `package.json` description
|
|
408
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key is the unscoped repo name; every user-supplied variable (API key, contact email, instance URL) is listed in `env_vars` so Codex forwards it from the user's environment. Never write `"KEY": ""` into `env` — an empty value replaces the user's exported key and is read as unset
|
|
409
|
+
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `author`, `repository`, `license`, `keywords` from `package.json`; inline `mcpServers` entry keyed by the unscoped repo name. Every user-supplied variable is declared under `userConfig` (`type`, `title`, `description`; `sensitive: true` for keys and tokens; `required: true` or `default: ""`) and referenced from `env` as `"KEY": "${user_config.<option>}"` — mirror the `user_config` block in `manifest.json`. Never write `"KEY": ""` into `env`
|
|
410
|
+
- [ ] `bun run devcheck` passes
|
package/Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
FROM oven/bun:1.
|
|
7
|
+
FROM --platform=$BUILDPLATFORM oven/bun:1.4.0 AS build
|
|
8
8
|
|
|
9
9
|
WORKDIR /usr/src/app
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ RUN bun run build
|
|
|
30
30
|
# application. It uses a slim base image and only includes production
|
|
31
31
|
# dependencies and build artifacts.
|
|
32
32
|
# ==============================================================================
|
|
33
|
-
FROM oven/bun:1.
|
|
33
|
+
FROM oven/bun:1.4.0-slim AS production
|
|
34
34
|
|
|
35
35
|
WORKDIR /usr/src/app
|
|
36
36
|
|
|
@@ -51,8 +51,13 @@ COPY package.json bun.lock ./
|
|
|
51
51
|
|
|
52
52
|
# Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
|
|
53
53
|
# that are not needed in the final production image.
|
|
54
|
+
# `--omit=peer` drops the framework's optional peer tiers (test runner, service
|
|
55
|
+
# SDKs, parsers) that Bun would otherwise auto-install. Anything this server
|
|
56
|
+
# actually imports belongs in its own `dependencies`, so nothing needed at
|
|
57
|
+
# runtime is lost. The OTEL step below carries the same flag — without it, that
|
|
58
|
+
# install re-resolves the graph and pulls every optional peer back in.
|
|
54
59
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
55
|
-
bun install --production --frozen-lockfile --ignore-scripts
|
|
60
|
+
bun install --production --omit=peer --frozen-lockfile --ignore-scripts
|
|
56
61
|
|
|
57
62
|
# Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
|
|
58
63
|
# These are not bundled by default to keep the base image lean. Enable at build time
|
|
@@ -60,7 +65,7 @@ RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
|
60
65
|
ARG OTEL_ENABLED=true
|
|
61
66
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
62
67
|
if [ "$OTEL_ENABLED" = "true" ]; then \
|
|
63
|
-
bun add @hono/otel \
|
|
68
|
+
bun add --omit=dev --omit=peer --ignore-scripts @hono/otel \
|
|
64
69
|
@opentelemetry/instrumentation-http \
|
|
65
70
|
@opentelemetry/exporter-metrics-otlp-http \
|
|
66
71
|
@opentelemetry/exporter-trace-otlp-http \
|
|
@@ -101,7 +106,7 @@ ENV MCP_FORCE_CONSOLE_LOGGING="true"
|
|
|
101
106
|
# Expose the port the server listens on
|
|
102
107
|
EXPOSE ${MCP_HTTP_PORT}
|
|
103
108
|
|
|
104
|
-
# Health check
|
|
109
|
+
# Health check using a bun-native fetch (slim image ships no curl/wget)
|
|
105
110
|
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))"
|
|
106
111
|
|
|
107
112
|
# The command to start the server
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@ Apache License
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2026 Casey Hand @cyanheads
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|