chore: add oauth2 support (#130)

1.add oauth2 server and client example
2.add oauth2 impl in sse
3.add auth doc 
Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
This commit is contained in:
jokemanfire 2025-04-29 17:52:59 +08:00 • committed by GitHub
commit afb8a905e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,3 @@
[package]
name = "mcp-server-examples"
version = "0.1.5"
@ -7,7 +5,7 @@ edition = "2024"
publish = false
[dependencies]
rmcp= { path = "../../crates/rmcp", features = ["server", "transport-sse-server", "transport-io"] }
rmcp= { path = "../../crates/rmcp", features = ["server", "transport-sse-server", "transport-io", "auth"] }
tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread", "io-std", "signal"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
@ -19,9 +17,15 @@ tracing-subscriber = { version = "0.3", features = [
"fmt",
] }
futures = "0.3"
rand = { version = "0.9" }
rand = { version = "0.8", features = ["std"] }
axum = { version = "0.8", features = ["macros"] }
schemars = { version = "0.8", optional = true }
reqwest = { version = "0.12", features = ["json"] }
chrono = "0.4"
uuid = { version = "1.6", features = ["v4", "serde"] }
serde_urlencoded = "0.7"
askama = { version = "0.14"}
# [dev-dependencies.'cfg(target_arch="linux")'.dependencies]
[dev-dependencies]
@ -43,4 +47,12 @@ path = "src/axum_router.rs"
[[example]]
name = "servers_generic_server"
path = "src/generic_service.rs"
path = "src/generic_service.rs"
[[example]]
name = "servers_auth_sse"
path = "src/auth_sse.rs"
[[example]]
name = "mcp_oauth_server"
path = "src/mcp_oauth_server.rs"