MCP SDK for Rust 3.7
Last reviewed Oct 26, 2026
Prompt Details
Prompt Composition
2prompts
- Rust 1.99106 lines · 3.1K tokens
- MCP SDK for Rust 3.758 lines · 3.1K tokens
Total164 lines · 6.2K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 89
- 117
- 125
- 190
- 197
- 201
- 209
- 250
- 279
- 295
- 306
- 312
- 319
- 338
- 347
- 354
- 362
- 367
- 407
- 409
- 416
- 502
- 532
- 613
- 639
- 674
- 770
- 772
- 787
- 807
- 829
- 841
- 862
- 863
- 908
- 916
- 918
- 940
- 1336
- 1395
- 1427
Prompt Preview
Apply the Rust 1.99 baseline first. These rules cover the official rmcp client and server SDK, its optional transports and OAuth client, and the MCP capabilities the application enables.
Protocol and enabled surface
- Enable only the
rmcprole, macro, OAuth, request-state, and transport Cargo features the application uses; the default features includeserver,macros, andbase64. Select an HTTPS TLS feature deliberately when enabling reqwest-based transport or OAuth. - Select the MCP lifecycle explicitly.
serve()still starts the legacyinitializelifecycle even thoughProtocolVersion::LATESTnames2026-07-28; useClientServiceExt::serve_with_lifecyclewithDiscoverwhen the application requires per-request discovery, and allowAutofallback only when the older lifecycle meets policy. - Override
ServerHandler::supported_protocol_versionsto advertise only revisions whose lifecycle, request metadata, headers, and capabilities the application implements. Treat negotiated versions, peer names, advertised capabilities, and tool annotations as compatibility data, never identity or permission. - Expose only capabilities the handler actually implements. Require authentication and a current authorization decision for discovery, listings,
tools/call,prompts/get, completion, resource reads, subscriptions, and task operations; hiding a name from a list does not protect its direct handler.
HTTP server and identity
- Put authentication, authorization, request deadlines, rate limits, connection limits, and response limits in front of