rust-mcp-extra 0.3.3

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.
Documentation
mod common;
use crate::common::{
    handler::McpServerHandler,
    utils::{create_server_info, enable_tracing},
};
use rust_mcp_axum::{create_axum_server, AxumServerOptions};
use rust_mcp_extra::auth_provider::work_os::{WorkOSAuthOptions, WorkOsAuthProvider};
use rust_mcp_sdk::{error::SdkResult, ToMcpServerHandler};
use std::{env, sync::Arc};

#[tokio::main]
async fn main() -> SdkResult<()> {
    enable_tracing();
    let server_details = create_server_info("Workos Oauth Test MCP Server");

    let handler = McpServerHandler {};

    let auth_provider = WorkOsAuthProvider::new(WorkOSAuthOptions {
        authkit_domain: env::var("AUTH_SERVER")
            .unwrap_or("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,
        validate_audience: None,
        disable_audience_validation: false,
    })?;

    let server = create_axum_server(
        server_details,
        handler.to_mcp_server_handler(),
        AxumServerOptions {
            host: "127.0.0.1".to_string(),
            port: 3000,
            auth: Some(Arc::new(auth_provider)), // enable authentication
            sse_support: false,
            ..Default::default()
        },
    );

    server.start().await?;
    Ok(())
}