Skip to content

Commit 91ccc2a

Browse files
effieklimiclaude
andcommitted
feat: add pagination, raw output mode, and HTTP transport for Render deployment (Plan 13)
- Add page/page_size parameters to 5 tools for paging through large result sets - Add raw parameter to 6 tools to return unprocessed API JSON - Add StreamableHTTP transport alongside stdio for remote deployment - Add render.yaml and Dockerfile ENV/EXPOSE for Render hosting - Add validatePagination to input validator - 220 tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent abd92c3 commit 91ccc2a

9 files changed

Lines changed: 757 additions & 217 deletions

File tree

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ RUN npm run build
1919
# Remove dev dependencies to reduce image size
2020
RUN npm prune --production
2121

22+
# Default port for HTTP mode (Render overrides via env)
23+
ENV PORT=10000
24+
EXPOSE 10000
25+
2226
# Start the server
2327
CMD ["node", "dist/index.js"]

PLANS.md

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ensembl MCP Server - Improvement Plans
22

3-
> Plans 1-6 (caching, batch operations, response truncation, error handling, structured logging, retry logic), Plan 7 (Vitest), Plan 8 (MCP resources & prompts), Plan 9 (input validation), Plan 10 (GRCh37 support), and Plan 12 (CI/CD) have been implemented. The plans below cover the next round of improvements.
3+
> Plans 1-6 (caching, batch operations, response truncation, error handling, structured logging, retry logic), Plan 7 (Vitest), Plan 8 (MCP resources & prompts), Plan 9 (input validation), Plan 10 (GRCh37 support), Plan 12 (CI/CD), and Plan 13 (pagination) have been implemented. The plans below cover the next round of improvements.
44
55
---
66

@@ -94,46 +94,9 @@ Add an `ensembl_diagnostics` tool that exposes internal metrics and a health che
9494
9595
---
9696

97-
## Plan 13: Pagination for Large Result Sets
97+
## ~~Plan 13: Pagination for Large Result Sets~~ (Implemented)
9898

99-
### Problem
100-
Feature overlap queries on gene-dense regions can return thousands of results. Currently these are truncated, losing data silently. Users have no way to page through full results.
101-
102-
### Approach
103-
Add optional pagination parameters to tools that return arrays.
104-
105-
### Parameters to Add
106-
107-
On `ensembl_feature_overlap`, `ensembl_variation`, `ensembl_meta` (species):
108-
- `page`: integer, default 1
109-
- `page_size`: integer, default 50, max 200
110-
111-
### Implementation
112-
113-
**Modify: `src/utils/response-processor.ts`**
114-
- Add `paginate(data: any[], page: number, pageSize: number): PaginatedResponse`
115-
- `PaginatedResponse`: `{ data, page, page_size, total_results, total_pages, has_next }`
116-
117-
**Modify: `src/handlers/tools.ts`**
118-
- Add `page` and `page_size` to relevant tool schemas
119-
- Apply pagination after response processing
120-
121-
### Response Format
122-
```json
123-
{
124-
"data": [...],
125-
"pagination": {
126-
"page": 1,
127-
"page_size": 50,
128-
"total_results": 847,
129-
"total_pages": 17,
130-
"has_next": true
131-
}
132-
}
133-
```
134-
135-
### Size Estimate
136-
~40 lines for pagination logic, ~20 lines of schema changes.
99+
> Added `page` and `page_size` parameters to 5 tools (`ensembl_feature_overlap`, `ensembl_regulatory`, `ensembl_meta`, `ensembl_compara`, `ensembl_variation`). Extended `ProcessOptions` and `ProcessedResponse.metadata` with pagination fields (`page`, `page_size`, `total_pages`, `has_next`). Updated `truncateArray` to support offset-based slicing. `page_size` supersedes `max_results` when both provided. Out-of-range pages return empty data with correct metadata. Backward-compatible — omitting pagination params produces identical output. Added `validatePagination` to input validator, wired into all 5 tool validators. 220 tests across 7 files, all passing.
137100
138101
---
139102

@@ -171,5 +134,5 @@ Use MCP's streaming capabilities for tools that can return large payloads.
171134
| ~~4~~ | ~~Plan 12: CI/CD~~ | ~~High (quality gate)~~ | ~~Done~~ |
172135
| ~~5~~ | ~~Plan 10: GRCh37 support~~ | ~~Medium (unlocks hg19 users)~~ | ~~Done~~ |
173136
| 6 | Plan 11: Diagnostics tool | Medium (operational visibility) | Low |
174-
| 7 | Plan 13: Pagination | Medium (better data access) | Low |
137+
| ~~7~~ | ~~Plan 13: Pagination~~ | ~~Medium (better data access)~~ | ~~Done~~ |
175138
| 8 | Plan 14: Streaming | Low (nice-to-have) | Medium |

0 commit comments

Comments
 (0)