MCP SDK for Rust 3.7

Last reviewed Oct 26, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Rust 1.99106 lines · 3.1K tokens
  2. 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 rmcp role, macro, OAuth, request-state, and transport Cargo features the application uses; the default features include server, macros, and base64. Select an HTTPS TLS feature deliberately when enabling reqwest-based transport or OAuth.
  • Select the MCP lifecycle explicitly. serve() still starts the legacy initialize lifecycle even though ProtocolVersion::LATEST names 2026-07-28; use ClientServiceExt::serve_with_lifecycle with Discover when the application requires per-request discovery, and allow Auto fallback only when the older lifecycle meets policy.
  • Override ServerHandler::supported_protocol_versions to 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