feat(mcp): merge youtrack-mcp into the workspace as one yt binary (YTCLI-30) #85

Merged
David merged 1 commit from feat/YTCLI-30-merge-mcp-into-workspace into main 2026-07-02 17:20:24 +02:00
Owner

Summary

Merges the standalone youtrack-mcp server into this cargo workspace so a single yt binary carries both the CLI and the MCP server. Implements YTCLI-30.

Following the Zellij lead (zellij web starts a web server), the MCP is surfaced as yt mcp serve (the multi-user HTTP web service: OAuth 2.1 AS/RS, per-user /mcp) and yt mcp stdio (the single-identity transport an MCP client launches over stdin/stdout).

What changed

  • New workspace member crates/youtrack-mcp (library): the ported MCP server. Its youtrack-client git-tag pin becomes a local path dependency, so the MCP reuses the exact REST code path as the CLI. src/lib.rs exposes serve_stdio(Config) / serve_http(HttpOverrides); the argv-based transport selector and the tokio main are removed.
  • yt-cli: new mcp subcommand group (crates/yt-cli/src/commands/mcp.rs) behind a default-on mcp cargo feature. cargo build --no-default-features yields a slim CLI without the rmcp / axum / sqlx / oauth2 stack and without the subcommand.
  • Credentials: yt mcp stdio resolves base URL + token from the active yt instance, with YOUTRACK_BASE_URL / YOUTRACK_TOKEN / --base-url overriding (env-only usage needs no configured instance). yt mcp serve stays env / .env driven with --bind-addr / --public-base-url / --database-url overrides.
  • Tracing now goes to stderr (in main.rs) so yt mcp stdio keeps stdout a clean JSON-RPC stream; the default filter covers both the yt and youtrack_mcp targets.
  • Both oci-build/Dockerfile and oci-build/Dockerfile.windows copy the fourth member's manifest, priming stub, source, and askama.toml so the workspace loads and builds in CI. The alpine runtime stage owns /data so yt mcp serve's SQLite volume is writable.
  • Deployment artifacts: compose.mcp.yml, .env.example, docs/deployment.md. CLAUDE.md and README updated (repo layout, command surface, the stale "MCP out of scope" note removed).

Decisions

The user was away when the spec decisions were asked, so the recommended options were taken: yt mcp stdio sibling subcommand; default-on mcp feature; reuse the instance store with env override; fresh squashed port. Any of these can be revised.

