@cyanheads/pubmed-mcp-server 2.10.12 → 2.10.14
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 +39 -20
- package/CLAUDE.md +39 -20
- package/README.md +89 -121
- package/changelog/2.0.x/2.0.0.md +32 -0
- package/changelog/2.0.x/2.0.1.md +32 -0
- package/changelog/2.1.x/2.1.0.md +17 -0
- package/changelog/2.1.x/2.1.1.md +29 -0
- package/changelog/2.1.x/2.1.2.md +18 -0
- package/changelog/2.1.x/2.1.3.md +10 -0
- package/changelog/2.1.x/2.1.4.md +12 -0
- package/changelog/2.1.x/2.1.5.md +18 -0
- package/changelog/2.1.x/2.1.6.md +15 -0
- package/changelog/2.10.x/2.10.0.md +17 -0
- package/changelog/2.10.x/2.10.1.md +14 -0
- package/changelog/2.10.x/2.10.10.md +22 -0
- package/changelog/2.10.x/2.10.11.md +21 -0
- package/changelog/2.10.x/2.10.12.md +14 -0
- package/changelog/2.10.x/2.10.13.md +28 -0
- package/changelog/2.10.x/2.10.14.md +28 -0
- package/changelog/2.10.x/2.10.2.md +13 -0
- package/changelog/2.10.x/2.10.3.md +26 -0
- package/changelog/2.10.x/2.10.4.md +11 -0
- package/changelog/2.10.x/2.10.5.md +31 -0
- package/changelog/2.10.x/2.10.6.md +30 -0
- package/changelog/2.10.x/2.10.7.md +17 -0
- package/changelog/2.10.x/2.10.8.md +22 -0
- package/changelog/2.10.x/2.10.9.md +15 -0
- package/changelog/2.2.x/2.2.0.md +67 -0
- package/changelog/2.2.x/2.2.1.md +10 -0
- package/changelog/2.2.x/2.2.2.md +20 -0
- package/changelog/2.2.x/2.2.3.md +17 -0
- package/changelog/2.2.x/2.2.4.md +34 -0
- package/changelog/2.2.x/2.2.5.md +10 -0
- package/changelog/2.2.x/2.2.6.md +17 -0
- package/changelog/2.3.x/2.3.0.md +27 -0
- package/changelog/2.3.x/2.3.1.md +15 -0
- package/changelog/2.3.x/2.3.10.md +20 -0
- package/changelog/2.3.x/2.3.11.md +21 -0
- package/changelog/2.3.x/2.3.2.md +27 -0
- package/changelog/2.3.x/2.3.3.md +38 -0
- package/changelog/2.3.x/2.3.4.md +21 -0
- package/changelog/2.3.x/2.3.5.md +24 -0
- package/changelog/2.3.x/2.3.6.md +26 -0
- package/changelog/2.3.x/2.3.7.md +31 -0
- package/changelog/2.3.x/2.3.8.md +19 -0
- package/changelog/2.3.x/2.3.9.md +22 -0
- package/changelog/2.4.x/2.4.0.md +34 -0
- package/changelog/2.4.x/2.4.1.md +32 -0
- package/changelog/2.5.x/2.5.0.md +35 -0
- package/changelog/2.5.x/2.5.1.md +32 -0
- package/changelog/2.5.x/2.5.2.md +23 -0
- package/changelog/2.5.x/2.5.3.md +22 -0
- package/changelog/2.5.x/2.5.5.md +52 -0
- package/changelog/2.5.x/2.5.6.md +33 -0
- package/changelog/2.6.x/2.6.0.md +32 -0
- package/changelog/2.6.x/2.6.1.md +26 -0
- package/changelog/2.6.x/2.6.10.md +16 -0
- package/changelog/2.6.x/2.6.11.md +24 -0
- package/changelog/2.6.x/2.6.12.md +29 -0
- package/changelog/2.6.x/2.6.2.md +23 -0
- package/changelog/2.6.x/2.6.3.md +17 -0
- package/changelog/2.6.x/2.6.4.md +21 -0
- package/changelog/2.6.x/2.6.5.md +30 -0
- package/changelog/2.6.x/2.6.6.md +25 -0
- package/changelog/2.6.x/2.6.7.md +37 -0
- package/changelog/2.6.x/2.6.8.md +15 -0
- package/changelog/2.6.x/2.6.9.md +36 -0
- package/changelog/2.7.x/2.7.0.md +41 -0
- package/changelog/2.7.x/2.7.1.md +21 -0
- package/changelog/2.7.x/2.7.10.md +13 -0
- package/changelog/2.7.x/2.7.11.md +15 -0
- package/changelog/2.7.x/2.7.2.md +22 -0
- package/changelog/2.7.x/2.7.3.md +18 -0
- package/changelog/2.7.x/2.7.4.md +15 -0
- package/changelog/2.7.x/2.7.5.md +34 -0
- package/changelog/2.7.x/2.7.6.md +14 -0
- package/changelog/2.7.x/2.7.7.md +14 -0
- package/changelog/2.7.x/2.7.8.md +18 -0
- package/changelog/2.7.x/2.7.9.md +16 -0
- package/changelog/2.8.x/2.8.0.md +23 -0
- package/changelog/2.9.x/2.9.0.md +21 -0
- package/changelog/2.9.x/2.9.1.md +12 -0
- package/changelog/2.9.x/2.9.10.md +15 -0
- package/changelog/2.9.x/2.9.2.md +21 -0
- package/changelog/2.9.x/2.9.3.md +11 -0
- package/changelog/2.9.x/2.9.4.md +24 -0
- package/changelog/2.9.x/2.9.5.md +20 -0
- package/changelog/2.9.x/2.9.6.md +22 -0
- package/changelog/2.9.x/2.9.7.md +26 -0
- package/changelog/2.9.x/2.9.8.md +15 -0
- package/changelog/2.9.x/2.9.9.md +35 -0
- package/changelog/template.md +151 -0
- package/dist/config/server-config.d.ts +4 -4
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +9 -24
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.d.ts.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.js +3 -10
- package/dist/services/europe-pmc/europe-pmc-service.js.map +1 -1
- package/dist/services/ncbi/ncbi-service.d.ts +0 -2
- package/dist/services/ncbi/ncbi-service.d.ts.map +1 -1
- package/dist/services/ncbi/ncbi-service.js +9 -13
- package/dist/services/ncbi/ncbi-service.js.map +1 -1
- package/dist/services/ncbi/response-handler.d.ts +9 -0
- package/dist/services/ncbi/response-handler.d.ts.map +1 -1
- package/dist/services/ncbi/response-handler.js +33 -1
- package/dist/services/ncbi/response-handler.js.map +1 -1
- package/dist/services/openalex/openalex-service.d.ts.map +1 -1
- package/dist/services/openalex/openalex-service.js +3 -10
- package/dist/services/openalex/openalex-service.js.map +1 -1
- package/package.json +23 -12
- package/server.json +3 -3
- package/dist/services/retry-policy.d.ts +0 -18
- package/dist/services/retry-policy.d.ts.map +0 -1
- package/dist/services/retry-policy.js +0 -21
- package/dist/services/retry-policy.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** @cyanheads/pubmed-mcp-server
|
|
4
|
-
**Version:** 2.10.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
4
|
+
**Version:** 2.10.14
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.4`
|
|
6
|
+
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
7
|
|
|
8
8
|
> **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.
|
|
9
9
|
|
|
@@ -111,12 +111,10 @@ export const databaseInfoResource = resource('pubmed://database/info', {
|
|
|
111
111
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
112
112
|
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
113
113
|
|
|
114
|
-
const emptyAsUndefined = (v: unknown) => (v === '' ? undefined : v);
|
|
115
|
-
|
|
116
114
|
const ServerConfigSchema = z.object({
|
|
117
|
-
apiKey: z.
|
|
115
|
+
apiKey: z.string().optional().describe('NCBI API key'),
|
|
118
116
|
toolIdentifier: z.string().default('pubmed-mcp-server').describe('NCBI tool identifier'),
|
|
119
|
-
adminEmail: z.
|
|
117
|
+
adminEmail: z.email().optional().describe('Admin contact email'),
|
|
120
118
|
requestDelayMs: z.coerce.number().min(50).max(5000).default(334).describe('Request delay in ms'),
|
|
121
119
|
maxRetries: z.coerce.number().min(0).max(10).default(6).describe('Max retry attempts'),
|
|
122
120
|
timeoutMs: z.coerce.number().min(1000).max(120000).default(30000).describe('Request timeout in ms'),
|
|
@@ -138,6 +136,8 @@ export function getServerConfig(): z.infer<typeof ServerConfigSchema> {
|
|
|
138
136
|
|
|
139
137
|
`parseEnvConfig` maps Zod schema paths → env var names so validation errors name the actual variable (`NCBI_REQUEST_DELAY_MS` must be a number) rather than the internal path (`requestDelayMs: expected number`).
|
|
140
138
|
|
|
139
|
+
An empty value and a whole-value `${…}` placeholder (what an MCPB or plugin host forwards when a user leaves an option blank) read as unset: an optional field stays `undefined`, a defaulted field takes its default. No per-field `z.preprocess` guard is needed.
|
|
140
|
+
|
|
141
141
|
For env booleans use `z.stringbool()`, never `z.coerce.boolean()` — `Boolean("false")` is `true`, so a coerced flag can't be disabled through the environment. `z.stringbool()` parses `true/false/1/0/yes/no/on/off` and rejects anything else, so `=false` actually disables.
|
|
142
142
|
|
|
143
143
|
### Server identity and instructions
|
|
@@ -157,6 +157,22 @@ await createApp({
|
|
|
157
157
|
|
|
158
158
|
`instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
159
159
|
|
|
160
|
+
### Session posture and shutdown
|
|
161
|
+
|
|
162
|
+
Two more `createApp()` options shape how the server runs rather than how it presents itself:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
await createApp({
|
|
166
|
+
sessionMode: 'stateless', // or { default: 'stateful', require: 'stateful' }
|
|
167
|
+
setup(core) { startMyWatcher(core.config); },
|
|
168
|
+
async teardown() { await stopMyWatcher(); },
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`sessionMode` declares the HTTP session posture in `src/` instead of 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). This server declares `'stateless'` — no tool calls `ctx.requestInput` — and `.env.example`, the `Dockerfile`, and the README env table say the same; keep all four in agreement. Add `require: 'stateful'` if a tool ever asks the caller for input mid-handler: startup then fails with a `ConfigurationError` rather than serving a mode in which a 2025-era client can never answer the prompt. Stdio is never refused.
|
|
173
|
+
|
|
174
|
+
`teardown(core)` is the `setup()` counterpart — release a watcher, socket, or non-`unref()`'d timer there. It runs after the transport stops and before the logger closes, on every shutdown path, and a signal-triggered shutdown then exits the process explicitly (0, or 1 if a step never settles within the framework's 10 s ceiling). None of this server's services holds such a handle today (the request queues arm per-request dispatch timers only), so it declares no `teardown`.
|
|
175
|
+
|
|
160
176
|
---
|
|
161
177
|
|
|
162
178
|
## Context
|
|
@@ -267,9 +283,9 @@ src/
|
|
|
267
283
|
|
|
268
284
|
## Skills
|
|
269
285
|
|
|
270
|
-
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.
|
|
286
|
+
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.
|
|
271
287
|
|
|
272
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent).
|
|
288
|
+
**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.
|
|
273
289
|
|
|
274
290
|
Available skills:
|
|
275
291
|
|
|
@@ -284,13 +300,13 @@ Available skills:
|
|
|
284
300
|
| `add-service` | Scaffold a new service integration |
|
|
285
301
|
| `add-test` | Scaffold test file for a tool, resource, or service |
|
|
286
302
|
| `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
|
|
287
|
-
| `tool-defs-analysis` | Read-only audit of definition language
|
|
303
|
+
| `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
|
|
288
304
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
289
305
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
290
306
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
291
307
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
292
308
|
| `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 |
|
|
293
|
-
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review,
|
|
309
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixes as ordinary commits on top of the stack, PR body kept in sync. Release PR mode only |
|
|
294
310
|
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
295
311
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
296
312
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
@@ -309,7 +325,7 @@ Available skills:
|
|
|
309
325
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
310
326
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
311
327
|
|
|
312
|
-
**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.
|
|
328
|
+
**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.
|
|
313
329
|
|
|
314
330
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
315
331
|
|
|
@@ -323,7 +339,8 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
323
339
|
| `bun run rebuild` | Clean + build |
|
|
324
340
|
| `bun run clean` | Remove build artifacts |
|
|
325
341
|
| `bun run devcheck` | Lint + format + typecheck + security + packaging alignment |
|
|
326
|
-
| `bun run audit:
|
|
342
|
+
| `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` |
|
|
343
|
+
| `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` |
|
|
327
344
|
| `bun run tree` | Generate directory structure doc |
|
|
328
345
|
| `bun run format` | Auto-fix formatting (safe fixes only) |
|
|
329
346
|
| `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior |
|
|
@@ -332,19 +349,21 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
332
349
|
| `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
333
350
|
| `bun run lint:mcp` | Validate MCP definitions against spec |
|
|
334
351
|
| `bun run lint:packaging` | Validate env var alignment between `manifest.json` and `server.json` (skipped cleanly when `manifest.json` is absent) |
|
|
335
|
-
| `bun run list-skills` | List skills in `skills/` with name + description |
|
|
352
|
+
| `bun run list-skills` | List skills in `framework-skills/` with name + description |
|
|
336
353
|
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
337
354
|
| `bun run release:github` | Create GitHub Release from an annotated tag — enforces `v<VERSION>: <subject>` title, attaches `.mcpb` bundle |
|
|
338
355
|
| `bun run start:stdio` | Production mode (stdio) |
|
|
339
356
|
| `bun run start:http` | Production mode (HTTP) |
|
|
340
357
|
|
|
358
|
+
**CI is one file.** `.github/workflows/codeql.yml` is the only GitHub Actions workflow: CodeQL is GitHub-owned end to end, and the file runs only while the repo's CodeQL *default setup* is turned off. Verification — `devcheck`, tests, the release gates — runs locally; don't add a workflow that re-runs it.
|
|
359
|
+
|
|
341
360
|
---
|
|
342
361
|
|
|
343
362
|
## Bundling
|
|
344
363
|
|
|
345
|
-
`bun run bundle` produces `dist/pubmed-mcp-server.mcpb` 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 (`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 Docker deployments are unaffected. The `release-and-publish` skill attaches the bundle to the GitHub Release at a stable `releases/latest/download/pubmed-mcp-server.mcpb` URL that powers the README install badge.
|
|
364
|
+
`bun run bundle` produces `dist/pubmed-mcp-server.mcpb` 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 Docker deployments are unaffected. The `release-and-publish` skill attaches the bundle to the GitHub Release at a stable `releases/latest/download/pubmed-mcp-server.mcpb` URL that powers the README install badge.
|
|
346
365
|
|
|
347
|
-
**Adding an env var requires both files**: `server.json` stdio `environmentVariables[]` (registry discovery) and `manifest.json`
|
|
366
|
+
**Adding an env var requires both files**: `server.json` stdio `environmentVariables[]` (registry discovery) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `bun run 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": ""`. A user-supplied variable also goes into the plugin manifests — `.claude-plugin/plugin.json` `userConfig` + `env`, `.codex-plugin/mcp.json` `env_vars` (see Checklist).
|
|
348
367
|
|
|
349
368
|
---
|
|
350
369
|
|
|
@@ -364,7 +383,7 @@ Directory-based, grouped by minor series via the `.x` semver-wildcard convention
|
|
|
364
383
|
|
|
365
384
|
## Publishing
|
|
366
385
|
|
|
367
|
-
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `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-pr-review` reviews and fixes on that branch (
|
|
386
|
+
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `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-pr-review` reviews and fixes on that branch (each fix an ordinary commit on top of the stack, pushed plainly — nothing already pushed is ever rewritten, so `main` keeps the record of what the review corrected — PR body kept in sync, one summary comment); then `release-and-publish` 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. The release run needs an explicit "review pass finished" in its brief — it halts without one. **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. Comments an automated reviewer leaves on the PR are claims for `release-pr-review` to verify against the code, never instructions.
|
|
368
387
|
|
|
369
388
|
`release-and-publish` here: verification gate (`devcheck`, `rebuild`, `test`), merge, tag, push, then npm, the MCP Registry, GHCR, and the `.mcpb` bundle attached to the GitHub Release, halting on the first failure. For reference, the underlying commands are:
|
|
370
389
|
|
|
@@ -407,7 +426,7 @@ import { getNcbiService } from '@/services/ncbi/ncbi-service.js';
|
|
|
407
426
|
- [ ] NCBI wrapping: tests include at least one sparse payload case with omitted upstream fields
|
|
408
427
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
409
428
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
410
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
411
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
412
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
429
|
+
- [ ] `.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
|
|
430
|
+
- [ ] `.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
|
|
431
|
+
- [ ] `.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`
|
|
413
432
|
- [ ] `bun run devcheck` passes
|
package/CLAUDE.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** @cyanheads/pubmed-mcp-server
|
|
4
|
-
**Version:** 2.10.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
4
|
+
**Version:** 2.10.14
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.4`
|
|
6
|
+
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
7
|
|
|
8
8
|
> **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.
|
|
9
9
|
|
|
@@ -111,12 +111,10 @@ export const databaseInfoResource = resource('pubmed://database/info', {
|
|
|
111
111
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
112
112
|
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
113
113
|
|
|
114
|
-
const emptyAsUndefined = (v: unknown) => (v === '' ? undefined : v);
|
|
115
|
-
|
|
116
114
|
const ServerConfigSchema = z.object({
|
|
117
|
-
apiKey: z.
|
|
115
|
+
apiKey: z.string().optional().describe('NCBI API key'),
|
|
118
116
|
toolIdentifier: z.string().default('pubmed-mcp-server').describe('NCBI tool identifier'),
|
|
119
|
-
adminEmail: z.
|
|
117
|
+
adminEmail: z.email().optional().describe('Admin contact email'),
|
|
120
118
|
requestDelayMs: z.coerce.number().min(50).max(5000).default(334).describe('Request delay in ms'),
|
|
121
119
|
maxRetries: z.coerce.number().min(0).max(10).default(6).describe('Max retry attempts'),
|
|
122
120
|
timeoutMs: z.coerce.number().min(1000).max(120000).default(30000).describe('Request timeout in ms'),
|
|
@@ -138,6 +136,8 @@ export function getServerConfig(): z.infer<typeof ServerConfigSchema> {
|
|
|
138
136
|
|
|
139
137
|
`parseEnvConfig` maps Zod schema paths → env var names so validation errors name the actual variable (`NCBI_REQUEST_DELAY_MS` must be a number) rather than the internal path (`requestDelayMs: expected number`).
|
|
140
138
|
|
|
139
|
+
An empty value and a whole-value `${…}` placeholder (what an MCPB or plugin host forwards when a user leaves an option blank) read as unset: an optional field stays `undefined`, a defaulted field takes its default. No per-field `z.preprocess` guard is needed.
|
|
140
|
+
|
|
141
141
|
For env booleans use `z.stringbool()`, never `z.coerce.boolean()` — `Boolean("false")` is `true`, so a coerced flag can't be disabled through the environment. `z.stringbool()` parses `true/false/1/0/yes/no/on/off` and rejects anything else, so `=false` actually disables.
|
|
142
142
|
|
|
143
143
|
### Server identity and instructions
|
|
@@ -157,6 +157,22 @@ await createApp({
|
|
|
157
157
|
|
|
158
158
|
`instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
159
159
|
|
|
160
|
+
### Session posture and shutdown
|
|
161
|
+
|
|
162
|
+
Two more `createApp()` options shape how the server runs rather than how it presents itself:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
await createApp({
|
|
166
|
+
sessionMode: 'stateless', // or { default: 'stateful', require: 'stateful' }
|
|
167
|
+
setup(core) { startMyWatcher(core.config); },
|
|
168
|
+
async teardown() { await stopMyWatcher(); },
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`sessionMode` declares the HTTP session posture in `src/` instead of 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). This server declares `'stateless'` — no tool calls `ctx.requestInput` — and `.env.example`, the `Dockerfile`, and the README env table say the same; keep all four in agreement. Add `require: 'stateful'` if a tool ever asks the caller for input mid-handler: startup then fails with a `ConfigurationError` rather than serving a mode in which a 2025-era client can never answer the prompt. Stdio is never refused.
|
|
173
|
+
|
|
174
|
+
`teardown(core)` is the `setup()` counterpart — release a watcher, socket, or non-`unref()`'d timer there. It runs after the transport stops and before the logger closes, on every shutdown path, and a signal-triggered shutdown then exits the process explicitly (0, or 1 if a step never settles within the framework's 10 s ceiling). None of this server's services holds such a handle today (the request queues arm per-request dispatch timers only), so it declares no `teardown`.
|
|
175
|
+
|
|
160
176
|
---
|
|
161
177
|
|
|
162
178
|
## Context
|
|
@@ -267,9 +283,9 @@ src/
|
|
|
267
283
|
|
|
268
284
|
## Skills
|
|
269
285
|
|
|
270
|
-
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.
|
|
286
|
+
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.
|
|
271
287
|
|
|
272
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent).
|
|
288
|
+
**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.
|
|
273
289
|
|
|
274
290
|
Available skills:
|
|
275
291
|
|
|
@@ -284,13 +300,13 @@ Available skills:
|
|
|
284
300
|
| `add-service` | Scaffold a new service integration |
|
|
285
301
|
| `add-test` | Scaffold test file for a tool, resource, or service |
|
|
286
302
|
| `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
|
|
287
|
-
| `tool-defs-analysis` | Read-only audit of definition language
|
|
303
|
+
| `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
|
|
288
304
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
289
305
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
290
306
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
291
307
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
292
308
|
| `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 |
|
|
293
|
-
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review,
|
|
309
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixes as ordinary commits on top of the stack, PR body kept in sync. Release PR mode only |
|
|
294
310
|
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
295
311
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
296
312
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
@@ -309,7 +325,7 @@ Available skills:
|
|
|
309
325
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
310
326
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
311
327
|
|
|
312
|
-
**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.
|
|
328
|
+
**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.
|
|
313
329
|
|
|
314
330
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
315
331
|
|
|
@@ -323,7 +339,8 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
323
339
|
| `bun run rebuild` | Clean + build |
|
|
324
340
|
| `bun run clean` | Remove build artifacts |
|
|
325
341
|
| `bun run devcheck` | Lint + format + typecheck + security + packaging alignment |
|
|
326
|
-
| `bun run audit:
|
|
342
|
+
| `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` |
|
|
343
|
+
| `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` |
|
|
327
344
|
| `bun run tree` | Generate directory structure doc |
|
|
328
345
|
| `bun run format` | Auto-fix formatting (safe fixes only) |
|
|
329
346
|
| `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior |
|
|
@@ -332,19 +349,21 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
332
349
|
| `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
333
350
|
| `bun run lint:mcp` | Validate MCP definitions against spec |
|
|
334
351
|
| `bun run lint:packaging` | Validate env var alignment between `manifest.json` and `server.json` (skipped cleanly when `manifest.json` is absent) |
|
|
335
|
-
| `bun run list-skills` | List skills in `skills/` with name + description |
|
|
352
|
+
| `bun run list-skills` | List skills in `framework-skills/` with name + description |
|
|
336
353
|
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
337
354
|
| `bun run release:github` | Create GitHub Release from an annotated tag — enforces `v<VERSION>: <subject>` title, attaches `.mcpb` bundle |
|
|
338
355
|
| `bun run start:stdio` | Production mode (stdio) |
|
|
339
356
|
| `bun run start:http` | Production mode (HTTP) |
|
|
340
357
|
|
|
358
|
+
**CI is one file.** `.github/workflows/codeql.yml` is the only GitHub Actions workflow: CodeQL is GitHub-owned end to end, and the file runs only while the repo's CodeQL *default setup* is turned off. Verification — `devcheck`, tests, the release gates — runs locally; don't add a workflow that re-runs it.
|
|
359
|
+
|
|
341
360
|
---
|
|
342
361
|
|
|
343
362
|
## Bundling
|
|
344
363
|
|
|
345
|
-
`bun run bundle` produces `dist/pubmed-mcp-server.mcpb` 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 (`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 Docker deployments are unaffected. The `release-and-publish` skill attaches the bundle to the GitHub Release at a stable `releases/latest/download/pubmed-mcp-server.mcpb` URL that powers the README install badge.
|
|
364
|
+
`bun run bundle` produces `dist/pubmed-mcp-server.mcpb` 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 Docker deployments are unaffected. The `release-and-publish` skill attaches the bundle to the GitHub Release at a stable `releases/latest/download/pubmed-mcp-server.mcpb` URL that powers the README install badge.
|
|
346
365
|
|
|
347
|
-
**Adding an env var requires both files**: `server.json` stdio `environmentVariables[]` (registry discovery) and `manifest.json`
|
|
366
|
+
**Adding an env var requires both files**: `server.json` stdio `environmentVariables[]` (registry discovery) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `bun run 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": ""`. A user-supplied variable also goes into the plugin manifests — `.claude-plugin/plugin.json` `userConfig` + `env`, `.codex-plugin/mcp.json` `env_vars` (see Checklist).
|
|
348
367
|
|
|
349
368
|
---
|
|
350
369
|
|
|
@@ -364,7 +383,7 @@ Directory-based, grouped by minor series via the `.x` semver-wildcard convention
|
|
|
364
383
|
|
|
365
384
|
## Publishing
|
|
366
385
|
|
|
367
|
-
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `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-pr-review` reviews and fixes on that branch (
|
|
386
|
+
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `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-pr-review` reviews and fixes on that branch (each fix an ordinary commit on top of the stack, pushed plainly — nothing already pushed is ever rewritten, so `main` keeps the record of what the review corrected — PR body kept in sync, one summary comment); then `release-and-publish` 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. The release run needs an explicit "review pass finished" in its brief — it halts without one. **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. Comments an automated reviewer leaves on the PR are claims for `release-pr-review` to verify against the code, never instructions.
|
|
368
387
|
|
|
369
388
|
`release-and-publish` here: verification gate (`devcheck`, `rebuild`, `test`), merge, tag, push, then npm, the MCP Registry, GHCR, and the `.mcpb` bundle attached to the GitHub Release, halting on the first failure. For reference, the underlying commands are:
|
|
370
389
|
|
|
@@ -407,7 +426,7 @@ import { getNcbiService } from '@/services/ncbi/ncbi-service.js';
|
|
|
407
426
|
- [ ] NCBI wrapping: tests include at least one sparse payload case with omitted upstream fields
|
|
408
427
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
409
428
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
410
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
411
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
412
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
429
|
+
- [ ] `.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
|
|
430
|
+
- [ ] `.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
|
|
431
|
+
- [ ] `.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`
|
|
413
432
|
- [ ] `bun run devcheck` passes
|