@cyanheads/ensembl-mcp-server 0.4.3 → 0.5.0

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.
Files changed (39) hide show
  1. package/AGENTS.md +45 -19
  2. package/CLAUDE.md +45 -19
  3. package/README.md +95 -68
  4. package/changelog/0.4.x/0.4.4.md +27 -0
  5. package/changelog/0.5.x/0.5.0.md +25 -0
  6. package/changelog/template.md +9 -26
  7. package/dist/index.js +7 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.d.ts.map +1 -1
  10. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.js +12 -5
  11. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.js.map +1 -1
  12. package/dist/mcp-server/tools/definitions/get-homology.tool.d.ts.map +1 -1
  13. package/dist/mcp-server/tools/definitions/get-homology.tool.js +2 -0
  14. package/dist/mcp-server/tools/definitions/get-homology.tool.js.map +1 -1
  15. package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts +14 -2
  16. package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/definitions/get-sequence.tool.js +164 -49
  18. package/dist/mcp-server/tools/definitions/get-sequence.tool.js.map +1 -1
  19. package/dist/mcp-server/tools/definitions/get-xrefs.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/get-xrefs.tool.js +2 -0
  21. package/dist/mcp-server/tools/definitions/get-xrefs.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/definitions/lookup-gene.tool.d.ts.map +1 -1
  23. package/dist/mcp-server/tools/definitions/lookup-gene.tool.js +10 -2
  24. package/dist/mcp-server/tools/definitions/lookup-gene.tool.js.map +1 -1
  25. package/dist/mcp-server/tools/definitions/predict-variant.tool.d.ts.map +1 -1
  26. package/dist/mcp-server/tools/definitions/predict-variant.tool.js +4 -0
  27. package/dist/mcp-server/tools/definitions/predict-variant.tool.js.map +1 -1
  28. package/dist/mcp-server/tools/definitions/query-region.tool.d.ts +6 -1
  29. package/dist/mcp-server/tools/definitions/query-region.tool.d.ts.map +1 -1
  30. package/dist/mcp-server/tools/definitions/query-region.tool.js +119 -24
  31. package/dist/mcp-server/tools/definitions/query-region.tool.js.map +1 -1
  32. package/dist/services/ensembl/ensembl-service.d.ts +11 -0
  33. package/dist/services/ensembl/ensembl-service.d.ts.map +1 -1
  34. package/dist/services/ensembl/ensembl-service.js +26 -0
  35. package/dist/services/ensembl/ensembl-service.js.map +1 -1
  36. package/dist/services/ensembl/types.d.ts +11 -0
  37. package/dist/services/ensembl/types.d.ts.map +1 -1
  38. package/package.json +10 -9
  39. package/server.json +3 -3
package/AGENTS.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Server:** ensembl-mcp-server
4
- **Version:** 0.4.3
5
- **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.12.3`
6
- **Engines:** Bun ≥1.3.0, Node ≥24.0.0
4
+ **Version:** 0.5.0
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
6
+ **Engines:** Bun ≥1.4.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0
8
- **Zod:** ^4.4.3
8
+ **Zod:** ^4.6.5
9
9
 
10
10
  > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
11
11
 
@@ -38,6 +38,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
38
38
  - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
39
39
  - **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.
40
40
  - **Secrets in env vars only** — never hardcoded.
41
+ - **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.
41
42
  - **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.
42
43
 
43
44
  ---
@@ -141,6 +142,22 @@ The canonical `createApp()` identity for this project is `name: 'ensembl-mcp-ser
141
142
 
142
143
  `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.
143
144
 
145
+ ### Session posture and shutdown
146
+
147
+ Two more `createApp()` options shape how the server runs rather than how it presents itself:
148
+
149
+ ```ts
150
+ await createApp({
151
+ sessionMode: 'stateless', // or { default: 'stateful', require: 'stateful' }
152
+ setup(core) { initEnsemblService(core.config, core.storage); },
153
+ async teardown() { await releaseResources(); },
154
+ });
155
+ ```
156
+
157
+ `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 asks the caller for input mid-handler via `ctx.requestInput`, so there is nothing a 2025-era HTTP client would be unable to answer. Add `require: 'stateful'` if that ever changes — startup then fails with a `ConfigurationError` rather than serving a mode in which the prompt can never be answered. Stdio is never refused.
158
+
159
+ `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). `EnsemblService` holds no such handle, so this server declares no `teardown`.
160
+
144
161
  ---
145
162
 
146
163
  ## Context
@@ -165,7 +182,7 @@ Handlers receive a unified `ctx` object. Key properties:
165
182
 
166
183
  Handlers throw — the framework catches, classifies, and formats.
167
184
 
168
- **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 (≥ 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 `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
185
+ **Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
169
186
 
