get_cognito_scope

Function get_cognito_scope 

Source
pub fn get_cognito_scope() -> String
Examples found in repository?
examples/oauth_cognito_mcp_server.rs (line 100)
56fn log_startup_info() {
57    use remote_mcp_kernel::config::{
58        get_cognito_client_id, get_cognito_client_secret, get_cognito_domain, get_cognito_region,
59        get_cognito_scope, get_cognito_user_pool_id, get_server_host, get_server_port,
60        get_server_version,
61    };
62
63    println!("🚀 Starting MCP OAuth server with Cognito and microkernel architecture...");
64    println!("📋 Configuration:");
65    println!("  - Architecture: Microkernel (independent handlers)");
66    println!("  - OAuth Provider: AWS Cognito");
67    println!(
68        "  - Server: {}:{}",
69        get_server_host(),
70        get_server_port().unwrap_or(8080)
71    );
72    println!("  - Version: {}", get_server_version());
73    println!(
74        "  - Cognito Client ID: {}",
75        if get_cognito_client_id().is_ok() {
76            "Configured"
77        } else {
78            "Not configured"
79        }
80    );
81    println!(
82        "  - Cognito Client Secret: {}",
83        match get_cognito_client_secret() {
84            Some(secret) if !secret.is_empty() => "Configured",
85            _ => "Not configured (Public Client)",
86        }
87    );
88    println!(
89        "  - Cognito Domain: {}",
90        get_cognito_domain().unwrap_or_else(|_| "Not configured".to_string())
91    );
92    println!(
93        "  - Cognito Region: {}",
94        get_cognito_region().unwrap_or_else(|_| "Not configured".to_string())
95    );
96    println!(
97        "  - Cognito User Pool ID: {}",
98        get_cognito_user_pool_id().unwrap_or_else(|_| "Not configured".to_string())
99    );
100    println!("  - Cognito Scopes: {}", get_cognito_scope());
101    println!("🔧 Handlers:");
102    println!("  - OAuth Provider (Cognito authentication & authorization)");
103    println!("  - Streamable HTTP Handler (MCP over HTTP)");
104    println!("  - SSE Handler (MCP over SSE)");
105    println!();
106    println!("🔐 Required Environment Variables:");
107    println!("  - COGNITO_CLIENT_ID: Your Cognito app client ID");
108    println!(
109        "  - COGNITO_CLIENT_SECRET: Your Cognito app client secret (optional for public clients)"
110    );
111    println!(
112        "  - COGNITO_DOMAIN: Your Cognito domain (e.g., mydomain.auth.us-east-1.amazoncognito.com)"
113    );
114    println!("  - AWS_REGION: AWS region (e.g., us-east-1)");
115    println!("  - COGNITO_USER_POOL_ID: Your Cognito user pool ID (e.g., us-east-1_XXXXXXXXX)");
116    println!("  - COGNITO_SCOPE: OAuth scopes (default: 'openid email profile phone')");
117    println!("  - MCP_HOST: Server host (default: localhost)");
118    println!("  - MCP_PORT: Server port (default: 8080)");
119    println!();
120    println!("🌐 OAuth 2.0 Endpoints:");
121    let cognito_domain = get_cognito_domain().unwrap_or_else(|_| "Not configured".to_string());
122    println!(
123        "  - Authorization: https://{}/oauth2/authorize",
124        cognito_domain
125    );
126    println!("  - Token: https://{}/oauth2/token", cognito_domain);
127    println!("  - JWKS: https://{}/oauth2/jwks", cognito_domain);
128    println!("  - UserInfo: https://{}/oauth2/userInfo", cognito_domain);
129    println!();
130}
More examples
Hide additional examples
examples/custom_mcp_server_example.rs (line 555)
502fn log_startup_info(table_name: &str, create_table: bool) {
503    println!("🚀 Starting Custom MCP Server example with Cognito and DynamoDB storage...");
504    println!("📋 Configuration:");
505    println!("  - Architecture: Microkernel (independent handlers)");
506    println!("  - MCP Server: Custom implementation with specialized tools");
507    println!("  - OAuth Provider: AWS Cognito");
508    println!("  - Storage Backend: DynamoDB");
509    println!(
510        "  - Server: {}:{}",
511        get_server_host(),
512        get_server_port().unwrap_or(8080)
513    );
514    println!("  - Version: {}", get_server_version());
515    println!();
516
517    println!("🔧 Custom MCP Server Tools:");
518    println!("  - list_files: List files and directories");
519    println!("  - read_file: Read file contents");
520    println!("  - write_file: Write content to files");
521    println!("  - get_system_info: Get system information");
522    println!("  - count_words: Count words, lines, and characters");
523    println!("  - search_text: Search for patterns in text");
524    println!("  - get_datetime: Get current date and time");
525    println!();
526
527    println!("🔐 AWS Cognito Configuration:");
528    println!(
529        "  - Client ID: {}",
530        if get_cognito_client_id().is_ok() {
531            "Configured"
532        } else {
533            "Not configured"
534        }
535    );
536    println!(
537        "  - Client Secret: {}",
538        match get_cognito_client_secret() {
539            Some(secret) if !secret.is_empty() => "Configured",
540            _ => "Not configured (Public Client)",
541        }
542    );
543    println!(
544        "  - Domain: {}",
545        get_cognito_domain().unwrap_or_else(|_| "Not configured".to_string())
546    );
547    println!(
548        "  - Region: {}",
549        get_cognito_region().unwrap_or_else(|_| "Not configured".to_string())
550    );
551    println!(
552        "  - User Pool ID: {}",
553        get_cognito_user_pool_id().unwrap_or_else(|_| "Not configured".to_string())
554    );
555    println!("  - Scopes: {}", get_cognito_scope());
556    println!();
557
558    println!("🗄️  DynamoDB Storage Configuration:");
559    println!("  - Table Name: {}", table_name);
560    println!("  - Auto-create Table: {}", create_table);
561    println!("  - TTL Attribute: expires_at");
562    println!();
563
564    println!("🔧 Handlers:");
565    println!("  - OAuth Provider (Cognito authentication & authorization)");
566    println!("  - Streamable HTTP Handler (MCP over HTTP with custom server)");
567    println!("  - SSE Handler (MCP over SSE with custom server)");
568    println!();
569
570    println!("🏗️  Microkernel Architecture:");
571    println!("  - Custom MCP server with specialized tools");
572    println!("  - Independent handlers that can operate standalone");
573    println!("  - Runtime composition of services");
574    println!("  - Single responsibility per handler");
575    println!("  - Easy testing and maintenance");
576    println!();
577
578    println!("🌐 MCP Protocol Endpoints:");
579    let host = get_server_host();
580    let port = get_server_port().unwrap_or(8080);
581    println!("  - HTTP (streamable): http://{}:{}/mcp/http", host, port);
582    println!("  - SSE: http://{}:{}/mcp/sse", host, port);
583    println!("  - SSE Messages: http://{}:{}/mcp/message", host, port);
584    println!();
585
586    println!("🔐 OAuth 2.0 Endpoints:");
587    let cognito_domain = get_cognito_domain().unwrap_or_else(|_| "Not configured".to_string());
588    println!(
589        "  - Authorization: https://{}/oauth2/authorize",
590        cognito_domain
591    );
592    println!("  - Token: https://{}/oauth2/token", cognito_domain);
593    println!("  - JWKS: https://{}/oauth2/jwks", cognito_domain);
594    println!("  - UserInfo: https://{}/oauth2/userInfo", cognito_domain);
595    println!();
596}
examples/oauth_cognito_dynamodb_mcp_server.rs (line 167)
119fn log_startup_info(table_name: &str, create_table: bool) {
120    use remote_mcp_kernel::config::{
121        get_cognito_client_id, get_cognito_client_secret, get_cognito_domain, get_cognito_region,
122        get_cognito_scope, get_cognito_user_pool_id, get_server_host, get_server_port,
123        get_server_version,
124    };
125
126    println!("🚀 Starting MCP OAuth server with Cognito and DynamoDB storage...");
127    println!("📋 Configuration:");
128    println!("  - Architecture: Microkernel (independent handlers)");
129    println!("  - OAuth Provider: AWS Cognito");
130    println!("  - Storage Backend: DynamoDB");
131    println!(
132        "  - Server: {}:{}",
133        get_server_host(),
134        get_server_port().unwrap_or(8080)
135    );
136    println!("  - Version: {}", get_server_version());
137    println!();
138
139    println!("🔐 AWS Cognito Configuration:");
140    println!(
141        "  - Client ID: {}",
142        if get_cognito_client_id().is_ok() {
143            "Configured"
144        } else {
145            "Not configured"
146        }
147    );
148    println!(
149        "  - Client Secret: {}",
150        match get_cognito_client_secret() {
151            Some(secret) if !secret.is_empty() => "Configured",
152            _ => "Not configured (Public Client)",
153        }
154    );
155    println!(
156        "  - Domain: {}",
157        get_cognito_domain().unwrap_or_else(|_| "Not configured".to_string())
158    );
159    println!(
160        "  - Region: {}",
161        get_cognito_region().unwrap_or_else(|_| "Not configured".to_string())
162    );
163    println!(
164        "  - User Pool ID: {}",
165        get_cognito_user_pool_id().unwrap_or_else(|_| "Not configured".to_string())
166    );
167    println!("  - Scopes: {}", get_cognito_scope());
168    println!();
169
170    println!("🗄️  DynamoDB Storage Configuration:");
171    println!("  - Table Name: {}", table_name);
172    println!("  - Auto-create Table: {}", create_table);
173    println!("  - TTL Attribute: expires_at");
174    println!();
175
176    println!("🔧 Handlers:");
177    println!("  - OAuth Provider (Cognito authentication & authorization)");
178    println!("  - Streamable HTTP Handler (MCP over HTTP)");
179    println!("  - SSE Handler (MCP over SSE)");
180    println!();
181
182    println!("🔐 Required Environment Variables:");
183    println!("  ## Cognito Configuration");
184    println!("  - COGNITO_CLIENT_ID: Your Cognito app client ID");
185    println!(
186        "  - COGNITO_CLIENT_SECRET: Your Cognito app client secret (optional for public clients)"
187    );
188    println!(
189        "  - COGNITO_DOMAIN: Your Cognito domain (e.g., mydomain.auth.us-east-1.amazoncognito.com)"
190    );
191    println!("  - AWS_REGION: AWS region (e.g., us-east-1)");
192    println!("  - COGNITO_USER_POOL_ID: Your Cognito user pool ID (e.g., us-east-1_XXXXXXXXX)");
193    println!("  - COGNITO_SCOPE: OAuth scopes (default: 'openid email profile phone')");
194    println!();
195    println!("  ## AWS Configuration (for DynamoDB)");
196    println!("  - AWS_ACCESS_KEY_ID: Your AWS access key ID");
197    println!("  - AWS_SECRET_ACCESS_KEY: Your AWS secret access key");
198    println!("  - AWS_REGION: AWS region (should match AWS_REGION)");
199    println!();
200    println!("  ## Server Configuration");
201    println!("  - MCP_HOST: Server host (default: localhost)");
202    println!("  - MCP_PORT: Server port (default: 8080)");
203    println!("  - DYNAMODB_TABLE_NAME: DynamoDB table name (default: oauth-storage)");
204    println!("  - DYNAMODB_CREATE_TABLE: Whether to auto-create table (default: true)");
205    println!();
206
207    println!("🌐 OAuth 2.0 Endpoints:");
208    let cognito_domain = get_cognito_domain().unwrap_or_else(|_| "Not configured".to_string());
209    println!(
210        "  - Authorization: https://{}/oauth2/authorize",
211        cognito_domain
212    );
213    println!("  - Token: https://{}/oauth2/token", cognito_domain);
214    println!("  - JWKS: https://{}/oauth2/jwks", cognito_domain);
215    println!("  - UserInfo: https://{}/oauth2/userInfo", cognito_domain);
216    println!();
217
218    println!("💾 DynamoDB Table Configuration:");
219    println!("  - Table Structure: Single table design with 'pk' primary key");
220    println!("  - TTL Support: Automatic cleanup using 'expires_at' attribute");
221    println!("  - Billing Mode: Pay-per-request (on-demand)");
222    println!("  - Encryption: Server-side encryption enabled");
223    println!();
224
225    println!("🏗️  Microkernel Architecture:");
226    println!("  - Independent handlers that can operate standalone");
227    println!("  - Runtime composition of services");
228    println!("  - Single responsibility per handler");
229    println!("  - Easy testing and maintenance");
230    println!();
231}