fix(mcp): resolve MCP service config dir through $XDG_CONFIG_HOME #99

Merged
Claude-Run merged 1 commit from fix/YT-41-mcp-installer-xdg-config-home into main 2026-07-04 21:14:17 +02:00
Member

The yt mcp service installer hardcoded home.join(".config").join("youtrack-cli") for the mcp.env path (install + uninstall) and baked a fixed EnvironmentFile=%h/.config/youtrack-cli/mcp.env into the unit, diverging from the CLI, which resolves its config root through youtrack-config and honors $XDG_CONFIG_HOME. Under a custom $XDG_CONFIG_HOME the CLI read config.yml from <xdg>/youtrack-cli/ while the MCP env file landed in ~/.config/youtrack-cli/, so the two no longer matched.

Expose Instances::root() on youtrack-config (the already-stored <xdg>/youtrack-cli root, resolved via the crate-private xdg_config_home()) and consume it from the installer's install and uninstall so mcp.env always sits alongside config.yml. render_unit now takes the resolved absolute mcp.env path and bakes it into EnvironmentFile=, since systemd has no $XDG_CONFIG_HOME specifier; under the default XDG location this equals the previous ~/.config/youtrack-cli/mcp.env in effect. The systemd user-unit directory (~/.config/systemd/user/) stays anchored on $HOME because it is owned by systemd's own lookup, not by the app. Doc comments updated; render test now covers the default-XDG path and a custom-$XDG_CONFIG_HOME path.

#YT-41

The `yt mcp service` installer hardcoded `home.join(".config").join("youtrack-cli")` for the `mcp.env` path (install + uninstall) and baked a fixed `EnvironmentFile=%h/.config/youtrack-cli/mcp.env` into the unit, diverging from the CLI, which resolves its config root through `youtrack-config` and honors `$XDG_CONFIG_HOME`. Under a custom `$XDG_CONFIG_HOME` the CLI read `config.yml` from `<xdg>/youtrack-cli/` while the MCP env file landed in `~/.config/youtrack-cli/`, so the two no longer matched. Expose `Instances::root()` on `youtrack-config` (the already-stored `<xdg>/youtrack-cli` root, resolved via the crate-private `xdg_config_home()`) and consume it from the installer's `install` and `uninstall` so `mcp.env` always sits alongside `config.yml`. `render_unit` now takes the resolved absolute `mcp.env` path and bakes it into `EnvironmentFile=`, since systemd has no `$XDG_CONFIG_HOME` specifier; under the default XDG location this equals the previous `~/.config/youtrack-cli/mcp.env` in effect. The systemd user-unit directory (`~/.config/systemd/user/`) stays anchored on `$HOME` because it is owned by systemd's own lookup, not by the app. Doc comments updated; render test now covers the default-XDG path and a custom-`$XDG_CONFIG_HOME` path. #YT-41
fix(mcp): resolve MCP service config dir through $XDG_CONFIG_HOME
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 25s
Create release / Create release from merged PR (pull_request) Has been skipped
bcf0dc80bd
The `yt mcp service` installer hardcoded `home.join(".config").join("youtrack-cli")` for the `mcp.env` path (install + uninstall) and baked a fixed `EnvironmentFile=%h/.config/youtrack-cli/mcp.env` into the unit, diverging from the CLI, which resolves its config root through `youtrack-config` and honors `$XDG_CONFIG_HOME`. Under a custom `$XDG_CONFIG_HOME` the CLI read `config.yml` from `<xdg>/youtrack-cli/` while the MCP env file landed in `~/.config/youtrack-cli/`, so the two no longer matched.

Expose `Instances::root()` on `youtrack-config` (the already-stored `<xdg>/youtrack-cli` root, resolved via the crate-private `xdg_config_home()`) and consume it from the installer's `install` and `uninstall` so `mcp.env` always sits alongside `config.yml`. `render_unit` now takes the resolved absolute `mcp.env` path and bakes it into `EnvironmentFile=`, since systemd has no `$XDG_CONFIG_HOME` specifier; under the default XDG location this equals the previous `~/.config/youtrack-cli/mcp.env` in effect. The systemd user-unit directory (`~/.config/systemd/user/`) stays anchored on `$HOME` because it is owned by systemd's own lookup, not by the app. Doc comments updated; render test now covers the default-XDG path and a custom-`$XDG_CONFIG_HOME` path.

#YT-41
Claude-Run deleted branch fix/YT-41-mcp-installer-xdg-config-home 2026-07-04 21:14:18 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pandoras-box/youtrack-cli!99
No description provided.