Repository navigation
fix(helper-mcp): sdk ^1.32.0, zod ^4.6.7 and the patched express chain (abilityai/trinity-enterprise#1117) - #4291
Merged
Conversation
….6.7 (Abilityai/trinity-enterprise#1117) trinity-docs-mcp is a published npm package, so consumers resolve from the package.json ranges rather than this lockfile. Raise the SDK floor to ^1.32.0 (fixed releases for the four SDK advisories) and move zod to ^4.6.7 (the zod advisory has no 3.x fix). The lock also picks up the patched express chain: proxy-addr 2.0.8, body-parser 2.4.0, qs 6.17.1, fast-uri 3.1.9, hono 4.13.16, @hono/node-server 2.1.6, ip-address 10.7.6. npm audit: critical 1, high 3, moderate 5 before; 0 after. Runtime behaviour is unchanged. Under zod 4 the advertised ask_trinity inputSchema no longer carries additionalProperties:false (extra keys were and still are accepted), and validation messages are worded differently. A new test pins the observed contract: an oversize question comes back as a JSON-RPC result with isError:true and "MCP error -32602: Input validation error" text, without reaching the docs endpoint.
…ityai/trinity-enterprise#1117) The previous commit changes a runtime dependency major, so the next trinity-docs-mcp release should be 0.2.0 rather than an automatic patch. SERVER_VERSION (reported as serverInfo.version) and package.json now say 0.2.0; the release is cut by pushing the tag helper-mcp-v0.2.0.
…bilityai/trinity-enterprise#1117) A number, null, an array or a missing value for question, and null or a number for session_id, each return the -32602 input-validation result naming the field, and the docs endpoint is never called. A schema that coerced question to a string would now fail three of these cases. zod 4 counts a string's length in code points, zod 3 counted UTF-16 code units. Pin what that means here: 4001 UTF-16 units in 2001 code points passes the schema and is stopped by the client guard with its own text, 4000 units is accepted, and 4001 code points is still rejected by the schema. The unknown-key test now also checks the forwarded body.
…ched dependency floors (Abilityai/trinity-enterprise#1117) SERVER_VERSION was a string literal, so any release whose version the publish workflow writes into package.json (every automatic patch release) would report a stale number in serverInfo and the startup log. Read it from the package's own package.json, which sits one level above both src/ and dist/ and is always in the published tarball. A missing version fails at startup instead of reporting an empty one. Also pin that the lockfile copies of @modelcontextprotocol/sdk, zod, proxy-addr and body-parser, and the declared sdk and zod ranges, stay at or above the first patched versions of the advisories fixed here.
…ops startup (Abilityai/trinity-enterprise#1117) readPackageVersion now takes the manifest URL and is exported, so the refusal path is tested directly: no version field, an empty version and a numeric version each throw "package.json at ... has no version", and a valid version is returned. A version that silently fell back to a default would fail all three refusal cases.
…117-s2-helper-mcp-zod4
obasilakis
approved these changes
Nov 6, 2026
obasilakis
left a comment
Contributor
There was a problem hiding this comment.
Reviewed (code review + /validate-pr, lane B). Approving.
Mutation: reverting package.json/lock to the dev base turns 6/50 tests red (astral text, exact schema, four dependency floors). Local: tsc clean, npm test 50/50, npm audit 0.
Non-blocking:
src/helper-mcp/src/server.ts:18—SERVER_VERSIONis read at module load, so a bad package.json throws during import, outsidemain().catch. Node still exits non-zero, but without the[trinity-docs] fatal:line. Reading it insidecreateServer/mainroutes it through the handler.- The serverInfo version test passes when the version is hard-coded as "0.2.0", since that equals package.json. Asserting against a version rewritten in the test would pin it.
- Several cases in
ent1117-s2-input-validation.test.tsalso pass on zod 3. They are pins, not evidence for the bump.
…117-s2-helper-mcp-zod4
AndriiPasternak31
marked this pull request as ready for review
November 6, 2026 19:08
yunyminaya
pushed a commit
to yunyminaya/trinity
that referenced
this pull request
Nov 11, 2026
Abilityai/trinity-enterprise#1117) (Abilityai#4291) * fix(helper-mcp): move to @modelcontextprotocol/sdk ^1.32.0 and zod ^4.6.7 (Abilityai/trinity-enterprise#1117) trinity-docs-mcp is a published npm package, so consumers resolve from the package.json ranges rather than this lockfile. Raise the SDK floor to ^1.32.0 (fixed releases for the four SDK advisories) and move zod to ^4.6.7 (the zod advisory has no 3.x fix). The lock also picks up the patched express chain: proxy-addr 2.0.8, body-parser 2.4.0, qs 6.17.1, fast-uri 3.1.9, hono 4.13.16, @hono/node-server 2.1.6, ip-address 10.7.6. npm audit: critical 1, high 3, moderate 5 before; 0 after. Runtime behaviour is unchanged. Under zod 4 the advertised ask_trinity inputSchema no longer carries additionalProperties:false (extra keys were and still are accepted), and validation messages are worded differently. A new test pins the observed contract: an oversize question comes back as a JSON-RPC result with isError:true and "MCP error -32602: Input validation error" text, without reaching the docs endpoint. * chore(helper-mcp): version 0.2.0 for the zod 4 dependency major (Abilityai/trinity-enterprise#1117) The previous commit changes a runtime dependency major, so the next trinity-docs-mcp release should be 0.2.0 rather than an automatic patch. SERVER_VERSION (reported as serverInfo.version) and package.json now say 0.2.0; the release is cut by pushing the tag helper-mcp-v0.2.0. * test(helper-mcp): pin wrong-type, null and astral ask_trinity inputs (Abilityai/trinity-enterprise#1117) A number, null, an array or a missing value for question, and null or a number for session_id, each return the -32602 input-validation result naming the field, and the docs endpoint is never called. A schema that coerced question to a string would now fail three of these cases. zod 4 counts a string's length in code points, zod 3 counted UTF-16 code units. Pin what that means here: 4001 UTF-16 units in 2001 code points passes the schema and is stopped by the client guard with its own text, 4000 units is accepted, and 4001 code points is still rejected by the schema. The unknown-key test now also checks the forwarded body. * fix(helper-mcp): report the installed package version and pin the patched dependency floors (Abilityai/trinity-enterprise#1117) SERVER_VERSION was a string literal, so any release whose version the publish workflow writes into package.json (every automatic patch release) would report a stale number in serverInfo and the startup log. Read it from the package's own package.json, which sits one level above both src/ and dist/ and is always in the published tarball. A missing version fails at startup instead of reporting an empty one. Also pin that the lockfile copies of @modelcontextprotocol/sdk, zod, proxy-addr and body-parser, and the declared sdk and zod ranges, stay at or above the first patched versions of the advisories fixed here. * test(helper-mcp): pin that a package.json without a usable version stops startup (Abilityai/trinity-enterprise#1117) readPackageVersion now takes the manifest URL and is exported, so the refusal path is tested directly: no version field, an empty version and a numeric version each throw "package.json at ... has no version", and a valid version is returned. A version that silently fell back to a default would fail all three refusal cases. (cherry picked from commit 3acf8ef)
vybe
added a commit
to jordanallenlewis/determinity
that referenced
this pull request
Nov 19, 2026
main carries 7 commits that are not ancestors of dev: the ent#1117 security back-ports (Abilityai#4291, Abilityai#4294, Abilityai#4314, Abilityai#4315, Abilityai#4399, Abilityai#4400) and the llms.txt refresh (Abilityai#4287). Every one of them is already on dev in its original form, so this is a merge with dev's tree kept as-is (strategy ours). It records main as a parent so the dev -> main release PR no longer conflicts. Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.
Part of abilityai/trinity-enterprise#1117.
Journey Impact: none: dependency update of the published docs MCP helper; the ask_trinity tool behaves the same for valid input
Problem
src/helper-mcpis the publishedtrinity-docs-mcpnpm package. It has seven open Critical/High Dependabot alerts:The zod advisory has no 3.x fix. Because this is a published package, consumers resolve from the
package.jsonranges and never see our lockfile. Updating the lock alone would leave every fresh install vulnerable.Fix
@modelcontextprotocol/sdkmoves from^1.30.0to^1.32.0, andzodfrom^3.24.1to^4.6.7.package.jsonmoves to 0.2.0, because a runtime dependency changed major.serverInfo.versionand the startup log) from its ownpackage.jsoninstead of a hard-coded string. The publish workflow writes the release version into that field before it builds, so every release reports the version that is actually installed.package.jsonwith no version, an empty version or a non-string version stops the server at startup.What clients will notice:
ask_trinityinput schema no longer contains"additionalProperties": false. This comes from zod 4: sdk 1.32.2 with zod 3 still emits it. Unknown keys were accepted and dropped before, and still are; they are not sent to the docs endpoint.Too big: expected string to have <=4000 characters at questioninstead ofString must contain at most 4000 character(s) at question.isError: trueand text startingMCP error -32602: Input validation error, and the docs endpoint is not called.isError: truewithThe question is N characters — the limit is 4000. Shorten it and try again., not the −32602 text.Release
This merges to
devand reachesmainwith the next release cut. Neither step publishes 0.2.0 on its own.Why nothing publishes automatically: on a push to
main,publish-helper-mcp.ymlderives the version from the latesthelper-mcp-v*tag. None exists, so it computes 0.1.0, finds that version on npm, and skips.The CI publish step has never succeeded:
@abilityai/trinity-docs-mcp. All five reachednpm publishand failed there; their logs have expired.trinity-docs-mcpskipped. So publishing through npm trusted publishing (OIDC) has never run for this package.Before pushing the tag, a maintainer with the npm login opens npmjs.com →
trinity-docs-mcp→ Settings → Trusted Publisher and confirms there is a GitHub Actions publisher with:Abilityai(capital A)trinitypublish-helper-mcp.ymlnpm publishallowed, not only staged publishingnpm does not validate these fields when they are saved, and it treats them as case-sensitive and exact.
Release steps:
devreachesmain. Then let that push'sPublish Helper MCP to npmrun finish. It should logPublishing version: 0.1.0and skip.helper-mcp-v0.2.0on thatmaincommit. Order matters: if the tag exists before amainrun reads tags, that run would publish 0.2.1 as well.After the tag, check:
Publish to npmsucceeded.npm view trinity-docs-mcp versionreturns0.2.0.npm view [email protected] dist.attestationsis not empty.npx -y [email protected]logsv0.2.0 ready.main.Evidence
npm audit: before,critical 1, high 3, moderate 5; after,found 0 vulnerabilities.tsc: clean before and after. The test files also type-check under strict mode.npm test: 26/26 before, 50/50 after.scripts/smoke.mjs(pack, install, stdio): green on Node 18.20.8, 22 and 24, reportingv0.2.0. With the version rewritten to 0.2.1, as the publish workflow does, it reportsv0.2.1.The new tests pin:
result, not anerror.question, and null or a number forsession_id, each return the −32602 result naming the field. The endpoint is not called.package.json's, and a manifest with no version, an empty version or a numeric version is refused.These tests fail on the old dependencies:
+ additionalProperties: false;node_modules/proxy-addr is 2.0.7, below 2.0.8.Mutation checks:
questiontoz.coerce.string()fails three of the invalid-argument tests.session_idtonullableoranyfails the session cases.Fresh install of the packed tarball outside the repo, with no lockfile, on Node 18.20.8 (the lowest
enginesallows) and on Node 24: initialize, tools/list,ask_trinityand the oversize rejection all behave as above.Not covered
mainplus the tag. It needs the trusted-publisher check above, and it would be this workflow's first successful publish.package.jsonhasrepository.urlasgit+https://github.com/abilityai/trinity.git, all lowercase, while GitHub reports the owner asAbilityai. npm says that field must exactly match the GitHub repository for provenance. Whether npm compares the owner case-insensitively there, or in the trusted-publisher fields, is not verified. The first tag publish will show it.@hono/node-server1.19.18 there, because 2.x requires Node ≥20. That version is inside a Moderate advisory (GHSA-rmxm-3fg6-px4f,serveStatic). Only the SDK's HTTP server transport uses that code, and this package is stdio-only. Raisingenginesto>=20would close it; that is left as a separate decision.npx, which installs in isolation. npm can hoist the SDK next to the project's zod 3. The SDK then renders the advertised schema withoutmaxLengthand the descriptions. Validation still rejects oversize and invalid input in that layout. 0.1.0 rendered the full schema there, but the README documents onlynpx.