@cyanheads/mcp-ts-core 0.6.9 → 0.6.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyanheads/mcp-ts-core",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "mcpName": "io.github.cyanheads/mcp-ts-core",
5
5
  "description": "Agent-native TypeScript framework for building MCP servers. Declarative definitions with auth, multi-backend storage, OpenTelemetry, and first-class support for Bun/Node/Cloudflare Workers.",
6
6
  "main": "dist/core/index.js",
@@ -146,7 +146,7 @@
146
146
  "audit:fix": "bun audit --fix",
147
147
  "changelog:build": "bun run scripts/build-changelog.ts",
148
148
  "changelog:check": "bun run scripts/build-changelog.ts --check",
149
- "publish-mcp": "bunx mcp-publisher publish"
149
+ "publish-mcp": "mcp-publisher login github -token \"$(security find-generic-password -a \"$USER\" -s mcp-publisher-github-pat -w)\" && mcp-publisher publish"
150
150
  },
151
151
  "resolutions": {
152
152
  "brace-expansion": "1.1.14",
@@ -159,19 +159,19 @@
159
159
  "yaml": "1.10.3"
160
160
  },
161
161
  "devDependencies": {
162
- "@biomejs/biome": "2.4.12",
163
- "@cloudflare/workers-types": "^4.20260422.1",
162
+ "@biomejs/biome": "2.4.13",
163
+ "@cloudflare/workers-types": "^4.20260423.1",
164
164
  "@hono/otel": "^1.1.1",
165
- "@opentelemetry/instrumentation-http": "^0.215.0",
166
165
  "@opentelemetry/exporter-metrics-otlp-http": "^0.215.0",
167
166
  "@opentelemetry/exporter-trace-otlp-http": "^0.215.0",
167
+ "@opentelemetry/instrumentation-http": "^0.215.0",
168
168
  "@opentelemetry/instrumentation-pino": "^0.61.0",
169
169
  "@opentelemetry/resources": "^2.7.0",
170
170
  "@opentelemetry/sdk-metrics": "^2.7.0",
171
171
  "@opentelemetry/sdk-node": "^0.215.0",
172
172
  "@opentelemetry/sdk-trace-node": "^2.7.0",
173
173
  "@opentelemetry/semantic-conventions": "^1.40.0",
174
- "@supabase/supabase-js": "^2.104.0",
174
+ "@supabase/supabase-js": "^2.104.1",
175
175
  "@types/bun": "^1.3.13",
176
176
  "@types/js-yaml": "^4.0.9",
177
177
  "@types/node": "^25.6.0",
@@ -183,26 +183,28 @@
183
183
  "bun-types": "^1.3.13",
184
184
  "chrono-node": "^2.9.0",
185
185
  "clipboardy": "^5.3.1",
186
+ "defuddle": "^0.18.1",
186
187
  "depcheck": "^1.4.7",
187
188
  "diff": "^9.0.0",
188
189
  "execa": "^9.6.1",
189
190
  "fast-check": "^4.7.0",
190
- "js-yaml": "^4.1.1",
191
191
  "ignore": "^7.0.5",
192
+ "js-yaml": "^4.1.1",
193
+ "linkedom": "^0.18.12",
192
194
  "node-cron": "^4.2.1",
193
195
  "openai": "^6.34.0",
194
196
  "papaparse": "^5.5.3",
195
197
  "partial-json": "^0.1.7",
196
198
  "pdf-lib": "^1.17.1",
197
199
  "pino-pretty": "^13.1.3",
198
- "sanitize-html": "^2.17.3",
199
200
  "repomix": "^1.13.1",
201
+ "sanitize-html": "^2.17.3",
200
202
  "tsc-alias": "^1.8.16",
201
203
  "typedoc": "^0.28.19",
202
204
  "typescript": "^6.0.3",
203
205
  "unpdf": "^1.6.0",
204
206
  "validator": "^13.15.35",
205
- "vite": "8.0.9",
207
+ "vite": "8.0.10",
206
208
  "vitest": "^4.1.5"
207
209
  },