170
187
  ```ts
171
188
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
@@ -248,9 +265,9 @@ src/
248
265
 
249
266
  ## Skills
250
267
 
251
- 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. `bun run list-skills` prints the full registry.
268
+ 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.
252
269
 
253
- **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.
270
+ **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.
254
271
 
255
272
  Available skills:
256
273
 
@@ -268,10 +285,10 @@ Available skills:
268
285
  | `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
269
286
  | `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
270
287
  | `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
271
- | `devcheck` | Lint, format, typecheck, audit |
272
288
  | `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
273
- | `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
274
- | `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
289
+ | `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 |
290
+ | `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 |
291
+ | `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
275
292
  | `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
276
293
  | `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
277
294
  | `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
@@ -290,7 +307,7 @@ Available skills:
290
307
  | `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
291
308
  | `api-workers` | Cloudflare Workers runtime |
292
309
 
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.
310
+ **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
311
 
295
312
  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
313
 
@@ -306,7 +323,8 @@ When you complete a skill's checklist, check the boxes and add a completion time
306
323
  | `bun run rebuild` | Clean + build |
307
324
  | `bun run clean` | Remove build artifacts |
308
325
  | `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
309
- | `bun run audit:refresh` | Delete `bun.lock`, reinstall, and re-run `bun audit`. Use when `devcheck` flags a transitive advisory — Bun's `update` is sticky on transitive resolutions, so the advisory may be a stale-lockfile false positive. If it survives the refresh, it's real. |
326
+ | `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` |
327
+ | `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 |
310
328
  | `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
311
329
  | `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity (run by devcheck) |
312
330
  | `bun run list-skills` | Print the skill registry |
@@ -320,15 +338,17 @@ When you complete a skill's checklist, check the boxes and add a completion time
320
338
  | `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
321
339
  | `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
322
340
 
341
+ **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.
342
+
323
343
  ---
324
344
 
325
345
  ## Bundling
326
346
 
327
- `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 (`skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
347
+ `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. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
328
348
 
329
- **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.
349
+ **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": ""`.
330
350
 
331
- **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`.
351
+ **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`.
332
352
 
333
353
  ---
334
354
 
@@ -353,12 +373,18 @@ security: false # optional — true ONLY for a source
353
373
 
354
374
  `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.
355
375
 
356
- **Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Include only sections with entries — don't ship empty headers.
376
+ **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.
357
377
 
358
378
  **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.
359
379
 
360
380
  ---
361
381
 
382
+ ## Publishing
383
+
384
+ **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.
385
+
386
+ ---
387
+
362
388
  ## Imports
363
389
 
364
390
  ```ts
