feat(mcp): expose action run artifacts as MCP tools #80
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/FJ-62-mcp-action-artifacts"
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?
The CLI has shipped
fj actions artifactsandfj 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 tofj_core::actions::{list_artifacts, download_artifact}, so no web-route logic is reimplemented in the MCP layer.list_action_artifactsreturns theArtifactlist as JSON (Artifactnow derivesSerialize).download_action_artifactwrites each artifact's zip todest_path(a directory) or the server's temp directory and returns one{ path, bytes, filename }entry per file, matching the existing binary-payload convention ofget_release_archive/download_release_attachment/download_issue_attachment.nameselects 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 aForgejoclient.ForgejoServer::host_and_tokenresolves those per transport (the stdio identity, or the account's stored instance over HTTP) alongside the existingapi/api_and_tokenresolvers.#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