@@ -48,6 +48,7 @@ Rust SDK for Gopher Orch - AI Agent orchestration framework with native C++ perf
4848- ** Tool Orchestration** - Manage and execute tools across multiple MCP servers
4949- ** State Management** - Built-in state graph for complex workflows
5050- ** Memory Safety** - Rust's ownership system with zero-cost abstractions
51+ - ** OAuth 2.0 Authentication** - JWT validation with JWKS support (feature-gated)
5152
5253## When to Use This SDK
5354
@@ -95,24 +96,36 @@ This SDK is ideal for:
9596
9697## Installation
9798
98- ### Option 1: Cargo (when published)
99+ ### Option 1: From crates.io
99100
100101``` toml
101102[dependencies ]
102- gopher-mcp-rust =" 0.1.0 "
103+ gopher-mcp-rust = " 0.1.2 "
103104```
104105
105106### Option 2: Git Dependency
106107
107108``` toml
108109[dependencies ]
109- gopher-mcp-rust ={ git = " https://github.com/GopherSecurity/gopher-mcp-rust.git" }
110+ gopher-mcp-rust = { git = " https://github.com/GopherSecurity/gopher-mcp-rust.git" }
110111```
111112
112113### Option 3: Build from Source
113114
114115See [ Building from Source] ( #building-from-source ) section below.
115116
117+ ### With Auth Feature
118+
119+ Enable OAuth 2.0 / JWT authentication support:
120+
121+ ``` toml
122+ [dependencies ]
123+ gopher-mcp-rust = { version = " 0.1.2" , features = [" auth" ] }
124+
125+ # Or with git
126+ gopher-mcp-rust = { git = " https://github.com/GopherSecurity/gopher-mcp-rust.git" , features = [" auth" ] }
127+ ```
128+
116129## Quick Start
117130
118131``` rust
@@ -465,6 +478,59 @@ cd examples/server3002 && npm install && npm run dev
465478ANTHROPIC_API_KEY=your-key cargo run --example client_example_json
466479```
467480
481+ ### Auth MCP Server Example
482+
483+ The ` examples/auth ` directory contains a complete OAuth 2.0 protected MCP server example using Axum:
484+
485+ ``` bash
486+ cd examples/auth
487+
488+ # Run with auth disabled (development mode)
489+ ./run_example.sh --no-auth
490+
491+ # Run with full OAuth support
492+ ./run_example.sh
493+ ```
494+
495+ ** Features:**
496+ - OAuth 2.0 / OIDC discovery endpoints (RFC 8414, RFC 9728)
497+ - JWT token validation via native library
498+ - Scope-based authorization for MCP tools
499+ - Example weather tools with different scope requirements
500+
501+ ** Available Tools:**
502+
503+ | Tool | Scope Required | Description |
504+ | ------| ----------------| -------------|
505+ | ` get-weather ` | None | Get current weather for a city |
506+ | ` get-forecast ` | ` mcp:read ` | Get 5-day weather forecast |
507+ | ` get-weather-alerts ` | ` mcp:admin ` | Get weather alerts for a region |
508+
509+ ** Using the Auth Client:**
510+
511+ ``` rust
512+ use gopher_mcp_rust :: GopherAuthClient ;
513+
514+ // Create auth client with JWKS endpoint
515+ let client = GopherAuthClient :: new (
516+ " https://auth.example.com/.well-known/jwks.json" ,
517+ " https://auth.example.com"
518+ )? ;
519+
520+ // Validate a JWT token
521+ let result = client . validate_token (" eyJ..." , 60 );
522+ if result . valid {
523+ println! (" Token is valid!" );
524+ println! (" Subject: {}" , result . payload. sub);
525+ println! (" Scopes: {:?}" , result . payload. scope);
526+ }
527+
528+ // Extract payload without validation
529+ let payload = client . extract_payload (" eyJ..." )? ;
530+ ```
531+
532+ See [ examples/auth/README.md] ( examples/auth/README.md ) for full documentation.
533+
468534---
469535
470536## Development
@@ -633,7 +699,7 @@ Contributions are welcome! Please read our contributing guidelines.
633699
634700## License
635701
636- MIT License - see [ LICENSE] ( LICENSE ) file for details.
702+ Apache License 2.0 - see [ LICENSE] ( LICENSE ) file for details.
637703
638704## Links
639705
0 commit comments