@@ -385,7 +411,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
385
411
  - [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
386
412
  - [ ] Registered in `createApp()` arrays (directly or via barrel exports)
387
413
  - [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
388
- - [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = package name; `interface.shortDescription` from `package.json` description
389
- - [ ] `.codex-plugin/mcp.json` updated — server name key matches `package.json` name; env vars added for any required API keys
390
- - [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry with server name key, env vars for any required API keys
414
+ - [ ] `.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
415
+ - [ ] `.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
416
+ - [ ] `.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`
391
417
  - [ ] `bun run devcheck` passes
package/CLAUDE.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Server:** ensembl-mcp-server
4
- **Version:** 0.4.3
5
- **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.12.3`
6
- **Engines:** Bun ≥1.3.0, Node ≥24.0.0
4
+ **Version:** 0.5.0
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
6
+ **Engines:** Bun ≥1.4.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0
8
- **Zod:** ^4.4.3
8
+ **Zod:** ^4.6.5
9
9
 
10
10
  > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
11
11
 
@@ -38,6 +38,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
38
38
  - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
39
39
  - **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.
40
40
  - **Secrets in env vars only** — never hardcoded.
41
+ - **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.
41
42
  - **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.
42
43
 
43
44
  ---
@@ -141,6 +142,22 @@ The canonical `createApp()` identity for this project is `name: 'ensembl-mcp-ser
141
142
 
142
143
  `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.
143
144
 
145
+ ### Session posture and shutdown
146
+
147
+ Two more `createApp()` options shape how the server runs rather than how it presents itself:
148
+
149
+ ```ts
150
+ await createApp({
151
+ sessionMode: 'stateless', // or { default: 'stateful', require: 'stateful' }
152
+ setup(core) { initEnsemblService(core.config, core.storage); },
153
+ async teardown() { await releaseResources(); },
154
+ });
155
+ ```
156
+
157
+ `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 asks the caller for input mid-handler via `ctx.requestInput`, so there is nothing a 2025-era HTTP client would be unable to answer. Add `require: 'stateful'` if that ever changes — startup then fails with a `ConfigurationError` rather than serving a mode in which the prompt can never be answered. Stdio is never refused.
158
+
159
+ `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). `EnsemblService` holds no such handle, so this server declares no `teardown`.
160
+
144
161
  ---
145
162
 
146
163
  ## Context
@@ -165,7 +182,7 @@ Handlers receive a unified `ctx` object. Key properties:
165
182
 
166
183
  Handlers throw — the framework catches, classifies, and formats.
167
184
 
168
- **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 (≥ 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 `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
185
+ **Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
169
186
 
170
187
  ```ts
171
188
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
@@ -248,9 +265,9 @@ src/
248
265
 
249
266
  ## Skills
250
267
 
251
- 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. `bun run list-skills` prints the full registry.
268
+ 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.
252
269
 
253
- **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.
270
+ **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.
254
271
 
255
272
  Available skills:
256
273
 
@@ -268,10 +285,10 @@ Available skills:
268
285
  | `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
269
286
  | `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
270
287
  | `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
271
- | `devcheck` | Lint, format, typecheck, audit |
272
288
  | `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
273
- | `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
274
- | `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
289
+ | `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 |
290
+ | `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 |
291
+ | `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
275
292
  | `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
276
293
  | `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
277
294
  | `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
@@ -290,7 +307,7 @@ Available skills:
290
307
  | `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
291
308
  | `api-workers` | Cloudflare Workers runtime |
292
309
 
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.
310
+ **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
311
 
295
312
  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
313
 
@@ -306,7 +323,8 @@ When you complete a skill's checklist, check the boxes and add a completion time
306
323
  | `bun run rebuild` | Clean + build |
307
324
  | `bun run clean` | Remove build artifacts |
308
325
  | `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
309
- | `bun run audit:refresh` | Delete `bun.lock`, reinstall, and re-run `bun audit`. Use when `devcheck` flags a transitive advisory — Bun's `update` is sticky on transitive resolutions, so the advisory may be a stale-lockfile false positive. If it survives the refresh, it's real. |
326
+ | `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` |
327
+ | `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 |
310
328
  | `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
311
329
  | `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity (run by devcheck) |
312
330
  | `bun run list-skills` | Print the skill registry |
@@ -320,15 +338,17 @@ When you complete a skill's checklist, check the boxes and add a completion time
320
338
  | `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
321
339
  | `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
322
340
 
341
+ **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.
342
+
323
343
  ---
324
344
 
325
345
  ## Bundling
326
346
 
327
- `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 (`skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
347
+ `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. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
328
348
 
329
- **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.
349
+ **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": ""`.
330
350
 
331
- **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`.
351
+ **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`.
332
352
 
333
353
  ---
334
354
 
@@ -353,12 +373,18 @@ security: false # optional — true ONLY for a source
353
373
 
354
374
  `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.
355
375
 
356
- **Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Include only sections with entries — don't ship empty headers.
376
+ **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.
357
377
 
358
378
  **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.
359
379
 
360
380
  ---
361
381
 
382
+ ## Publishing
383
+
384
+ **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.
385
+
386
+ ---
387
+
362
388
  ## Imports
363
389
 
364
390
  ```ts
@@ -385,7 +411,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
385
411
  - [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
386
412
  - [ ] Registered in `createApp()` arrays (directly or via barrel exports)
387
413
  - [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
388
- - [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = package name; `interface.shortDescription` from `package.json` description
389
- - [ ] `.codex-plugin/mcp.json` updated — server name key matches `package.json` name; env vars added for any required API keys
390
- - [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry with server name key, env vars for any required API keys
414
+ - [ ] `.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
415
+ - [ ] `.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
416
+ - [ ] `.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`
391
417
  - [ ] `bun run devcheck` passes
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div align="center">
9
9
 
10
- [![Version](https://img.shields.io/badge/Version-0.4.3-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/ensembl-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/ensembl-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/ensembl-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.0-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.5.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/ensembl-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/ensembl-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/ensembl-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.0-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -27,9 +27,11 @@
27
27
 
28
28
  ---
29
29
 
30
- ## Tools
30
+ ## Overview
31
31
 
32
- Seven tools covering the core Ensembl REST API surface — species discovery, gene/transcript lookup, sequence retrieval, genomic region overlap, variant consequence prediction, cross-species homology, and external database cross-references:
32
+ Gene, sequence, and variant data for vertebrates and other model organisms from the Ensembl REST API. Look up genes, fetch sequences, predict variant consequences, find orthologs, and cross-reference external databases from any MCP client. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
33
+
34
+ ### Tools
33
35
 
34
36
  | Tool | Description |
35
37
  |:-----|:------------|
@@ -41,117 +43,142 @@ Seven tools covering the core Ensembl REST API surface — species discovery, ge
41
43
  | `ensembl_get_homology` | Find orthologs and/or paralogs of a gene across species with percent identity and taxonomy level |
42
44
  | `ensembl_get_xrefs` | Retrieve cross-database references for a gene — HGNC, UniProt, EntrezGene, OMIM, RefSeq, Reactome, and others |
43
45
 
44
- ### `ensembl_list_species`
46
+ ### Resources
45
47
 
46
- Discovery tool for the Ensembl species catalog.
48
+ | Resource | Description |
49
+ |:---|:---|
50
+ | `ensembl://gene/{id}` | Gene record by stable ID (`ENSG…`) — location, biotype, description, and transcript list |
51
+ | `ensembl://transcript/{id}` | Transcript record by stable ID (`ENST…`) — parent gene, location, biotype, canonical flag, and length |
52
+ | `ensembl://species` | Supported Ensembl species for the endpoint default division (vertebrates on the default endpoint) |
53
+ | `ensembl://species/{division}` | Supported species in one division (`EnsemblVertebrates`, `EnsemblPlants`, `EnsemblFungi`, `EnsemblMetazoa`, `EnsemblProtists`) |
47
54
 
48
- - Filter by division: vertebrates, plants, fungi, metazoa, or protists
49
- - Optional name filter (`nameContains`) for local substring matching
50
- - Returns display name, common name, assembly, taxon ID, and Ensembl division for each species
51
- - Required first step — species names like `homo_sapiens` are opaque to non-biologists and are the input format every other tool expects
55
+ All resource data is also reachable via the `ensembl_list_species` tool, which additionally filters by name.
52
56
 
53
- ---
57
+ ### Prompts
58
+
59
+ | Prompt | Description |
60
+ |:---|:---|
61
+ | `ensembl_gene_dossier` | Structured workflow for assembling a complete gene profile: symbol → ID + location → sequence → variants → orthologs → xrefs |
54
62
 
55
- ### `ensembl_lookup_gene`
63
+ ## Capability reference
56
64
 
57
- Single entry point for resolving gene identity.
65
+ ### `ensembl_list_species` <sub>tool</sub>
58
66
 
59
- - Symbol + species lookup (`BRCA2` + `homo_sapiens`) or direct stable ID lookup (`ENSG00000139618`)
60
- - Batch lookup of up to 20 IDs or symbols in one call via POST endpoints
61
- - Optional transcript expansion — returns full transcript list with biotype and canonical flag
62
- - Returns Ensembl stable ID, genomic location (chr:start-end:strand), biotype, description, and transcript list
63
- - Errors: `not_found` (symbol or ID not in Ensembl), `invalid_species` (call `ensembl_list_species` to discover valid names)
67
+ - Filter by division (`EnsemblVertebrates`, `EnsemblPlants`, `EnsemblFungi`, `EnsemblMetazoa`, `EnsemblProtists`) or `nameContains` for a local substring match against name, display name, and common name
68
+ - Omit `division` to return the endpoint default division (vertebrates, ~356 species on the default GRCh38 endpoint)
69
+ - Returns internal name (the value every other tool expects), display name, common name, taxon ID, assembly, and division
70
+ - Required first step — species names like `homo_sapiens` are opaque to non-biologists
64
71
 
65
72
  ---
66
73
 
67
- ### `ensembl_get_sequence`
74
+ ### `ensembl_lookup_gene` <sub>tool</sub>
75
+
76
+ - Exactly one of `symbol` (+ optional `species`, default `homo_sapiens`), `id`, `ids` (batch, up to 20), or `symbols` (batch, up to 20)
77
+ - `expand_transcripts` (default `false`) adds the full transcript list with biotype and canonical flag
78
+ - Batch modes (`ids`/`symbols`) return a `succeeded`/`failed` split with per-item error strings instead of failing the call
79
+ - Errors: `not_found`, `invalid_species`, `no_input`, `conflicting_input`
80
+
81
+ ---
68
82
 
69
- Fetch any sequence type for any Ensembl feature.
83
+ ### `ensembl_get_sequence` <sub>tool</sub>
70
84
 
71
- - Molecule types: `genomic` (default, includes introns), `cdna` (spliced), `cds` (coding only), `protein`
72
- - Accepts stable IDs or `species:chr:start-end` region format for genomic region mode
73
- - Optional flanking sequence (`expand_5prime`, `expand_3prime`) in base pairs
74
- - Returns sequence with stable ID, molecule type, and character count — large sequences (e.g. BRCA2 at 85,183 bp genomic) returned in full with explicit length so callers can budget context usage
85
+ - `type`: `genomic` (default, includes introns), `cdna` (spliced), `cds` (coding only), `protein`
86
+ - Accepts a stable ID (`ENSG…`/`ENST…`/`ENSP…`) or a region — `species:chr:start-end`, or bare `chr:start-end` with `species` set; a region spans at most 10,000,000 bases, with start at or below end
87
+ - `expand_5prime` / `expand_3prime` (default `0`) extend flanking base pairs for genomic and region queries
88
+ - `protein` and `cds` require a transcript or protein ID, not a gene ID; region ids are genomic-only
89
+ - Returns a bounded window: `offset` (0-based, default `0`) and `max_length` (default `10000`, `0` for the rest uncapped) index the resolved sequence, flanks included
90
+ - `length` is always the full sequence length; `truncated` and `nextOffset` say whether more follows and where to resume, so walking `nextOffset` reconstructs the whole sequence
91
+ - Errors: `not_found`, `type_mismatch`, `missing_species`, `invalid_region`
75
92
 
76
93
  ---
77
94
 
78
- ### `ensembl_query_region`
95
+ ### `ensembl_query_region` <sub>tool</sub>
96
+
97
+ - `region` in `chr:start-end` format, at most 5,000,000 bases; `feature` array (at least one) defaults to `["gene"]`, also accepts `transcript`, `variation`, `regulatory`, `exon`; optional `biotype` filter
98
+ - Defaults to genes only — requesting `variation` on a large locus can match 44,000+ features
99
+ - `max_results` caps the feature list (default `100`, `0` uncapped); `totalCount` always reports the true count found
100
+ - `assemblyName` (e.g. `GRCh38`) names the assembly the coordinates are on
101
+ - Exon rows carry a `parentId` and `rank`, since one exon is reported once per parent transcript
102
+ - Errors: `invalid_region`, `invalid_species`
79
103
 
80
- Find all genomic features overlapping a chromosomal window.
104
+ ---
81
105
 
82
- - Region format: `chr:start-end` (e.g. `13:32315086-32400268`) — no `chr` prefix for vertebrates
83
- - Feature types: `gene` (default), `transcript`, `variation`, `regulatory`, `exon`
84
- - Optional biotype filter
85
- - Defaults to gene only to prevent context overload — a large locus can contain 44,000+ variants when all feature types are selected
106
+ ### `ensembl_predict_variant` <sub>tool</sub>
107
+
108
+ - `variant` accepts HGVS (transcript-relative or genomic), region+allele (`chr:start:end:strand/allele`), or a dbSNP rsID
109
+ - `max_transcript_consequences` (default `10`) and `max_pubmed_ids_per_variant` (default `10`) cap large VEP results; set either to `0` for the full set, or `include_all_colocated_pubmed: true` for uncapped PubMed IDs
110
+ - Returns most severe consequence term, per-transcript impact (HIGH/MODERATE/LOW/MODIFIER), and colocated known variants with clinical significance
111
+ - Totals (`transcriptConsequencesTotal`, `pubmedTotal`) are always reported even when capped
112
+ - Errors: `invalid_notation`, `not_found`
86
113
 
87
114
  ---
88
115
 
89
- ### `ensembl_predict_variant`
116
+ ### `ensembl_get_homology` <sub>tool</sub>
117
+
118
+ - Exactly one of `symbol` (+ `species`, default `homo_sapiens`) or `id`; optional `target_species` filter
119
+ - `type`: `orthologues` (default), `paralogues`, or `all`
120
+ - `max_results` caps the homolog list (default `25`, `0` uncapped); `totalCount` always reports the true count available
121
+ - Errors: `not_found`, `no_input`, `conflicting_input`
90
122
 
91
- Predict variant consequences via the Ensembl VEP.
123
+ ---
124
+
125
+ ### `ensembl_get_xrefs` <sub>tool</sub>
92
126
 
93
- - Accepts HGVS notation (transcript-relative: `ENST00000380152.8:c.2T>A`) or genomic region+allele format (`13:32316462:32316462:1/A`)
94
- - Returns most severe consequence term, affected transcripts and genes, impact level (HIGH/MODERATE/LOW/MODIFIER)
95
- - Includes colocated known variants with clinical significance (ClinVar, dbSNP)
96
- - Errors: `invalid_notation` (check format), `not_found` (location outside any known transcript)
127
+ - `id` (`ENSG…`/`ENST…`) required; optional `dbname` filter (e.g. `HGNC`, `Uniprot_gn`, `EntrezGene`, `MIM_GENE`, `RefSeq_mRNA`, `Reactome`, `GO`)
128
+ - Uses the `xrefs/id` endpoint, returning the full cross-reference set (56+ entries for well-annotated genes like BRCA2)
129
+ - Errors: `not_found`
97
130
 
98
131
  ---
99
132
 
100
- ### `ensembl_get_homology`
133
+ ### `ensembl://gene/{id}` <sub>resource</sub>
134
+
135
+ - Returns location, biotype, description, and transcript list for a gene stable ID (`ENSG…`); version suffix optional
136
+ - Errors: `not_found`
137
+
138
+ ---
101
139
 
102
- Cross-species homolog lookup.
140
+ ### `ensembl://transcript/{id}` <sub>resource</sub>
103
141
 
104
- - Returns orthologs (default) or paralogs, or both
105
- - Optional `target_species` filter to narrow to specific organisms
106
- - Each homolog carries stable ID, species, relationship type (ortholog_one2one, ortholog_one2many, etc.), `perc_id`, `perc_pos`, and taxonomy level
142
+ - Returns parent gene, location, biotype, canonical flag, and length for a transcript stable ID (`ENST…`); version suffix optional
143
+ - Errors: `not_found`
107
144
 
108
145
  ---
109
146
 
110
- ### `ensembl_get_xrefs`
147
+ ### `ensembl://species` <sub>resource</sub>
111
148
 
112
- Full cross-database reference set for any Ensembl feature.
149
+ - No parameters — returns the endpoint default division (vertebrates, ~356 species on the default GRCh38 endpoint)
150
+ - For a named division, read `ensembl://species/{division}` instead
113
151
 
114
- - Returns all external IDs by default: HGNC, UniProt, EntrezGene, OMIM, RefSeq, Reactome, and more (56 xrefs for BRCA2)
115
- - Optional `dbname` filter (e.g. `HGNC`, `Uniprot_gn`, `EntrezGene`, `MIM_GENE`) to narrow output
116
- - Uses the `xrefs/id` endpoint (not `xrefs/symbol`) — returns the full cross-reference set
117
- - IDs returned here chain directly to protein, literature, disease, and pathway resources in other MCP servers
152
+ ---
118
153
 
119
- ## Resources and prompts
154
+ ### `ensembl://species/{division}` <sub>resource</sub>
120
155
 
121
- | Type | Name | Description |
122
- |:-----|:-----|:------------|
123
- | Resource | `ensembl://gene/{id}` | Gene record by stable ID (`ENSG…`) — location, biotype, description, and transcript list |
124
- | Resource | `ensembl://transcript/{id}` | Transcript record by stable ID (`ENST…`) — parent gene, location, biotype, canonical flag, and length |
125
- | Resource | `ensembl://species` | Supported Ensembl species for the endpoint default division (vertebrates on the default endpoint) with name, display name, assembly, taxon ID, and division |
126
- | Resource | `ensembl://species/{division}` | Supported species in one division (`EnsemblVertebrates`, `EnsemblPlants`, `EnsemblFungi`, `EnsemblMetazoa`, `EnsemblProtists`) |
127
- | Prompt | `ensembl_gene_dossier` | Structured workflow for assembling a complete gene profile: symbol → ID + location → sequence → variants → orthologs → xrefs |
156
+ - `division` required: `EnsemblVertebrates`, `EnsemblPlants`, `EnsemblFungi`, `EnsemblMetazoa`, or `EnsemblProtists`
128
157
 
129
- All resource data is also reachable via tools. `ensembl://species` returns the endpoint default division (vertebrates) and `ensembl://species/{division}` returns a named division; `ensembl_list_species` is the tool equivalent, filtering by division and name.
158
+ ---
130
159
 
131
- ## Features
160
+ ### `ensembl_gene_dossier` <sub>prompt</sub>
132
161
 
133
- Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
162
+ - Arguments: `gene_symbol` required; `species` optional (default `homo_sapiens`)
163
+ - Sequences a 7-step workflow: resolve the gene → fetch the protein sequence → find variants in the locus → predict variant consequences → find cross-species orthologs → get external database IDs → synthesize the dossier
164
+
165
+ ## Features
134
166
 
135
- - Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
136
- - Unified error handling — handlers throw, framework catches, classifies, and formats
137
- - Pluggable auth: `none`, `jwt`, `oauth`
138
- - Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
139
- - Structured logging with optional OpenTelemetry tracing
140
- - STDIO and Streamable HTTP transports
167
+ Built on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core): stdio and Streamable HTTP transports, pluggable auth (`none` / `jwt` / `oauth`), swappable storage (`in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`), structured logging with optional OpenTelemetry tracing.
141
168
 
142
169
  Ensembl-specific:
143
170
 
144
171
  - Keyless REST API — no API key required; Ensembl REST is fully public at 55,000 req/hr
145
- - Rate-limit-aware service layer: tracks `x-ratelimit-remaining`, retries 429 with `Retry-After`, and retries transient 5xx
146
- - Batch POST endpoints used throughout — `POST /lookup/id` (up to 50 IDs) and `POST /lookup/symbol/{species}` reduce N+1 round trips in multi-gene workflows
172
+ - Rate-limit-aware service layer: retries 429 honoring `Retry-After`, and retries transient 5xx and HTML error pages
173
+ - Batch POST endpoints used throughout — `POST /lookup/id` and `POST /lookup/symbol/{species}` (up to 1,000 items each upstream) reduce N+1 round trips in multi-gene workflows
147
174
  - GRCh37 legacy support via `ENSEMBL_BASE_URL` — point the entire server at `https://grch37.rest.ensembl.org` for clinical workflows on the older assembly
148
175
  - All coordinate-bearing responses echo the assembly name so agents never see a bare genomic position without assembly context
149
176
 
150
177
  Agent-friendly output:
151
178
 
152
- - Sequence character count stated on every `ensembl_get_sequence` response so callers can budget context before consuming large genomic sequences
179
+ - `ensembl_get_sequence` returns sequences in bounded windows (10,000 characters by default) with the full length and a `nextOffset` to continue, so a long gene or locus never lands in one response unasked
153
180
  - `ensembl_list_species` is explicitly the discovery step — tool descriptions call out the opaque internal-name format and direct agents to it before using species-dependent tools
154
- - Cross-tool chaining made explicit: xref IDs from `ensembl_get_xrefs` are described as inputs for protein and literature servers; the `ensembl_gene_dossier` prompt sequences the full 7-tool research workflow
181
+ - Cross-tool chaining made explicit: xref IDs from `ensembl_get_xrefs` are described as inputs for protein and literature servers; the `ensembl_gene_dossier` prompt sequences all 6 tools into one research workflow
155
182
 
156
183
  ## Getting started
157
184
 
@@ -339,7 +366,7 @@ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rule
339
366
 
340
367
  ## Contributing
341
368
 
342
- Issues and pull requests are welcome. Run checks and tests before submitting:
369
+ Issues are welcome. Run checks and tests before submitting:
343
370
 
344
371
  ```sh
345
372
  bun run devcheck