| Crates.io | rust-mcp-extra |
| lib.rs | rust-mcp-extra |
| version | 0.2.2 |
| created_at | 2025-10-13 22:37:03.579877+00 |
| updated_at | 2026-01-18 22:37:07.272136+00 |
| description | A companion crate to rust-mcp-sdk offering extra implementations of core traits like SessionStore and EventStore, enabling integration with various database backends and third-party platforms such as AWS Lambda for serverless and cloud-native MCP applications. |
| homepage | |
| repository | https://github.com/rust-mcp-stack/rust-mcp-sdk |
| max_upload_size | |
| id | 1881253 |
| size | 178,873 |
A companion crate to rust-mcp-sdk providing additional implementations for core traits like AuthProvider, IdGenerator, SessionStore and EventStore.
π Coming Soon
A collection of authentication providers that integrate seamlessly with the rust-mcp-sdk. These providers offer a ready-to-use integration with common identity systems, so developers donβt have to build an AuthProvider implementation for each provider themselves.
A full OAuth2/OpenID Connect provider integration for Keycloak backed identity systems. Useful for enterprise environments or self-hosted identity setups.
let auth_provider = KeycloakAuthProvider::new(KeycloakAuthOptions {
keycloak_base_url: "http://localhost:8080/realms/master".to_string(),
mcp_server_url: "http://localhost:3000".to_string(),
resource_name: Some("Keycloak Oauth Test MCP Server".to_string()),
required_scopes: None,
client_id: "keycloak-client-id".to_string(),
client_secret: "keycloak-client-secret".to_string(),
token_verifier: None,
resource_documentation: None,
})?;
Before running the example, ensure you have a Keycloak instance properly configured.
Follow the official MCP authorization tutorial for Keycloak setup:Keycloak Setup Guide
By default, the example assumes Keycloak is running at http://localhost:8080.
configure a confidential client in Keycloak and provide credentials as environment variables:
export AUTH_SERVER=http://localhost:8080/realms/master
export CLIENT_ID=your-confidential-client-id
export CLIENT_SECRET=your-client-secret
cargo run -p rust-mcp-extra --example keycloak-auth
An OAuth provider implementation for WorkOS Authkit.
let auth_provider = WorkOsAuthProvider::new(WorkOSAuthOptions {
authkit_domain: "https://stalwart-opera-85-staging.authkit.app".to_string(),
mcp_server_url: "http://127.0.0.1:3000/mcp".to_string(),
required_scopes: Some(vec!["openid", "profile"]),
resource_name: Some("Workos Oauth Test MCP Server".to_string()),
resource_documentation: None,
token_verifier: None,
})?;
Before running the example, make sure you enabled DCR (Dynamic Client Registration) in your WorkOS Authkit dashboard.
Set the AUTH_SERVER environment variable and start the example:
export AUTH_SERVER=https://stalwart-opera-85-staging.authkit.app
cargo run -p rust-mcp-extra --example workos-auth
An OAuth provider implementation for Scalekit.
let auth_provider = ScalekitAuthProvider::new(ScalekitAuthOptions {
mcp_server_url: "http://127.0.0.1:3000/mcp".to_string(),
required_scopes: Some(vec!["profile"]),
token_verifier: None,
resource_name: Some("Scalekit Oauth Test MCP Server".to_string()),
resource_documentation: None,
environment_url: "yourapp.scalekit.dev".to_string(),
resource_id: "res_your-resource_id".to_string(),
})
.await?;
Set the ENVIRONMENT_URL and RESOURCE_ID environment variable and start the example:
export ENVIRONMENT_URL=yourapp.scalekit.dev
export RESOURCE_ID=res_your-resource_id
cargo run -p rust-mcp-extra --example scalekit-auth
Various implementations of the IdGenerator trait (from rust-mcp-sdk) for generating unique identifiers.
| π§© All ID generators in this crate can be used as SessionId generators in rust-mcp-sdk).
| Generator | Description |
|---|---|
| NanoIdGenerator | Generates short, URL-safe, random string IDs using the nanoid crate. Ideal for user-friendly, compact identifiers. |
| TimeBase64Generator | Encodes the current timestamp (in milliseconds) into a URL-safe Base64 string. Useful when IDs should be time-sortable and compact. |
| RandomBase62Generator | Generates alphanumeric [AβZ, aβz, 0β9] strings using random bytes. A simple, reliable option for random unique IDs. |
| SnowflakeIdGenerator | Inspired by Twitterβs Snowflake algorithm. Generates 64-bit time-ordered IDs containing timestamp, machine ID, and sequence. Best for distributed or high-throughput systems. |
Provide an instance of your chosen ID generator in the HyperServerOptions when initializing the server.
For example to use SnowflakeIdGenerator :
use rust_mcp_extra::id_generator::SnowflakeIdGenerator;
let server = hyper_server::create_server(
server_details,
handler,
HyperServerOptions {
host: "127.0.0.1".to_string(),
session_id_generator: Some(Arc::new(SnowflakeIdGenerator::new(1015))), // use SnowflakeIdGenerator
..Default::default()
},
);
SessionStore implementations are available for managing MCP sessions effectively.
π Coming Soon
EventStore implementations to enable resumability on MCP servers by reliably storing and replaying event histories.
π Coming Soon