rmcp

March 11, 2026 · View on GitHub

The official Rust SDK for the Model Context Protocol. Build MCP servers that expose tools, resources, and prompts to AI assistants — or build clients that connect to them.

For getting started, usage guides, and full MCP feature documentation (resources, prompts, sampling, roots, logging, completions, subscriptions, etc.), see the main README.

Feature Flags

FeatureDescriptionDefault
serverServer functionality and the tool system
clientClient functionality
macros#[tool] / #[prompt] macros (re-exports rmcp-macros)
schemarsJSON Schema generation for tool definitions
authOAuth 2.0 authentication support
elicitationElicitation support

Transport features

FeatureDescription
transport-ioServer-side stdio transport
transport-child-processClient-side stdio transport (spawns a child process)
transport-async-rwGeneric async read/write transport
transport-streamable-http-clientStreamable HTTP client (transport-agnostic)
transport-streamable-http-client-reqwestStreamable HTTP client with default reqwest backend
transport-streamable-http-serverStreamable HTTP server transport

TLS backend options (for HTTP transports)

FeatureDescription
reqwestUses rustls — pure Rust TLS (recommended default)
reqwest-native-tlsUses platform-native TLS (OpenSSL / Secure Transport / SChannel)
reqwest-tls-no-providerUses rustls without a default crypto provider (bring your own)

Transports

The transport layer is pluggable. Two built-in pairs cover the most common cases:

ClientServer
stdioTokioChildProcessstdio
Streamable HTTPStreamableHttpClientTransportStreamableHttpService

Any type that implements the Transport trait can be used. The IntoTransport helper trait provides automatic conversions from:

  1. (Sink, Stream) or a combined Sink + Stream
  2. (AsyncRead, AsyncWrite) or a combined AsyncRead + AsyncWrite
  3. A Worker implementation
  4. A Transport implementation directly

License

This project is licensed under the terms specified in the repository's LICENSE file.