feat(transport): add transport flag and ClientSource seam #8

Merged
David merged 1 commit from feat/transport-flag-clientsource into main 2026-06-14 21:07:30 +02:00
Owner

First step of the multi-user remote MCP epic (#YTMCP-2). Pure refactor: stdio behavior is unchanged, and no HTTP / SQLite / OAuth code lands here.

What changed

  • main.rs selects the transport from --transport <stdio|http> (or --transport=<value>), falling back to YT_MCP_TRANSPORT, then to the default stdio. The http arm returns a clear not-yet-implemented error (tracked in #YTMCP-6).
  • stdio serving now exits cleanly on client disconnect (stdin EOF) or a shutdown signal (SIGINT, and SIGTERM on Unix).
  • server.rs introduces a ClientSource enum and a resolve_client() helper; every #[tool] method resolves its YouTrack client through it instead of reading a bare Arc<Client> field. The only variant today is Single (the stdio env client). The per-user HTTP variant (resolved from the authenticated request principal) is added with the remote transport, so the tool layer will not need to change again.
  • tokio gains the net and signal features for the upcoming HTTP server and the new shutdown handling. Cargo.lock is unchanged.

Verification

  • just check (fmt, clippy with -D warnings, build, Docker builder-stage compile) passes.
  • cargo test passes.
  • Manual smoke: --transport http, YT_MCP_TRANSPORT=http, an unknown value, and a missing --transport value each produce the expected error and exit 1; the default stdio path completes an MCP initialize handshake and logs to stderr.

Resolves #YTMCP-3.

First step of the multi-user remote MCP epic (#YTMCP-2). Pure refactor: stdio behavior is unchanged, and no HTTP / SQLite / OAuth code lands here. ## What changed - `main.rs` selects the transport from `--transport <stdio|http>` (or `--transport=<value>`), falling back to `YT_MCP_TRANSPORT`, then to the default `stdio`. The `http` arm returns a clear not-yet-implemented error (tracked in #YTMCP-6). - stdio serving now exits cleanly on client disconnect (stdin EOF) or a shutdown signal (SIGINT, and SIGTERM on Unix). - `server.rs` introduces a `ClientSource` enum and a `resolve_client()` helper; every `#[tool]` method resolves its YouTrack client through it instead of reading a bare `Arc<Client>` field. The only variant today is `Single` (the stdio env client). The per-user HTTP variant (resolved from the authenticated request principal) is added with the remote transport, so the tool layer will not need to change again. - `tokio` gains the `net` and `signal` features for the upcoming HTTP server and the new shutdown handling. `Cargo.lock` is unchanged. ## Verification - `just check` (fmt, clippy with `-D warnings`, build, Docker builder-stage compile) passes. - `cargo test` passes. - Manual smoke: `--transport http`, `YT_MCP_TRANSPORT=http`, an unknown value, and a missing `--transport` value each produce the expected error and exit 1; the default stdio path completes an MCP `initialize` handshake and logs to stderr. Resolves #YTMCP-3.
feat(transport): add transport flag and ClientSource seam
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 20s
Create release / Create release from merged PR (pull_request) Has been skipped
7c1e803b3d
Prepare for a multi-user remote HTTP transport without changing stdio behavior. main.rs now selects the transport from `--transport` / `YT_MCP_TRANSPORT` (default stdio); `http` returns a clear not-yet-implemented error pending YTMCP-6. stdio gains graceful shutdown on SIGINT/SIGTERM.

server.rs routes every tool through a new `ClientSource` enum and `resolve_client()` helper instead of a bare `Arc<Client>` field. Today the only variant is `Single` (the stdio env client); the per-user HTTP variant resolved from a request principal lands with the remote transport, so the tool layer will not change again.

tokio gains the `net` and `signal` features for the upcoming HTTP server and the new shutdown handling.

#YTMCP-3
David merged commit b3e79afaf8 into main 2026-06-14 21:07:30 +02:00
David deleted branch feat/transport-flag-clientsource 2026-06-14 21:07:30 +02:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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-mcp!8
No description provided.