File tree Expand file tree Collapse file tree
crates/agentic-comm-mcp/src/protocol Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 os : [ubuntu-latest, macos-latest]
1919 steps :
2020 - uses : actions/checkout@v4
21+ - name : Clone agentic-sdk (sibling dependency)
22+ run : git clone --depth 1 https://github.com/agentralabs/agentic-sdk.git ../agentic-sdk
2123 - uses : dtolnay/rust-toolchain@stable
2224 with :
2325 components : rustfmt
Original file line number Diff line number Diff line change @@ -218,11 +218,20 @@ impl ProtocolHandler {
218218 serde_json:: to_value ( result) . map_err ( |e| McpError :: InternalError ( e. to_string ( ) ) )
219219 }
220220
221- /// Check if the MCP connection is authorized via AGENTIC_COMM_TOKEN env var.
222- /// If AGENTIC_COMM_TOKEN is set, all tool calls must include a matching token
221+ /// Resolve expected auth token from environment.
222+ /// Canonical env var is AGENTIC_TOKEN; AGENTIC_COMM_TOKEN is retained
223+ /// for backward compatibility with older deployments.
224+ fn expected_auth_token ( ) -> Option < String > {
225+ std:: env:: var ( "AGENTIC_TOKEN" )
226+ . ok ( )
227+ . or_else ( || std:: env:: var ( "AGENTIC_COMM_TOKEN" ) . ok ( ) )
228+ }
229+
230+ /// Check if the MCP connection is authorized via AGENTIC_TOKEN (or legacy
231+ /// AGENTIC_COMM_TOKEN). If set, all tool calls must include a matching token
223232 /// in the _meta.token field. If not set, auth is disabled (open access).
224233 fn check_auth ( params : & Option < Value > ) -> McpResult < ( ) > {
225- if let Ok ( expected_token) = std :: env :: var ( "AGENTIC_COMM_TOKEN" ) {
234+ if let Some ( expected_token) = Self :: expected_auth_token ( ) {
226235 let provided_token = params
227236 . as_ref ( )
228237 . and_then ( |p| p. get ( "_meta" ) )
You can’t perform that action at this time.
0 commit comments