208
210
  "keywords": [
@@ -278,9 +280,11 @@
278
280
  "@opentelemetry/semantic-conventions": "^1.40.0",
279
281
  "@supabase/supabase-js": "^2.103.3",
280
282
  "chrono-node": "^2.9.0",
283
+ "defuddle": "^0.18.1",
281
284
  "diff": "latest",
282
285
  "fast-xml-parser": "latest",
283
286
  "js-yaml": "^4.1.1",
287
+ "linkedom": "^0.18.12",
284
288
  "node-cron": "^4.2.1",
285
289
  "openai": "^6.34.0",
286
290
  "papaparse": "^5.5.3",
@@ -327,6 +331,9 @@
327
331
  "chrono-node": {
328
332
  "optional": true
329
333
  },
334
+ "defuddle": {
335
+ "optional": true
336
+ },
330
337
  "diff": {
331
338
  "optional": true
332
339
  },
@@ -336,6 +343,9 @@
336
343
  "js-yaml": {
337
344
  "optional": true
338
345
  },
346
+ "linkedom": {
347
+ "optional": true
348
+ },
339
349
  "node-cron": {
340
350
  "optional": true
341
351
  },
@@ -1,127 +1,250 @@
1
1
  ---
2
2
  name: field-test
3
3
  description: >
4
- Exercise tools, resources, and prompts with real-world inputs to verify behavior end-to-end. Use after adding or modifying definitions, or when the user asks to test, try out, or verify their MCP surface. Calls each definition with realistic and adversarial inputs and produces a report of issues, pain points, and recommendations.
4
+ Exercise tools, resources, and prompts against a live HTTP server via MCP JSON-RPC over curl. Starts the server, surfaces the catalog, runs real and adversarial inputs, and produces a tight report with concrete findings and numbered follow-up options. Use after adding or modifying definitions, or when the user asks to test, try out, or verify their MCP surface.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.3"
7
+ version: "2.0"
8
8
  audience: external
9
9
  type: debug
10
10
  ---
11
11
 
12
12
  ## Context
13
13
 
14
- Unit tests (`add-test` skill) verify handler logic with mocked context. Field testing verifies the full picture: real server, real transport, real inputs, real outputs. It catches issues that unit tests miss — bad descriptions, awkward input shapes, unhelpful error messages, missing format functions, schema mismatches, silent divergence between `structuredContent` and model-visible `content[]`, and surprising edge-case behavior.
14
+ Unit tests (`add-test` skill) verify handler logic with mocked context. Field testing exercises the real HTTP transport with real JSON-RPC: starts the server, calls `initialize`, surfaces the catalog, runs inputs, and checks what a client actually sees. It catches what unit tests miss — awkward input shapes, unhelpful errors, missing format output, drift between `structuredContent` and `content[]`, edge-case surprises.
15
15
 
16
- **Actively use** the tools — don't just read their code.
16
+ **Actively call the tools. Don't read code and guess.**
17
17
 
18
18
  ---
19
19
 
20
20
  ## Steps
21
21
 
22
- ### 1. Surface available definitions
22
+ ### 1. Start the server
23
+
24
+ Write the helper to `/tmp/mcp-field-test.sh` once, then source it in every subsequent Bash call. Helper keeps PID / URL / session id in `/tmp/mcp-field-test.env` so state survives across tool invocations.
25
+
26
+ ```bash
27
+ cat > /tmp/mcp-field-test.sh <<'HELPER_EOF'
28
+ #!/bin/bash
29
+ # Field-test helper: manage an MCP HTTP server + JSON-RPC session across shell calls.
30
+ STATE_FILE="/tmp/mcp-field-test.env"
31
+ [ -f "$STATE_FILE" ] && . "$STATE_FILE"
32
+
33
+ mcp_start() {
34
+ local dir="${1:-$PWD}"
35
+ echo "building $dir ..."
36
+ (cd "$dir" && bun run rebuild) >/tmp/mcp-build.log 2>&1 \
37
+ || { echo "BUILD FAILED — see /tmp/mcp-build.log"; return 1; }
38
+ echo "starting server ..."
39
+ (cd "$dir" && bun run start:http) >/tmp/mcp-server.log 2>&1 &
40
+ local pid=$!
41
+ local line=""
42
+ for _ in $(seq 1 40); do
43
+ line=$(grep -Eo 'listening at http://[^" ]+/mcp' /tmp/mcp-server.log | head -1)
44
+ [ -n "$line" ] && break
45
+ sleep 0.25
46
+ done
47
+ if [ -z "$line" ]; then
48
+ echo "server failed to start — see /tmp/mcp-server.log"
49
+ kill "$pid" 2>/dev/null
50
+ return 1
51
+ fi
52
+ local url="${line#listening at }"
53
+ local port; port=$(echo "$url" | sed -E 's|.*:([0-9]+)/.*|\1|')
54
+ cat > "$STATE_FILE" <<EOF
55
+ export MCP_PID=$pid
56
+ export MCP_URL=$url
57
+ export MCP_PORT=$port
58
+ EOF
59
+ . "$STATE_FILE"
60
+ echo "ready pid=$pid url=$url"
61
+ }
62
+
63
+ mcp_init() {
64
+ [ -z "$MCP_URL" ] && { echo "run mcp_start first"; return 1; }
65
+ local hdr="/tmp/mcp-init-headers.txt"
66
+ curl -sS -D "$hdr" -X POST "$MCP_URL" \
67
+ -H "Content-Type: application/json" \
68
+ -H "Accept: application/json, text/event-stream" \
69
+ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"field-test","version":"2.0"}}}' >/dev/null
70
+ local sid; sid=$(grep -i '^mcp-session-id:' "$hdr" | awk '{print $2}' | tr -d '\r\n')
71
+ [ -z "$sid" ] && { echo "no session id returned"; return 1; }
72
+ cat > "$STATE_FILE" <<EOF
73
+ export MCP_PID=$MCP_PID
74
+ export MCP_URL=$MCP_URL
75
+ export MCP_PORT=$MCP_PORT
76
+ export MCP_SID=$sid
77
+ EOF
78
+ . "$STATE_FILE"
79
+ curl -sS -X POST "$MCP_URL" \
80
+ -H "Content-Type: application/json" \
81
+ -H "Accept: application/json, text/event-stream" \
82
+ -H "Mcp-Session-Id: $sid" \
83
+ -d '{"jsonrpc":"2.0","method":"notifications/initialized"}' >/dev/null
84
+ echo "session=$sid"
85
+ }
86
+
87
+ # Usage: mcp_call METHOD [JSON_PARAMS]
88
+ # Prints the JSON-RPC response (SSE framing stripped). Pipe to `jq`.
89
+ mcp_call() {
90
+ [ -z "$MCP_SID" ] && { echo "run mcp_init first"; return 1; }
91
+ local method="$1"; local params="${2:-}"
92
+ local body
93
+ if [ -z "$params" ]; then
94
+ body=$(printf '{"jsonrpc":"2.0","id":%d,"method":"%s"}' "$RANDOM" "$method")
95
+ else
96
+ body=$(printf '{"jsonrpc":"2.0","id":%d,"method":"%s","params":%s}' "$RANDOM" "$method" "$params")
97
+ fi
98
+ curl -sS -X POST "$MCP_URL" \
99
+ -H "Content-Type: application/json" \
100
+ -H "Accept: application/json, text/event-stream" \
101
+ -H "Mcp-Session-Id: $MCP_SID" \
102
+ -d "$body" | sed -n 's/^data: //p'
103
+ }
104
+
105
+ mcp_stop() {
106
+ [ -n "$MCP_PID" ] && kill "$MCP_PID" 2>/dev/null
107
+ rm -f "$STATE_FILE"
108
+ echo "stopped"
109
+ }
110
+ HELPER_EOF
111
+
112
+ . /tmp/mcp-field-test.sh
113
+ mcp_start /absolute/path/to/server # replace with the target server
114
+ ```
115
+
116
+ **Notes**
117
+
118
+ - `MCP_HTTP_PORT` is a *starting* port — the server auto-increments if taken. Helper parses the real URL from the log (`HTTP transport listening at ...`).
119
+ - If `bun run rebuild` fails, stop. Don't field-test broken code — fix the build first.
120
+ - If a server is already listening on the project's port (`lsof -i :<port>`), confirm with the user before killing it; it may be their own session.
121
+
122
+ ### 2. Initialize the session
123
+
124
+ ```bash
125
+ . /tmp/mcp-field-test.sh
126
+ mcp_init
127
+ ```
128
+
129
+ Runs `initialize`, captures the session id, sends `notifications/initialized`.
130
+
131
+ ### 3. Surface the catalog
132
+
133
+ ```bash
134
+ . /tmp/mcp-field-test.sh
135
+ mcp_call tools/list | jq '.result.tools[] | {name, description, inputSchema}'
136
+ mcp_call resources/list | jq '.result.resources[] | {uri, name, mimeType}'
137
+ mcp_call prompts/list | jq '.result.prompts[] | {name, description, arguments}'
138
+ ```
139
+
140
+ Present a compact catalog to the user: each definition's name + 1-line description. Flag vague or missing descriptions as you go — those feed into the report. Use this to build the test plan.
141
+
142
+ ### 4. Plan the test pass
143
+
144
+ **Budget.** Don't run every category against every definition — the cross-product is infeasible. Apply the **universal battery** to everything; apply **situational categories** only when the definition triggers them.
145
+
146
+ **Universal battery — run on every tool**
147
+
148
+ | Category | What to verify |
149
+ |:---------|:---------------|
150
+ | Happy path | One realistic input. Output shape matches schema. `content[]` text reads clearly to a human. |
151
+ | `structuredContent` ↔ `content[]` parity | Every field in `structuredContent` is surfaced in the text. Parity gap = client-specific blindness. |
152
+ | Input error | One invalid input (wrong type or missing required). Error text says *what*, *why*, *how to fix*. |
153
+
154
+ **Situational — add only when triggered**
155
+
156
+ | Trigger (look in input schema or `annotations`) | Add category |
157
+ |:------------------------------------------------|:-------------|
158
+ | `include` / `fields` / `expand` / `view` / `projection` parameter | Field selection: non-default value renders requested fields |
159
+ | Array return with `query` / `filter` inputs | Empty result: does response explain *why* (echo criteria, suggest broadening)? |
160
+ | Batch / bulk input (arrays of IDs, multi-item ops) | Partial success: mix valid + invalid items |
161
+ | `annotations.readOnlyHint: true` | Confirm no mutation happened |
162
+ | `annotations.idempotentHint: true` | Call twice with same input — safe? |
163
+ | Hits external API / live upstream | One call that exercises upstream; note rate-limit / timeout / transient-failure behavior |
164
+ | Chained with other tools (search → detail → act) | Run one representative chain end-to-end; does each step return the IDs/cursors the next needs? |
165
+ | `cursor` / `offset` / `limit` params | Pagination: second page, end-of-list |
23
166
 
24
- List the MCP tools, resources, and prompts available in your environment. This confirms the server is connected and gives you everything you need — names, descriptions, parameter schemas — to plan your tests.
167
+ **Resources.** Happy path, not-found URI, `list` if defined, pagination if used.
168
+ **Prompts.** Happy path, defaults omitted, skim message quality.
25
169
 
26
- If you don't see any MCP tools from this server, ask the user to connect it first (e.g. `claude mcp add` for Claude Code, or the equivalent for their client). Don't proceed until the tools are visible.
170
+ **Sampling for large servers.** If more than 15 tools, run the universal battery on all, but pick roughly 30–40% for situational testing. Weight toward: write-shaped tools, complex schemas, external deps. List which ones you skipped in the report.
27
171
 
28
- Present what you find: each definition's name, parameters (with types and descriptions), and any notable schema details (optional fields, enums, constraints). This is your test surface.
172
+ **Auth & external state.**
29
173
 
30
- ### 2. Test each definition
174
+ - If a tool needs real API keys and they're not set, note `skipped — requires $VAR` and move on. Don't fabricate inputs.
175
+ - Tools that write to real external systems (third-party APIs, shared DBs): confirm with the user before running, or use a dry-run input if one exists.
31
176
 
32
- For every tool, resource, and prompt, run through these categories:
177
+ ### 5. Execute
33
178
 
34
- #### Tools
179
+ Use `TaskCreate` — one task per definition. Mark complete as you go. Don't batch.
35
180
 
36
- | Category | What to test |
37
- |:---------|:-------------|
38
- | **Happy path** | Realistic input that should succeed. Verify output shape matches the output schema. Verify format function produces sensible content blocks. |
39
- | **`structuredContent` parity** | The `format-parity` lint rule already asserts every terminal field in the output schema appears in `format()`'s rendered text (via sentinel injection at startup). Field testing layers real-data checks on top: are values rendered accurately (not just their labels)? Do conditional-render branches in `format()` still render every field when specific values are present? Does the content look right to a human reading the LLM's view? |
40
- | **Variations** | Different valid input combinations — optional fields omitted, optional fields included, different enum values, min/max boundaries. |
41
- | **Field selection / projection** | For tools with `fields`, `include`, `expand`, `view`, or similar parameters, call the tool with non-default selections. Verify the handler returns the requested fields and `format()` renders each requested field rather than a hardcoded summary subset. |
42
- | **Edge cases** | Empty strings, zero values, very long inputs, special characters, Unicode. |
43
- | **Error paths** | Missing required fields, wrong types, nonexistent IDs, inputs that should trigger domain errors. Verify errors are clear and actionable — they should name what went wrong, why, and what to do next. |
44
- | **Empty results** | Inputs that match nothing. Verify the response explains *why* (echoes criteria, suggests broadening) rather than returning a bare empty array. |
45
- | **Partial success** | For tools that operate on multiple items, test cases where some succeed and some fail. Verify both outcomes are reported — not just the successes. |
46
- | **Annotations** | Review tool `annotations` (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) against actual behavior. If a tool is marked read-only, verify it does not mutate state. If it is marked idempotent, verify retries with the same input are safe. If it is marked open-world false, verify it is not silently depending on live external systems. |
47
- | **Workflow chaining** | For servers with multi-step workflows, execute 1-2 representative chains end-to-end. Example: search → detail → follow-up action. Verify each step returns the IDs, cursors, URIs, tokens, or state needed for the next step without guessing. |
48
- | **Response quality** | Inspect successful responses for: (1) chaining IDs needed for follow-up calls, (2) operational metadata (counts, applied filters, truncation notices), (3) filtering transparency (if anything was excluded, does the response say what and how to include it?), (4) reasonable response size (not dumping unbounded data into context). See the `add-tool` skill's **Tool Response Design** section for the full set of patterns. |
49
- | **Resilience** | For tools backed by external APIs or slow subsystems, test or explicitly note rate-limit, timeout, and transient-failure behavior. Verify retries/backoff happen where intended, or at minimum that the error message clearly tells the user whether to retry, wait, or change input. |
50
- | **Descriptions** | Read every field's `.describe()` — would a user/LLM understand what to provide? Flag vague or missing descriptions. |
181
+ For each call, capture: input sent, response (trim huge payloads to files), whether `isError: true` appeared, anything surprising (slow response, parity drift, unhelpful text, crash).
51
182
 
52
- #### Resources
183
+ **Interpreting responses**
53
184
 
54
- | Category | What to test |
55
- |:---------|:-------------|
56
- | **Happy path** | Valid URI with known params. Verify returned content and MIME type. |
57
- | **List** | Call `list` if defined. Verify returned resources have names and valid URIs. |
58
- | **Not found** | URI with nonexistent params. Verify a clear error, not a crash. |
59
- | **Pagination** | If the resource uses `extractCursor`/`paginateArray`, test with varying limits and cursors. |
185
+ - Tool domain errors return `{result: {content: [...], isError: true}}` — they live in `result`, not `error`. Check `isError`, not the JSON-RPC error field.
186
+ - JSON-RPC `error` only appears for protocol issues (bad session, malformed envelope, unknown method).
187
+ - `mcp_call` already strips SSE framing. Pipe to `jq` for readability.
60
188
 
61
- #### Prompts
189
+ ### 6. Tear down
62
190
 
63
- | Category | What to test |
64
- |:---------|:-------------|
65
- | **Happy path** | Valid args. Verify generated messages are well-formed. |
66
- | **Defaults** | Omit optional args. Verify the output still makes sense. |
67
- | **Content quality** | Read the generated messages — are they clear, well-structured prompts? |
191
+ ```bash
192
+ . /tmp/mcp-field-test.sh
193
+ mcp_stop
194
+ ```
68
195
 
69
- ### 3. Track progress
196
+ Kills the background server, clears state. Do this *before* writing the report so nothing leaks into the next session.
70
197
 
71
- Use a todo list to track each definition and its test status. Mark each as you go — don't batch.
198
+ ### 7. Report
72
199
 
73
- ### 4. Produce the report
200
+ Three sections. Tight. The user should be able to skim the summary, read details only for what matters, and act on numbered options.
74
201
 
75
- After testing everything, present a structured report:
202
+ #### Summary (1 paragraph)
76
203
 
77
- #### Summary table
204
+ One paragraph. How many definitions exercised, how many passed clean, how many have issues, and the single most important finding. No tables, no lists.
78
205
 
79
- | Definition | Type | Status | Issues |
80
- |:-----------|:-----|:-------|:-------|
81
- | `acme_search_items` | tool | pass | — |
82
- | `acme_get_item` | tool | issues | Error message unhelpful for missing ID |
83
- | `item://` | resource | fail | Crashes on nonexistent ID |
206
+ #### Findings
84
207
 
85
- #### Detailed findings
208
+ Only include definitions with issues. Group by severity. Each finding is 2–4 lines unless it genuinely needs more.
86
209
 
87
- For each definition with issues, include:
210
+ | Severity | Meaning |
211
+ |:---------|:--------|
212
+ | **bug** | Broken: crash, wrong output, `isError: true` on valid input, data loss, schema violation |
213
+ | **ux** | Works but degrades the user/LLM experience: vague description, unhelpful error text, missing `format()`, parity drift, annotation mismatches behavior |
214
+ | **nit** | Polish: phrasing, inconsistent tone, minor doc gaps |
88
215
 
89
- - **What happened** — the input, the output or error, and what was expected
90
- - **Severity** — `bug` (broken behavior), `ux` (works but confusing/unhelpful), `nit` (minor polish)
91
- - **Recommendation** — specific fix suggestion
216
+ Format:
92
217
 
93
- #### Pain points
218
+ ```
219
+ **<tool_name> — <bug|ux|nit>**
220
+ Input: `<short input>` → <what happened>
221
+ Expected: <what should happen>
222
+ Fix: <one sentence>
223
+ ```
94
224
 
95
- Cross-cutting observations that aren't tied to a single definition:
225
+ #### Options
96
226
 
97
- - Inconsistent error message patterns across tools
98
- - Missing format functions (raw JSON returned to user)
99
- - `structuredContent` contains data that `content[]` silently drops
100
- - Requested projected fields are returned programmatically but not rendered for the model
101
- - Description quality issues (vague, missing, or misleading)
102
- - Schema design issues (required fields that should be optional, missing defaults, overly broad types, non-JSON-Schema-serializable types like `z.custom()` or `z.date()`)
103
- - Annotation hints that do not match real behavior (`readOnlyHint`, `idempotentHint`, `openWorldHint`)
104
- - Response quality issues (empty results with no context, silent filtering, missing chaining IDs, oversized payloads, no operational metadata)
105
- - Multi-step workflows that cannot be completed because intermediate outputs omit required IDs, cursors, or URIs
106
- - Error messages that don't guide recovery (generic "not found" instead of naming alternatives)
107
- - Resilience issues (rate limits, timeouts, transient upstream failures handled poorly or explained poorly)
108
- - Performance observations (unexpectedly slow responses)
227
+ Numbered, actionable, cherry-pickable. Each item maps to a concrete change.
228
+
229
+ ```
230
+ 1. Fix empty-result message in `pubmed_search_articles` echo criteria (finding #2)
231
+ 2. Add `format()` to `pubmed_lookup_mesh` currently returns raw JSON (finding #5)
232
+ 3. Tighten `ids` description in `pubmed_fetch_articles` silent on PMID vs DOI (finding #8)
233
+ ```
234
+
235
+ End with:
236
+
237
+ > Pick by number (e.g. "do 1, 3, 5" or "expand on 2").
109
238
 
110
239
  ---
111
240
 
112
241
  ## Checklist
113
242
 
114
- - [ ] All registered tools tested (happy path + edge cases + empty results)
115
- - [ ] All registered resources tested (happy path + not found)
116
- - [ ] All registered prompts tested (happy path + defaults)
117
- - [ ] Error messages reviewed for clarity and recovery guidance
118
- - [ ] Empty-result responses reviewed for context (criteria echo, suggestions)
119
- - [ ] `structuredContent` and `content[]` reviewed for parity
120
- - [ ] Field-selection / projection behavior reviewed where applicable
121
- - [ ] Response quality reviewed (chaining IDs, metadata, filtering transparency, payload size)
122
- - [ ] Tool annotations reviewed against actual behavior
123
- - [ ] Representative multi-step workflows exercised where applicable
124
- - [ ] External API resilience reviewed where applicable (rate limits, timeouts, transient failures)
125
- - [ ] Descriptions reviewed for completeness and accuracy
126
- - [ ] Format functions verified (or absence noted)
127
- - [ ] Summary report presented to user
243
+ - [ ] Server built and started; real port parsed from log
244
+ - [ ] Session initialized; `notifications/initialized` sent
245
+ - [ ] Catalog surfaced and presented
246
+ - [ ] Universal battery run on every definition
247
+ - [ ] Situational categories applied only when triggered
248
+ - [ ] External-state / auth-gated tools handled explicitly (run, skip, or confirm)
249
+ - [ ] Server stopped; state file removed
250
+ - [ ] Report: summary paragraph grouped findings numbered options
@@ -7,7 +7,7 @@ Fields that may still be empty or generic from scaffolding. Check each one and f
7
7
  | Field | Default / Scaffolded | What It Should Be |
8
8
  |:------|:---------------------|:------------------|
9
9
  | `name` | `{{PACKAGE_NAME}}` (substituted by init) | Verify it's correct. Use scoped name if publishing (`@org/my-server`). |
10
- | `version` | `0.1.0` | Keep for initial development. Bump via the `release` skill. |
10
+ | `version` | `0.1.0` | Keep for initial development. Bump via the `release-and-publish` skill. |
11
11
  | `mcpName` | _(often missing)_ | Reverse-domain identifier: `"io.github.{owner}/{repo}"`. Used in `server.json` `name` field and Dockerfile OCI labels. |
12
12
  | `description` | `""` (empty) | One sentence: what the server does and what it wraps. Appears on npm and in `npm search`. |
13
13
  | `repository` | _(often missing)_ | `{ "type": "git", "url": "git+https://github.com/org/repo.git" }` |
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: release-and-publish
3
+ description: >
4
+ Ship a release end-to-end across every registry the project targets (npm, MCP Registry, GHCR). Runs the final verification gate, pushes commits and tags, then publishes to each applicable destination. Assumes git wrapup (version bumps, changelog, commit, annotated tag) is already complete — this skill is the post-wrapup publish workflow. Halts and alerts the user on the first failure.
5
+ metadata:
6
+ author: cyanheads
7
+ version: "2.0"
8
+ audience: external
9
+ type: workflow
10
+ ---
11
+
12
+ ## Preconditions
13
+
14
+ This skill runs **after** git wrapup. By the time it's invoked:
15
+
16
+ - `package.json` version is bumped
17
+ - `changelog/<major.minor>.x/<version>.md` is authored
18
+ - `CHANGELOG.md` is regenerated
19
+ - README and every version-bearing file is in sync
20
+ - Release commit (`chore: release v<version>`) exists
21
+ - Annotated tag (`v<version>`) exists locally
22
+ - Working tree is clean
23
+
24
+ If any are missing, halt and tell the user to finish wrapup first. Do not attempt to redo wrapup work from inside this skill.
25
+
26
+ ## Failure Protocol
27
+
28
+ **Stop on the first non-zero exit.** No retries, no remediation from inside the skill. Report to the user:
29
+
30
+ 1. Which step failed
31
+ 2. The exact error output
32
+ 3. Which destinations already received the release (npm published? tag pushed? etc.) so they know the partial state
33
+
34
+ The user fixes locally and re-invokes, or runs the remaining steps manually. Publishes hard-fail with "version already exists" if replayed — that's the signal the step already succeeded.
35
+
36
+ ## Steps
37
+
38
+ ### 1. Sanity-check wrapup outputs
39
+
40
+ Read `package.json` → capture `version`. Then verify:
41
+
42
+ ```bash
43
+ git status --porcelain # must be empty — clean working tree
44
+ git describe --exact-match --tags HEAD 2>&1 # must equal v<version>
45
+ git rev-parse --abbrev-ref HEAD # note the branch name for step 3
46
+ ```
47
+
48
+ If working tree is dirty or HEAD isn't on `v<version>`, halt.
49
+
50
+ ### 2. Run the verification gate
51
+
52
+ All three must succeed. Use `test:all` if the script exists in `package.json`, otherwise fall back to `test`:
53
+
54
+ ```bash
55
+ bun run devcheck
56
+ bun run rebuild
57
+ bun run test:all # or `bun run test` if no test:all
58
+ ```
59
+
60
+ Any non-zero exit → halt with the failing command's output.
61
+
62
+ ### 3. Push to origin
63
+
64
+ ```bash
65
+ git push
66
+ git push --tags
67
+ ```
68
+
69
+ If the remote rejects either push, halt.
70
+
71
+ ### 4. Publish to npm
72
+
73
+ ```bash
74
+ bun publish --access public
75
+ ```
76
+
77
+ `bun publish` uses whatever npm auth the user has configured in `~/.npmrc`. If 2FA is enabled on the npm account, the command will prompt for an OTP or open a browser — that's expected; the user completes it interactively.
78
+
79
+ **Friction reducers (optional, configure once):**
80
+
81
+ | Option | How |
82
+ |:--|:--|
83
+ | **npm granular access token** with "Bypass 2FA for publish" | Generate at npmjs.com → replace `_authToken` in `~/.npmrc` → no OTP prompt at all |
84
+ | **1Password CLI TOTP injection** (requires `brew install --cask 1password-cli` + signed-in `op`) | `bun publish --access public --otp="$(op item get 'npm' --otp)"` |
85
+
86
+ Halt on publish error other than "version already exists" (which means this step already ran).
87
+
88
+ ### 5. Publish to MCP Registry
89
+
90
+ Only if `server.json` exists at the repo root (otherwise skip).
91
+
92
+ ```bash
93
+ bun run publish-mcp
94
+ ```
95
+
96
+ If `publish-mcp` isn't defined in `package.json`, add it (macOS):
97
+
98
+ ```json
99
+ "publish-mcp": "mcp-publisher login github -token \"$(security find-generic-password -a \"$USER\" -s mcp-publisher-github-pat -w)\" && mcp-publisher publish"
100
+ ```
101
+
102
+ Prereq: a GitHub PAT with `read:org` + `read:user` scopes stored in Keychain under the service name `mcp-publisher-github-pat`:
103
+
104
+ ```bash
105
+ security add-generic-password -a "$USER" -s mcp-publisher-github-pat -w
106
+ # paste PAT at the silent prompt
107
+ ```
108
+
109
+ Halt on any publisher error other than "cannot publish duplicate version".
110
+
111
+ ### 6. Publish Docker image
112
+
113
+ Only if `Dockerfile` exists at the repo root (otherwise skip).
114
+
115
+ Derive:
116
+
117
+ - `OWNER/REPO` from `git remote get-url origin` (strip `.git`, handle both `https://github.com/<owner>/<repo>` and `git@github.com:<owner>/<repo>` forms)
118
+ - `VERSION` from `package.json` (step 1)
119
+
120
+ ```bash
121
+ docker buildx build --platform linux/amd64,linux/arm64 \
122
+ -t ghcr.io/<OWNER>/<REPO>:<VERSION> \
123
+ -t ghcr.io/<OWNER>/<REPO>:latest \
124
+ --push .
125
+ ```
126
+
127
+ If the project uses a non-GHCR registry or a custom image name, respect the project's convention. Halt on build or push failure.
128
+
129
+ ### 7. Report the deployed artifacts
130
+
131
+ Print clickable URLs for every destination that succeeded:
132
+
133
+ - npm: `https://www.npmjs.com/package/<package.json#name>/v/<version>`
134
+ - MCP Registry: `https://registry.modelcontextprotocol.io/v0/servers?search=<package.json#mcpName>`
135
+ - GHCR: `ghcr.io/<OWNER>/<REPO>:<VERSION>`
136
+
137
+ Skip any destination that was skipped in its step.
138
+
139
+ ## Checklist
140
+
141
+ - [ ] Working tree clean; HEAD tagged `v<version>`
142
+ - [ ] `bun run devcheck` passes
143
+ - [ ] `bun run rebuild` succeeds
144
+ - [ ] `bun run test:all` (or `test`) passes
145
+ - [ ] `git push` succeeds
146
+ - [ ] `git push --tags` succeeds
147
+ - [ ] `bun publish --access public` succeeds
148
+ - [ ] `bun run publish-mcp` succeeds (if `server.json` present)
149
+ - [ ] Docker buildx multi-arch push succeeds (if `Dockerfile` present)
150
+ - [ ] Deployed artifact URLs reported to the user