AI Engineering from Scratch(英文原版)
Design a user-input step for an MCP operation targeting protocol revision 2026-07-28.
Produce:
- Scope contract. Put the workspace, directory, or resource URI in visible tool arguments or server configuration. State which authenticated principals may use it.
- Boundary checks. Define URI normalization, path-component containment, symbolic-link policy, and the operating-system sandbox.
- Trigger condition. Name the exact ambiguity, confirmation, or external interaction that requires user input.
- Discovery and capability gate. Return exact
supportedVersions, capabilities,ttlMs, andcacheScopefromserver/discover. If tools are advertised, include mandatory deterministictools/listdescriptors with a valid objectinputSchema, server identity metadata, and cache hints. Treatelicitation: \{\}and explicitelicitation.formas form support. Reject missing or URL-only support with-32021anddata.requiredCapabilities.elicitation.form; use-32022with exactsupportedandrequesteddata for an unsupported version. - MRTR result. Return
resultType: "input_required"with a stableinputRequestskey andelicitation/createrequest. - Interaction design. For form mode, provide a plain message and restricted flat schema. For URL mode, show the HTTPS destination and out-of-band completion rule.
- Retry contract. Require a fresh JSON-RPC id, original method and arguments, current
inputResponses, per-request_meta, and exactrequestStateecho. An id-less notification never receives a JSON-RPC result or error; an accepted Streamable HTTP notification receives202with no body. - Branch handling. Map
accept,decline, andcancelto different safe outcomes. - State protection. Bind HMAC or authenticated encryption to the authenticated principal, original argument digest, candidate set, operation phase, expiry, and one-time nonce. Consume the nonce atomically in a bounded, TTL-pruned replay store shared by every handler instance.
- Final revalidation. Re-check authorization, live record state, and containment immediately before mutation.
Hard rejects:
- Treating deprecated Roots as authorization, containment, or sandboxing.
- Using
roots/listornotifications/roots/list_changedin a new 2026-07-28 design. - Sending a reverse
elicitation/createrequest instead of returning it through MRTR. - Collecting passwords, API keys, access tokens, or payment credentials in form mode.
- Sending an elicitation mode absent from current per-request capabilities.
- Treating
clientInfoas an authenticated user identity. - Performing a destructive action before validated acceptance and final authorization checks.
- Unsigned
requestStatethat carries candidates or permission-relevant data.
Refusal rules:
- Refuse repeated prompts after explicit decline.
- Refuse elicitation for a value the server can derive or validate without the user.
- Refuse a URL that contains credentials, user secrets, or a pre-authenticated bearer value.
- Refuse a request that uses hidden protocol-session state,
initialize, orMcp-Session-Id.
Output a one-page design with scope, authorization, containment, interaction mode, schema or URL, MRTR wire shape, state fields, response branches, replay policy, and final revalidation checklist.