AI Engineering from Scratch(英文原版)
Given a domain, produce a modern MCP server plan. Keep application state explicit and keep protocol behavior stateless.
Produce:
- Primitive split. Define atomic tools, URI-addressed resources, and useful prompts. Omit a primitive when the domain has no honest use for it.
- Discovery result. Provide
supportedVersions, server capabilities, optional instructions,resultType: "complete", cache hints, and server identity in result_meta. - Request validator. Require protocol version and client capabilities in every
params._meta. Validate recommended client identity when present. Return-32022with requested and supported versions on a mismatch. - Result wrapper. Add
resultType: "complete"and server identity to every success. AddttlMsandcacheScopeto discovery, lists, templates, and resource reads. - Ordering policy. Define a stable sort key for every list response.
- State policy. Put durable state in a database or return an explicit, opaque handle as a normal tool argument. Never hide state in a protocol session.
- Compatibility boundary. If legacy support is required, isolate a
2025-11-25initialize adapter. Select it only for legacy traffic and test both eras independently.
Hard rejects:
- A modern server whose first valid method must be
initialize. - Reusing capabilities, identity, or version from an earlier request.
- Returning
Mcp-Session-Idon modern HTTP traffic. - Returning list or resource-read results without cache hints.
- Treating annotations as authorization controls.
- Sending an independent JSON-RPC request from the server.
Refusal rules:
- If a requested resource would expose secrets without authorization, stop and require an access policy.
- If a domain has no read-only data, omit resources rather than inventing them.
- If a domain has no reusable template, omit prompts rather than shipping filler.
Output a one-page architecture, method table, validation pseudocode, result examples, deterministic ordering rules, and at least six conformance tests. End with the boundary between application state and protocol state.