remote-mcp-kernel

Crates.ioremote-mcp-kernel
lib.rsremote-mcp-kernel
version0.1.0-alpha.7
created_at2025-07-09 17:29:39.160531+00
updated_at2025-07-12 01:18:27.263898+00
descriptionA microkernel-based MCP (Model Context Protocol) server with OAuth authentication and multiple transport protocols
homepagehttps://github.com/akihito/oauth-mcp-server
repositoryhttps://github.com/akihito/oauth-mcp-server
max_upload_size
id1745231
size216,722
4kk11 (4kk11)

documentation

https://docs.rs/remote-mcp-kernel

README

Remote MCP Kernel

Crates.io Documentation License: MIT

A microkernel-based MCP (Model Context Protocol) server with OAuth authentication and multiple transport protocols.

Features

  • 🔧 Microkernel Architecture - Modular design with independent handlers
  • 🔐 OAuth Authentication - Secure authentication with multiple providers
  • 🚀 Multiple Transport Protocols - SSE (Server-Sent Events) and HTTP support
  • 📡 MCP Protocol Support - Full Model Context Protocol implementation
  • 🔌 Pluggable Handlers - Extensible handler system
  • 🎯 Runtime Composition - Dynamic service configuration

Installation

Add this to your Cargo.toml:

[dependencies]
remote-mcp-kernel = "0.1.0-alpha.1"

Quick Start

Basic MCP Server

use remote_mcp_kernel::microkernel::MicrokernelServer;
use remote_mcp_kernel::handlers::{SseHandler, StreamableHttpHandler};
use oauth_provider_rs::providers::McpOAuthProvider;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create OAuth provider
    let oauth_provider = McpOAuthProvider::new(/* ... */);
    
    // Create handlers
    let sse_handler = SseHandler::new(oauth_provider.clone());
    let streamable_handler = StreamableHttpHandler::new(oauth_provider.clone());
    
    // Build microkernel server
    let server = MicrokernelServer::new()
        .with_oauth_provider(oauth_provider)
        .with_sse_handler(sse_handler, Default::default())
        .with_streamable_handler(streamable_handler);
    
    // Start server
    server.start("127.0.0.1:8080".parse()?).await?;
    Ok(())
}

OAuth-Only Server

use remote_mcp_kernel::microkernel::MicrokernelServer;
use oauth_provider_rs::providers::McpOAuthProvider;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let oauth_provider = McpOAuthProvider::new(/* ... */);
    
    let server = MicrokernelServer::new()
        .with_oauth_provider(oauth_provider);
    
    server.start("127.0.0.1:8080".parse()?).await?;
    Ok(())
}

Architecture

The Remote MCP Kernel follows a microkernel architecture where:

  • Core Kernel - Minimal core with basic routing and composition
  • Handlers - Independent, composable service handlers
  • OAuth Provider - Centralized authentication service
  • Transport Protocols - Multiple communication methods (SSE, HTTP)

Handler Types

  • SSE Handler - Server-Sent Events for real-time communication
  • Streamable HTTP Handler - HTTP-based streaming communication
  • OAuth Handler - Authentication and authorization endpoints

Configuration

The server can be configured through environment variables or programmatically:

use remote_mcp_kernel::config::Config;

let config = Config::from_env()?;

Examples

The crate includes several examples:

  • oauth_standard_mcp_server - Standard MCP server with OAuth
  • oauth_cognito_mcp_server - AWS Cognito integration
  • oauth_cognito_dynamodb_mcp_server - Full AWS integration

Run examples with:

cargo run --example oauth_standard_mcp_server

OAuth Providers

Supports multiple OAuth providers:

  • GitHub - GitHub OAuth integration
  • AWS Cognito - AWS Cognito User Pools
  • Generic - Custom OAuth provider support

Transport Protocols

Server-Sent Events (SSE)

Real-time, unidirectional communication from server to client:

let sse_handler = SseHandler::new(oauth_provider);

Streamable HTTP

Bidirectional HTTP-based communication:

let streamable_handler = StreamableHttpHandler::new(oauth_provider);

Error Handling

The kernel provides comprehensive error handling:

use remote_mcp_kernel::error::{KernelError, KernelResult};

fn handle_request() -> KernelResult<()> {
    // Your implementation
    Ok(())
}

Security

  • OAuth 2.0 with PKCE support
  • Secure token validation
  • CORS configuration
  • Request authentication middleware

Development

# Run tests
cargo test

# Run with specific features
cargo run --features aws-integration

# Build documentation
cargo doc --open

License

This project is licensed under the MIT License - see the LICENSE file for details.

Related Crates

Commit count: 0

cargo fmt