feat(mcp): expose --hub-scope and default Hub scope to include Hub identity #101
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/YT-44-hub-scope-install"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes the Hub OAuth scope so a stock
yt mcp serveinstall can actually complete login and call YouTrack, and exposes the scope through the installer. Implements YT-44.Previously the server requested only
offline_accessfrom Hub. The callback's Hub identity fetch (<issuer>/api/rest/users/me) then failed with401 invalid_token: The operation requires the "0-0-0-0-0" scope, but the token is granted for [youtrack-mcp], and the per-user YouTrack REST calls (which reuse the Hub token,web/mod.rs) would 401 the same way for lack of the instance's YouTrack service id.yt mcp service installhad no--hub-scope, so the only fix was hand-editingmcp.env.Changes
youtrack_mcp::DEFAULT_HUB_SCOPE = "0-0-0-0-0 offline_access"(Hub's universal identity service id + refresh). Both the runtimeHubOAuthConfig::from_envfallback and the installer default read this one constant so they cannot drift.yt mcp service installgains--hub-scope <SCOPE>(space-separated), always baked into the env file asYOUTRACK_MCP_HUB_SCOPE.<instance>/hub/services/<id>)..env.exampleupdated to the new default and the service-id guidance.Installsubcommand variant boxed to satisfyclippy::large_enum_variantafterInstallArgsgrew (clap acceptsBox<InstallArgs>; the call site relies on deref coercion).Invariant sweep (default Hub scope must include Hub identity + be single-sourced)
oauth_hub.rsDEFAULT_HUB_SCOPE(runtime default)0-0-0-0-0 offline_accessoauth_hub.rsfrom_envfallbackDEFAULT_HUB_SCOPEservice.rsresolve_hub_scope/render_env.env.examplescope entryoauth_as.rsADVERTISED_SCOPEoauth_hub.rstest token bodies echoingoffline_accessdocs/deployment.mdscope rowsTests
default_hub_scope_covers_identity_and_refresh(oauth_hub)hub_scope_defaults_to_shared_constant_and_overrides,youtrack_service_id_detection_drives_the_warning, and aYOUTRACK_MCP_HUB_SCOPE=assertion in the env render test (installer)just pre-commitgreen (fmt, clippy-D warnings, build, 82 tests).Related: YT-42 (DB dir, already merged), YT-45 (docs rewrite).