Verification

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo build, cargo test --workspace: all green (the MCP crate's 217 tests included).
  • Slim cargo build -p youtrack-cli --no-default-features: compiles, mcp subcommand absent, MCP dep stack excluded.
  • Musl builder-stage docker build (just check-docker) and just pre-commit: both pass, so the updated Dockerfiles load the four-member workspace.

Follow-ups (tracked, linked)

  • YTCLI-31: publish a prebuilt MCP HTTP-service container image in CI (today compose.mcp.yml builds it locally from source).
  • YTMCP-26: archive the standalone youtrack-mcp repo and redirect deployments / client registrations.
## Summary Merges the standalone `youtrack-mcp` server into this cargo workspace so a single `yt` binary carries both the CLI and the MCP server. Implements YTCLI-30. Following the Zellij lead (`zellij web` starts a web server), the MCP is surfaced as `yt mcp serve` (the multi-user HTTP web service: OAuth 2.1 AS/RS, per-user `/mcp`) and `yt mcp stdio` (the single-identity transport an MCP client launches over stdin/stdout). ## What changed - New workspace member `crates/youtrack-mcp` (library): the ported MCP server. Its `youtrack-client` git-tag pin becomes a local path dependency, so the MCP reuses the exact REST code path as the CLI. `src/lib.rs` exposes `serve_stdio(Config)` / `serve_http(HttpOverrides)`; the argv-based transport selector and the tokio `main` are removed. - `yt-cli`: new `mcp` subcommand group (`crates/yt-cli/src/commands/mcp.rs`) behind a default-on `mcp` cargo feature. `cargo build --no-default-features` yields a slim CLI without the rmcp / axum / sqlx / oauth2 stack and without the subcommand. - Credentials: `yt mcp stdio` resolves base URL + token from the active `yt` instance, with `YOUTRACK_BASE_URL` / `YOUTRACK_TOKEN` / `--base-url` overriding (env-only usage needs no configured instance). `yt mcp serve` stays env / `.env` driven with `--bind-addr` / `--public-base-url` / `--database-url` overrides. - Tracing now goes to stderr (in `main.rs`) so `yt mcp stdio` keeps stdout a clean JSON-RPC stream; the default filter covers both the `yt` and `youtrack_mcp` targets. - Both `oci-build/Dockerfile` and `oci-build/Dockerfile.windows` copy the fourth member's manifest, priming stub, source, and `askama.toml` so the workspace loads and builds in CI. The alpine runtime stage owns `/data` so `yt mcp serve`'s SQLite volume is writable. - Deployment artifacts: `compose.mcp.yml`, `.env.example`, `docs/deployment.md`. CLAUDE.md and README updated (repo layout, command surface, the stale "MCP out of scope" note removed). ## Decisions The user was away when the spec decisions were asked, so the recommended options were taken: `yt mcp stdio` sibling subcommand; default-on `mcp` feature; reuse the instance store with env override; fresh squashed port. Any of these can be revised. ## Verification - `cargo fmt --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo build`, `cargo test --workspace`: all green (the MCP crate's 217 tests included). - Slim `cargo build -p youtrack-cli --no-default-features`: compiles, `mcp` subcommand absent, MCP dep stack excluded. - Musl builder-stage docker build (`just check-docker`) and `just pre-commit`: both pass, so the updated Dockerfiles load the four-member workspace. ## Follow-ups (tracked, linked) - YTCLI-31: publish a prebuilt MCP HTTP-service container image in CI (today `compose.mcp.yml` builds it locally from source). - YTMCP-26: archive the standalone `youtrack-mcp` repo and redirect deployments / client registrations.
feat(mcp): merge youtrack-mcp into the workspace as one yt binary
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 2m4s
Create release / Create release from merged PR (pull_request) Has been skipped
2ca8e2a2ff
Fold the standalone youtrack-mcp server into this cargo workspace as a new library member `crates/youtrack-mcp`, and surface it through the `yt` binary as `yt mcp serve` (the multi-user HTTP web service) and `yt mcp stdio` (the single-identity transport an MCP client launches). Following the Zellij lead, `serve` names the web server. The MCP now reuses the `youtrack-client` path dependency instead of a git-tag pin, so it shares the exact REST code path as the CLI.

The library exposes `serve_stdio(Config)` and `serve_http(HttpOverrides)`; the old argv-based transport selector and the tokio `main` are gone (yt-cli owns tracing init, now routed to stderr so `yt mcp stdio` keeps stdout a clean JSON-RPC stream). `yt mcp stdio` resolves credentials from the active `yt` instance, with `YOUTRACK_BASE_URL` / `YOUTRACK_TOKEN` / `--base-url` overriding; `yt mcp serve` stays env / `.env` driven with `--bind-addr` / `--public-base-url` / `--database-url` overrides.

The MCP ships behind a default-on `mcp` cargo feature: the default `yt` binary includes it, and `--no-default-features` yields a slim CLI without the rmcp / axum / sqlx / oauth2 stack. Both `oci-build/Dockerfile` and `oci-build/Dockerfile.windows` now copy the fourth member's manifest, stub, source, and `askama.toml` so the workspace loads and builds in CI; the alpine runtime stage owns `/data` so `yt mcp serve`'s SQLite volume is writable. Deployment artifacts (`compose.mcp.yml`, `.env.example`, `docs/deployment.md`) and the CLAUDE.md / README updates land alongside. Publishing a prebuilt service image is tracked in YTCLI-31; archiving the standalone repo is tracked in YTMCP-26.

Verified: cargo fmt/clippy(-D warnings)/build/test green; slim `--no-default-features` build excludes the MCP stack and subcommand; musl builder-stage docker build and `just pre-commit` both pass.

#YTCLI-30
David merged commit 85d2e531e1 into main 2026-07-02 17:20:24 +02:00
David deleted branch feat/YTCLI-30-merge-mcp-into-workspace 2026-07-02 17:20:24 +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!85
No description provided.