feat(mcp): expose action run artifacts as MCP tools #80

Merged
Claude-Run merged 1 commit from feat/FJ-62-mcp-action-artifacts into main 2026-07-19 23:59:29 +02:00
Member

The CLI has shipped fj actions artifacts and fj actions artifact download, but the MCP server exposed no artifact tool: after FJ-61 artifacts were the last actions capability a client could not reach. Add two READ-tier tools delegating to fj_core::actions::{list_artifacts, download_artifact}, so no web-route logic is reimplemented in the MCP layer.

list_action_artifacts returns the Artifact list as JSON (Artifact now derives Serialize). download_action_artifact writes each artifact's zip to dest_path (a directory) or the server's temp directory and returns one { path, bytes, filename } entry per file, matching the existing binary-payload convention of get_release_archive / download_release_attachment / download_issue_attachment. name selects a single artifact; omitting it downloads every artifact of the run, matching the CLI default. Artifact names are sanitized into zip file names the same way the CLI does, so a name carrying path separators cannot escape the destination directory.

Artifacts are served by Forgejo web routes rather than /api/v1, so the wrappers take a host URL and bearer token instead of a Forgejo client. ForgejoServer::host_and_token resolves those per transport (the stdio identity, or the account's stored instance over HTTP) alongside the existing api / api_and_token resolvers.

#FJ-62

The CLI has shipped `fj actions artifacts` and `fj actions artifact download`, but the MCP server exposed no artifact tool: after FJ-61 artifacts were the last actions capability a client could not reach. Add two READ-tier tools delegating to `fj_core::actions::{list_artifacts, download_artifact}`, so no web-route logic is reimplemented in the MCP layer. `list_action_artifacts` returns the `Artifact` list as JSON (`Artifact` now derives `Serialize`). `download_action_artifact` writes each artifact's zip to `dest_path` (a directory) or the server's temp directory and returns one `{ path, bytes, filename }` entry per file, matching the existing binary-payload convention of `get_release_archive` / `download_release_attachment` / `download_issue_attachment`. `name` selects a single artifact; omitting it downloads every artifact of the run, matching the CLI default. Artifact names are sanitized into zip file names the same way the CLI does, so a name carrying path separators cannot escape the destination directory. Artifacts are served by Forgejo web routes rather than `/api/v1`, so the wrappers take a host URL and bearer token instead of a `Forgejo` client. `ForgejoServer::host_and_token` resolves those per transport (the stdio identity, or the account's stored instance over HTTP) alongside the existing `api` / `api_and_token` resolvers. #FJ-62
feat(mcp): expose action run artifacts as MCP tools
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 29s
Create release / Create release from merged PR (pull_request) Has been skipped
705e1953a2
The CLI has shipped `fj actions artifacts` and `fj actions artifact download`, but the MCP server exposed no artifact tool: after FJ-61 artifacts were the last actions capability a client could not reach. Add two READ-tier tools delegating to `fj_core::actions::{list_artifacts, download_artifact}`, so no web-route logic is reimplemented in the MCP layer.

`list_action_artifacts` returns the `Artifact` list as JSON (`Artifact` now derives `Serialize`). `download_action_artifact` writes each artifact's zip to `dest_path` (a directory) or the server's temp directory and returns one `{ path, bytes, filename }` entry per file, matching the existing binary-payload convention of `get_release_archive` / `download_release_attachment` / `download_issue_attachment`. `name` selects a single artifact; omitting it downloads every artifact of the run, matching the CLI default. Artifact names are sanitized into zip file names the same way the CLI does, so a name carrying path separators cannot escape the destination directory.

Artifacts are served by Forgejo web routes rather than `/api/v1`, so the wrappers take a host URL and bearer token instead of a `Forgejo` client. `ForgejoServer::host_and_token` resolves those per transport (the stdio identity, or the account's stored instance over HTTP) alongside the existing `api` / `api_and_token` resolvers.

#FJ-62
Claude-Run deleted branch feat/FJ-62-mcp-action-artifacts 2026-07-19 23:59:29 +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/forgejo-cli!80
No description provided.