-
Notifications
You must be signed in to change notification settings - Fork 0
Refresh fixes #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| - Helpful for debugging | ||
|
|
||
| ## MCP Client Configuration | ||
| **Note**: The `apollo_key` can reference environment variables using `${DC_API_KEY}` syntax. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should apollo_key be apollo-key to match the configuration examples above? The config uses hyphens but this note uses underscores.
| **Note**: The `apollo_key` can reference environment variables using `${DC_API_KEY}` syntax. | |
| **Note**: The `apollo-key` can reference environment variables using `${DC_API_KEY}` syntax. |
Finding type: Naming and Typos
| config_manager.update_auth_token(&token_response.access_token) | ||
| .map_err(|e| { | ||
| error!("Failed to write refreshed token to config file: {}", e); | ||
| e | ||
| })?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function now fails completely if config writing fails, even when token refresh succeeded. Should config write failures be non-fatal since the primary operation (token refresh) succeeded?
| config_manager.update_auth_token(&token_response.access_token) | |
| .map_err(|e| { | |
| error!("Failed to write refreshed token to config file: {}", e); | |
| e | |
| })?; | |
| if let Err(e) = config_manager.update_auth_token(&token_response.access_token) { | |
| error!("Failed to write refreshed token to config file: {}", e); | |
| } else { | |
| info!("✅ Refreshed token written to config file"); | |
| } |
Finding type: Logical Bugs
Generated description
Below is a concise technical summary of the changes proposed in this PR:
graph LR main_("main"):::modified initialize_with_token_refresh_("initialize_with_token_refresh"):::modified TokenManager_new_("TokenManager.new"):::modified TokenManager_set_config_manager_("TokenManager.set_config_manager"):::modified TokenManager_set_headers_("TokenManager.set_headers"):::added TokenManager_get_valid_token_("TokenManager.get_valid_token"):::modified TokenManager_refresh_access_token_("TokenManager.refresh_access_token"):::modified ConfigManager_update_auth_token_("ConfigManager.update_auth_token"):::modified TokenManager_headers_("TokenManager.headers"):::added Starting_start_("Starting.start"):::modified Running_("Running"):::modified Running_call_tool_("Running.call_tool"):::modified Running_headers_("Running.headers"):::added main_ -- "Passes shared headers for token refresh and header updates" --> initialize_with_token_refresh_ initialize_with_token_refresh_ -- "Creates TokenManager with support for shared headers injection" --> TokenManager_new_ initialize_with_token_refresh_ -- "Injects config manager for token persistence in TokenManager" --> TokenManager_set_config_manager_ initialize_with_token_refresh_ -- "Injects shared headers for automatic token authorization updates" --> TokenManager_set_headers_ initialize_with_token_refresh_ -- "Obtains fresh token, triggers shared headers update" --> TokenManager_get_valid_token_ TokenManager_refresh_access_token_ -- "Writes refreshed token to config file for persistence" --> ConfigManager_update_auth_token_ TokenManager_refresh_access_token_ -- "Updates shared Authorization header with refreshed token asynchronously" --> TokenManager_headers_ Starting_start_ -- "Creates Running state with shared headers for auth propagation" --> Running_ Running_call_tool_ -- "Reads shared headers to propagate auth tokens in requests" --> Running_headers_ classDef added stroke:#15AA7A classDef removed stroke:#CD5270 classDef modified stroke:#EDAC4C linkStyle default stroke:#CBD5E1,font-size:13pxImplements a shared, mutable header map (
Arc<RwLock>) to dynamically update authentication tokens across thedc-mcp-serverwithout re-reading configuration. Ensures that all outgoing GraphQL requests utilize the most recently refreshed token, improving the reliability of the Model Context Protocol (MCP) server's interaction with GraphQL APIs.Latest Contributors(2)