@cyanheads/ensembl-mcp-server 0.1.1

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 (69) hide show
  1. package/AGENTS.md +383 -0
  2. package/CLAUDE.md +383 -0
  3. package/Dockerfile +99 -0
  4. package/LICENSE +201 -0
  5. package/README.md +326 -0
  6. package/changelog/0.1.x/0.1.1.md +31 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +14 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +21 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +40 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.d.ts +10 -0
  17. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.d.ts.map +1 -0
  18. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.js +60 -0
  19. package/dist/mcp-server/prompts/definitions/gene-dossier.prompt.js.map +1 -0
  20. package/dist/mcp-server/resources/definitions/gene.resource.d.ts +15 -0
  21. package/dist/mcp-server/resources/definitions/gene.resource.d.ts.map +1 -0
  22. package/dist/mcp-server/resources/definitions/gene.resource.js +59 -0
  23. package/dist/mcp-server/resources/definitions/gene.resource.js.map +1 -0
  24. package/dist/mcp-server/resources/definitions/species.resource.d.ts +15 -0
  25. package/dist/mcp-server/resources/definitions/species.resource.d.ts.map +1 -0
  26. package/dist/mcp-server/resources/definitions/species.resource.js +48 -0
  27. package/dist/mcp-server/resources/definitions/species.resource.js.map +1 -0
  28. package/dist/mcp-server/resources/definitions/transcript.resource.d.ts +15 -0
  29. package/dist/mcp-server/resources/definitions/transcript.resource.d.ts.map +1 -0
  30. package/dist/mcp-server/resources/definitions/transcript.resource.js +53 -0
  31. package/dist/mcp-server/resources/definitions/transcript.resource.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/get-homology.tool.d.ts +43 -0
  33. package/dist/mcp-server/tools/definitions/get-homology.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/get-homology.tool.js +183 -0
  35. package/dist/mcp-server/tools/definitions/get-homology.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts +35 -0
  37. package/dist/mcp-server/tools/definitions/get-sequence.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/get-sequence.tool.js +154 -0
  39. package/dist/mcp-server/tools/definitions/get-sequence.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/get-xrefs.tool.d.ts +28 -0
  41. package/dist/mcp-server/tools/definitions/get-xrefs.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/get-xrefs.tool.js +122 -0
  43. package/dist/mcp-server/tools/definitions/get-xrefs.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/list-species.tool.d.ts +28 -0
  45. package/dist/mcp-server/tools/definitions/list-species.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/list-species.tool.js +105 -0
  47. package/dist/mcp-server/tools/definitions/list-species.tool.js.map +1 -0
  48. package/dist/mcp-server/tools/definitions/lookup-gene.tool.d.ts +57 -0
  49. package/dist/mcp-server/tools/definitions/lookup-gene.tool.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/definitions/lookup-gene.tool.js +254 -0
  51. package/dist/mcp-server/tools/definitions/lookup-gene.tool.js.map +1 -0
  52. package/dist/mcp-server/tools/definitions/predict-variant.tool.d.ts +58 -0
  53. package/dist/mcp-server/tools/definitions/predict-variant.tool.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/definitions/predict-variant.tool.js +246 -0
  55. package/dist/mcp-server/tools/definitions/predict-variant.tool.js.map +1 -0
  56. package/dist/mcp-server/tools/definitions/query-region.tool.d.ts +48 -0
  57. package/dist/mcp-server/tools/definitions/query-region.tool.d.ts.map +1 -0
  58. package/dist/mcp-server/tools/definitions/query-region.tool.js +162 -0
  59. package/dist/mcp-server/tools/definitions/query-region.tool.js.map +1 -0
  60. package/dist/services/ensembl/ensembl-service.d.ts +32 -0
  61. package/dist/services/ensembl/ensembl-service.d.ts.map +1 -0
  62. package/dist/services/ensembl/ensembl-service.js +366 -0
  63. package/dist/services/ensembl/ensembl-service.js.map +1 -0
  64. package/dist/services/ensembl/types.d.ts +289 -0
  65. package/dist/services/ensembl/types.d.ts.map +1 -0
  66. package/dist/services/ensembl/types.js +6 -0
  67. package/dist/services/ensembl/types.js.map +1 -0
  68. package/package.json +106 -0
  69. package/server.json +113 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,326 @@
