Fix context window overflow and patch all npm security vulnerabilities#17
Draft
Copilot wants to merge 4 commits into
Draft
Fix context window overflow and patch all npm security vulnerabilities#17Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
- Add MAX_RESPONSE_SIZE (50 000 chars) constant and truncateResponse helper that serialises data to JSON and appends a guidance note when the result would exceed the limit. - Strip the verbose per-column `schema` field from getCollections responses; system collections alone can produce 100 KB+ of schema detail that is rarely needed. - Apply a default limit:50 to all list endpoints (getItems, getActivity, getFiles, getUsers, getRoles, getPermissions) so that callers get a manageable page of results unless they explicitly request more. - Route every tool response through truncateResponse instead of a raw JSON.stringify call. Agent-Logs-Url: https://github.com/pixelsock/directus-mcp/sessions/87c79510-f24b-4b00-86aa-20dd65d67504 Co-authored-by: pixelsock <4932231+pixelsock@users.noreply.github.com>
- Expand MAX_RESPONSE_SIZE comment to explain the 50 000 char threshold (Claude context window, ~12 500 tokens, room for history) - Add NOTE to truncation message warning callers that the JSON may be incomplete at the cut point and guiding them to use limit/offset Agent-Logs-Url: https://github.com/pixelsock/directus-mcp/sessions/87c79510-f24b-4b00-86aa-20dd65d67504 Co-authored-by: pixelsock <4932231+pixelsock@users.noreply.github.com>
@modelcontextprotocol/inspector: 0.10.2 -> ^0.16.6 - Fixes XSS / command execution via untrusted MCP server (< 0.16.6) - Fixes missing auth between Inspector client and proxy (< 0.14.1) axios: ^1.6.7 -> ^1.15.0 - Fixes DoS via missing data-size check (GHSA-4hjh-wcwx-xvwj) - Fixes DoS via __proto__ key in mergeConfig (GHSA-43fc-jf86-j433) - Fixes NO_PROXY hostname normalisation bypass / SSRF (GHSA-3p68-rc4w-qgx5) - Fixes unrestricted cloud metadata exfiltration (GHSA-fvcv-3m26-pcqx) form-data: ^4.0.0 -> ^4.0.4 - Fixes unsafe random boundary generation (GHSA-fjxv-7rqg-78g4, critical) path-to-regexp (transitive, via @modelcontextprotocol/sdk -> express -> router): - Bumped to ^8.4.0 via npm audit fix - Fixes two ReDoS vulnerabilities (GHSA-j3q9-mxjg-w52f, GHSA-27v5-c462-wpq7) Agent-Logs-Url: https://github.com/pixelsock/directus-mcp/sessions/87c79510-f24b-4b00-86aa-20dd65d67504 Co-authored-by: pixelsock <4932231+pixelsock@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Claude hitting the maximum length on every other question
Fix context window overflow and patch all npm security vulnerabilities
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude exhausts its context window after the first tool call because every API response was returned verbatim — a single
getCollectionscall on a self-hosted instance produces 100 KB+ of schema JSON, leaving almost no room for subsequent exchanges.Response size fixes
truncateResponsehelper — serialises to pretty JSON and caps output at 50 000 chars (~12 500 tokens), appending a guidance note when truncated so the LLM knows to uselimit/offsetgetCollections— strips the verbose per-columnschemafield from every collection entry before serialising;collectionandmetaare preservedlimit: 50on all unbounded list endpoints (getItems,getActivity,getFiles,getUsers,getRoles,getPermissions) — caller-supplied value wins via spreadtruncateResponseinstead of rawJSON.stringifySecurity patches
@modelcontextprotocol/inspector^0.10.2^0.16.6axios^1.6.7^1.15.0form-data^4.0.0^4.0.4path-to-regexp(transitive)8.2.0^8.4.0