fix(mcp): align lifecycle envelope, strip raw_message from get_review, doc drift - #659
Merged
Conversation
- README: correct counts to 60 tools / 16 runtime / 44 admin; drop the false claim that agent-scope credentials can view a pending review queue - create_webhook/list_events: add agent.suppression_added to the documented event types (backend accepts it; omission made LLMs refuse to subscribe) - update_protection: document the DMARC-pass precondition for inbound allowlist/domain gates
- get_message_lifecycle now returns the frozen MCP list envelope
({transitions, next_cursor?}) instead of the raw REST page
- get_review (and legacy get_pending_message) project held messages through
the same context-safe view as get_message: no raw_message base64 MIME or
attachment bytes in model context; approve_review unaffected
- approve_review description reflects queue-first 202-accepted semantics
(was 'SENT via SES')
- McpClient.listEvents param renamed agentId -> agentEmail to match the SDK
(spread had silently bypassed excess-property checking)
The review tools' context-safe projection (messageViewForTool, shared with get_message) dropped hold_reason — the server's primary hold explanation, set only on the review surface and the sole explanation when the best-effort protection enrichment degrades. Wrap the projection in reviewViewForTool (get_review + get_pending_message alias) so hold_reason survives; get_message's output shape is unchanged. Co-Authored-By: Kimi <noreply@moonshot.ai>
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.
Summary
Three MCP server issues found in a cross-surface review, plus tool-description corrections:
get_message_lifecyclebroke the frozen list-envelope contract — it returned the raw REST page ({items, next_cursor: null}) whileutil.tsdeclares the domain-named-array + omit-next_cursor-when-done shape frozen. Now returns{transitions, next_cursor?}like every other list tool. The tool is beta, so the output change is permitted pre-stable.get_reviewleaked fullraw_messagebase64 MIME into model context — multi-MB per held inbound message. It now uses the same context-safe projection asget_message(sharedmessageViewForToolhelper; legacyget_pending_messagealias too).approve_reviewis unaffected — it builds payloads from caller override fields only.McpClient.listEventsdeclaredagentId?: stringbut the SDK takesagentEmail; the spread caller silently bypassed excess-property checking. Renamed.Description fixes:
create_webhook/list_eventsnow list the validagent.suppression_addedevent type;approve_reviewno longer claims "SENT via SES" (queue-first 202-accepted semantics);update_protectiondocuments the DMARC-pass precondition for inbound gates; README counts corrected to 60/16/44 and the false "agents can view their pending queue" claim removed.Client surface checklist
mcp/src/tools/+ registry assertion inmcp/tests/tools.test.ts(envelope + projection tests updated/added)test:typespass)Intentionally skipped: REST/SDK/CLI/web rows — no REST change; the envelope and projection are MCP-output-only.
wait=sentexposure in MCP tools is a separate follow-up (needs the TS SDKSendOptions.waitlanding first).Operational risk
Low-moderate: two MCP tool outputs change shape (
get_message_lifecycle,get_review) — both beta, and the lifecycle change restores the documented frozen contract. Hosted-only deploy; no data touched. Rollback: revert.Test plan
npm test --workspace @e2a/mcp-server(236/236 + type tests)npm run build --workspace @e2a/mcp-serverget_reviewtest assertsraw_message/parsed/attachment bytes absent, metadata retained