1
+ <div align="center">
2
+ <h1>@cyanheads/ensembl-mcp-server</h1>
3
+ <p><b>Look up genes, fetch sequences, predict variant consequences, find orthologs and cross-database xrefs via Ensembl REST via MCP. STDIO or Streamable HTTP.</b>
4
+ <div>7 Tools • 3 Resources • 1 Prompt</div>
5
+ </p>
6
+ </div>
7
+
8
+ <div align="center">
9
+
10
+ [![Version](https://img.shields.io/badge/Version-0.1.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/ensembl-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.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-^6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.11-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
+
12
+ </div>
13
+
14
+ <div align="center">
15
+
16
+ [![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/ensembl-mcp-server/releases/latest/download/ensembl-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=ensembl-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZW5zZW1ibC1tY3Atc2VydmVyIl19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22ensembl-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fensembl-mcp-server%22%5D%7D)
17
+
18
+ [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## Tools
25
+
26
+ 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:
27
+
28
+ | Tool | Description |
29
+ |:-----|:------------|
30
+ | `ensembl_list_species` | List species supported by Ensembl with display name, common name, assembly, taxon ID, and division |
31
+ | `ensembl_lookup_gene` | Resolve a gene by symbol + species or by stable ID to its Ensembl ID, genomic location, biotype, and transcript list |
32
+ | `ensembl_get_sequence` | Fetch the DNA, cDNA, CDS, or protein sequence for a gene, transcript, protein, or genomic region |
33
+ | `ensembl_query_region` | Find genomic features (genes, transcripts, variants, regulatory elements, exons) overlapping a chromosomal region |
34
+ | `ensembl_predict_variant` | Predict functional consequences of a sequence variant using the Ensembl Variant Effect Predictor (VEP) |
35
+ | `ensembl_get_homology` | Find orthologs and/or paralogs of a gene across species with percent identity and taxonomy level |
36
+ | `ensembl_get_xrefs` | Retrieve cross-database references for a gene — HGNC, UniProt, EntrezGene, OMIM, RefSeq, Reactome, and others |
37
+
38
+ ### `ensembl_list_species`
39
+
40
+ Discovery tool for the Ensembl species catalog.
41
+
42
+ - Filter by division: vertebrates, plants, fungi, metazoa, or protists
43
+ - Optional name filter (`nameContains`) for local substring matching
44
+ - Returns display name, common name, assembly, taxon ID, and Ensembl division for each species
45
+ - Required first step — species names like `homo_sapiens` are opaque to non-biologists and are the input format every other tool expects
46
+
47
+ ---
48
+
49
+ ### `ensembl_lookup_gene`
50
+
51
+ Single entry point for resolving gene identity.
52
+
53
+ - Symbol + species lookup (`BRCA2` + `homo_sapiens`) or direct stable ID lookup (`ENSG00000139618`)
54
+ - Batch lookup of up to 20 IDs or symbols in one call via POST endpoints
55
+ - Optional transcript expansion — returns full transcript list with biotype and canonical flag
56
+ - Returns Ensembl stable ID, genomic location (chr:start-end:strand), biotype, description, and transcript list
57
+ - Errors: `not_found` (symbol or ID not in Ensembl), `invalid_species` (call `ensembl_list_species` to discover valid names)
58
+
59
+ ---
60
+
61
+ ### `ensembl_get_sequence`
62
+
63
+ Fetch any sequence type for any Ensembl feature.
64
+
65
+ - Molecule types: `genomic` (default, includes introns), `cdna` (spliced), `cds` (coding only), `protein`
66
+ - Accepts stable IDs or `species:chr:start-end` region format for genomic region mode
67
+ - Optional flanking sequence (`expand_5prime`, `expand_3prime`) in base pairs
68
+ - 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
69
+
70
+ ---
71
+
72
+ ### `ensembl_query_region`
73
+
74
+ Find all genomic features overlapping a chromosomal window.
75
+
76
+ - Region format: `chr:start-end` (e.g. `13:32315086-32400268`) — no `chr` prefix for vertebrates
77
+ - Feature types: `gene` (default), `transcript`, `variation`, `regulatory`, `exon`
78
+ - Optional biotype filter
79
+ - Defaults to gene only to prevent context overload — a large locus can contain 44,000+ variants when all feature types are selected
80
+
81
+ ---
82
+
83
+ ### `ensembl_predict_variant`
84
+
85
+ Predict variant consequences via the Ensembl VEP.
86
+
87
+ - Accepts HGVS notation (transcript-relative: `ENST00000380152.8:c.2T>A`) or genomic region+allele format (`13:32316462:32316462:1/A`)
88
+ - Returns most severe consequence term, affected transcripts and genes, impact level (HIGH/MODERATE/LOW/MODIFIER)
89
+ - Includes colocated known variants with clinical significance (ClinVar, dbSNP)
90
+ - Errors: `invalid_notation` (check format), `not_found` (location outside any known transcript)
91
+
92
+ ---
93
+
94
+ ### `ensembl_get_homology`
95
+
96
+ Cross-species homolog lookup.
97
+
98
+ - Returns orthologs (default) or paralogs, or both
99
+ - Optional `target_species` filter to narrow to specific organisms
100
+ - Each homolog carries stable ID, species, relationship type (ortholog_one2one, ortholog_one2many, etc.), `perc_id`, `perc_pos`, and taxonomy level
101
+
102
+ ---
103
+
104
+ ### `ensembl_get_xrefs`
105
+
106
+ Full cross-database reference set for any Ensembl feature.
107
+
108
+ - Returns all external IDs by default: HGNC, UniProt, EntrezGene, OMIM, RefSeq, Reactome, and more (56 xrefs for BRCA2)
109
+ - Optional `dbname` filter (e.g. `HGNC`, `Uniprot_gn`, `EntrezGene`, `MIM_GENE`) to narrow output
110
+ - Uses the `xrefs/id` endpoint (not `xrefs/symbol`) — returns the full cross-reference set
111
+ - IDs returned here chain directly to protein, literature, disease, and pathway resources in other MCP servers
112
+
113
+ ## Resources and prompts
114
+
115
+ | Type | Name | Description |
116
+ |:-----|:-----|:------------|
117
+ | Resource | `ensembl://gene/{id}` | Gene record by stable ID (`ENSG…`) — location, biotype, description, and transcript list |
118
+ | Resource | `ensembl://transcript/{id}` | Transcript record by stable ID (`ENST…`) — parent gene, location, biotype, canonical flag, and length |
119
+ | Resource | `ensembl://species` | Full list of supported Ensembl species with name, display name, assembly, taxon ID, and division |
120
+ | Prompt | `ensembl_gene_dossier` | Structured workflow for assembling a complete gene profile: symbol → ID + location → sequence → variants → orthologs → xrefs |
121
+
122
+ All resource data is also reachable via tools. The `ensembl://species` resource provides the full species catalog with cursor pagination; `ensembl_list_species` is the tool equivalent with filtering support.
123
+
124
+ ## Features
125
+
126
+ Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
127
+
128
+ - Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
129
+ - Unified error handling — handlers throw, framework catches, classifies, and formats
130
+ - Pluggable auth: `none`, `jwt`, `oauth`
131
+ - Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
132
+ - Structured logging with optional OpenTelemetry tracing
133
+ - STDIO and Streamable HTTP transports
134
+
135
+ Ensembl-specific:
136
+
137
+ - Keyless REST API — no API key required; Ensembl REST is fully public at 55,000 req/hr
138
+ - Rate-limit-aware service layer: tracks `x-ratelimit-remaining`, retries 429 with `Retry-After`, and retries transient 5xx
139
+ - 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
140
+ - GRCh37 legacy support via `ENSEMBL_BASE_URL` — point the entire server at `https://grch37.rest.ensembl.org` for clinical workflows on the older assembly
141
+ - All coordinate-bearing responses echo the assembly name so agents never see a bare genomic position without assembly context
142
+
143
+ Agent-friendly output:
144
+
145
+ - Sequence character count stated on every `ensembl_get_sequence` response so callers can budget context before consuming large genomic sequences
146
+ - `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
147
+ - 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
148
+
149
+ ## Getting started
150
+
151
+ Add the following to your MCP client configuration file.
152
+
153
+ ```json
154
+ {
155
+ "mcpServers": {
156
+ "ensembl-mcp-server": {
157
+ "type": "stdio",
158
+ "command": "bunx",
159
+ "args": ["@cyanheads/ensembl-mcp-server@latest"],
160
+ "env": {
161
+ "MCP_TRANSPORT_TYPE": "stdio",
162
+ "MCP_LOG_LEVEL": "info"
163
+ }
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ Or with npx (no Bun required):
170
+
171
+ ```json
172
+ {
173
+ "mcpServers": {
174
+ "ensembl-mcp-server": {
175
+ "type": "stdio",
176
+ "command": "npx",
177
+ "args": ["-y", "@cyanheads/ensembl-mcp-server@latest"],
178
+ "env": {
179
+ "MCP_TRANSPORT_TYPE": "stdio",
180
+ "MCP_LOG_LEVEL": "info"
181
+ }
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ Or with Docker:
188
+
189
+ ```json
190
+ {
191
+ "mcpServers": {
192
+ "ensembl-mcp-server": {
193
+ "type": "stdio",
194
+ "command": "docker",
195
+ "args": [
196
+ "run", "-i", "--rm",
197
+ "-e", "MCP_TRANSPORT_TYPE=stdio",
198
+ "ghcr.io/cyanheads/ensembl-mcp-server:latest"
199
+ ]
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
205
+ For Streamable HTTP, set the transport and start the server:
206
+
207
+ ```sh
208
+ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
209
+ # Server listens at http://localhost:3010/mcp
210
+ ```
211
+
212
+ ### Prerequisites
213
+
214
+ - [Bun v1.3.11](https://bun.sh/) or higher (or Node.js v24+).
215
+ - No API key required — Ensembl REST is fully public.
216
+
217
+ ### Installation
218
+
219
+ 1. **Clone the repository:**
220
+
221
+ ```sh
222
+ git clone https://github.com/cyanheads/ensembl-mcp-server.git
223
+ ```
224
+
225
+ 2. **Navigate into the directory:**
226
+
227
+ ```sh
228
+ cd ensembl-mcp-server
229
+ ```
230
+
231
+ 3. **Install dependencies:**
232
+
233
+ ```sh
234
+ bun install
235
+ ```
236
+
237
+ 4. **Configure environment:**
238
+
239
+ ```sh
240
+ cp .env.example .env
241
+ # edit .env if you need to override ENSEMBL_BASE_URL (e.g. for GRCh37)
242
+ ```
243
+
244
+ ## Configuration
245
+
246
+ All configuration is validated at startup via Zod schemas in `src/config/server-config.ts`.
247
+
248
+ | Variable | Description | Default |
249
+ |:---------|:------------|:--------|
250
+ | `ENSEMBL_BASE_URL` | Ensembl REST API base URL. Override for GRCh37 (`https://grch37.rest.ensembl.org`) or a local mirror. | `https://rest.ensembl.org` |
251
+ | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http` | `stdio` |
252
+ | `MCP_HTTP_PORT` | HTTP server port | `3010` |
253
+ | `MCP_HTTP_ENDPOINT_PATH` | HTTP endpoint path | `/mcp` |
254
+ | `MCP_AUTH_MODE` | Authentication: `none`, `jwt`, or `oauth` | `none` |
255
+ | `MCP_LOG_LEVEL` | Log level (`debug`, `info`, `warning`, `error`, etc.) | `info` |
256
+ | `LOGS_DIR` | Directory for log files (Node.js only) | `<project-root>/logs` |
257
+ | `OTEL_ENABLED` | Enable OpenTelemetry | `false` |
258
+
259
+ See [`.env.example`](./.env.example) for the full list of optional overrides.
260
+
261
+ ## Running the server
262
+
263
+ ### Local development
264
+
265
+ - **Build and run:**
266
+
267
+ ```sh
268
+ # One-time build
269
+ bun run rebuild
270
+
271
+ # Run the built server
272
+ bun run start:stdio
273
+ # or
274
+ bun run start:http
275
+ ```
276
+
277
+ - **Run checks and tests:**
278
+
279
+ ```sh
280
+ bun run devcheck # Lint, format, typecheck, security
281
+ bun run test # Vitest test suite
282
+ bun run lint:mcp # Validate MCP definitions against spec
283
+ ```
284
+
285
+ ### Docker
286
+
287
+ ```sh
288
+ docker build -t ensembl-mcp-server .
289
+ docker run --rm -p 3010:3010 ensembl-mcp-server
290
+ ```
291
+
292
+ The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/ensembl-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.
293
+
294
+ ## Project structure
295
+
296
+ | Directory | Purpose |
297
+ |:----------|:--------|
298
+ | `src/index.ts` | `createApp()` entry point — registers tools/resources/prompts and inits services |
299
+ | `src/config` | Server-specific environment variable parsing and validation with Zod |
300
+ | `src/mcp-server/tools` | Tool definitions (`*.tool.ts`) — 7 tools |
301
+ | `src/mcp-server/resources` | Resource definitions (`*.resource.ts`) — gene, transcript, species |
302
+ | `src/mcp-server/prompts` | Prompt definitions (`*.prompt.ts`) — gene dossier workflow |
303
+ | `src/services/ensembl` | Ensembl REST API client — HTTP, rate-limit handling, retry, error normalization |
304
+ | `tests/` | Unit and integration tests mirroring `src/` |
305
+
306
+ ## Development guide
307
+
308
+ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
309
+
310
+ - Handlers throw, framework catches — no `try/catch` in tool logic
311
+ - Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage
312
+ - Register new tools and resources in the `createApp()` arrays in `src/index.ts`
313
+ - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
314
+
315
+ ## Contributing
316
+
317
+ Issues and pull requests are welcome. Run checks and tests before submitting:
318
+
319
+ ```sh
320
+ bun run devcheck
321
+ bun run test
322
+ ```
323
+
324
+ ## License
325
+
326
+ Apache-2.0 — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,31 @@
1
+ ---
2
+ summary: "Initial public release — 7 tools, 3 resources, 1 prompt over the Ensembl REST API; security hardening strips internal URL from error data"
3
+ breaking: false
4
+ security: true
5
+ ---
6
+
7
+ # 0.1.1 — 2026-06-05
8
+
9
+ Initial public release of `@cyanheads/ensembl-mcp-server`. Provides 7 tools, 3 resources, and 1 prompt over the [Ensembl REST API](https://rest.ensembl.org) (keyless):
10
+
11
+ - **`ensembl_list_species`** — list all species with display name, common name, assembly, taxon ID, and division
12
+ - **`ensembl_lookup_gene`** — resolve a gene by symbol + species or by Ensembl stable ID (ENSG…)
13
+ - **`ensembl_get_sequence`** — fetch genomic, cDNA, CDS, or protein sequence by stable ID or region string; dotted scaffold/patch names (e.g. `GL000220.1`) supported
14
+ - **`ensembl_query_region`** — overlap features (genes, transcripts, exons, variants, regulatory) within a genomic window
15
+ - **`ensembl_predict_variant`** — VEP consequence prediction for a variant in HGVS or `region/allele` notation
16
+ - **`ensembl_get_homology`** — orthologs and paralogs across species via Ensembl Compara
17
+ - **`ensembl_get_xrefs`** — external database cross-references (UniProt, RefSeq, OMIM, GO, …) for a gene or transcript
18
+
19
+ ## Added
20
+
21
+ - **`ensembl_list_species`**, **`ensembl_lookup_gene`**, **`ensembl_get_sequence`**, **`ensembl_query_region`**, **`ensembl_predict_variant`**, **`ensembl_get_homology`**, **`ensembl_get_xrefs`** — full 7-tool surface over the Ensembl REST API
22
+ - **`ensembl://gene/{id}`** resource — gene record by stable ID (ENSG…): location, biotype, description, transcript list
23
+ - **`ensembl://transcript/{id}`** resource — transcript record by stable ID (ENST…): exons, translations, biotype
24
+ - **`ensembl://species`** resource — full Ensembl species catalog
25
+ - **`ensembl_gene_dossier`** prompt — workflow prompt to build a comprehensive gene report (lookup → sequence → homology → xrefs)
26
+ - **`EnsemblService`** — rate-limit-aware REST client with retry, error normalization, and per-endpoint response mapping
27
+ - **`ENSEMBL_BASE_URL`** env var — override to point at the GRCh37 endpoint (`https://grch37.rest.ensembl.org`) or a local mirror
28
+
29
+ ## Security
30
+
31
+ - **`EnsemblService.request()`** — strips the internal request URL from `serviceUnavailable` error data; upstream URLs were previously forwarded verbatim into MCP error payloads, leaking the resolved base URL and path to clients