Skip to content

imcp2-deploy 4/6: receive a bundle by upload ticket - #247

Closed
raymondk wants to merge 1 commit into
deploy-2-pipelinefrom
deploy-2b-uploads
Closed

raymondk wants to merge 1 commit into
deploy-2-pipelinefrom
deploy-2b-uploads

Conversation

@raymondk

@raymondk raymondk commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The store behind uploading a bundle, on its own: one file, no caller yet.

An MCP tool call carries JSON the model writes, and a model cannot write an archive. A server on another machine than the project therefore needs the bytes to arrive another way. Uploads is that way's state: a ticket minted inside an authenticated tool call, presented once on an ordinary PUT of the archive, producing an upload id the deploy call names.

  • A ticket is 256 random bits, single use (spent before a byte of the body is read), gone after five minutes, and there is one pending per session: minting another drops the previous.
  • An upload is bound to the session that minted its ticket, so an id that leaks elsewhere is useless. It is held fifteen minutes for its deploy to begin; the deploy that takes it removes it, and one never taken is swept at expiry.
  • The body is streamed to disk under a cap (64 MiB by default); a declared length over the cap is refused unread.
  • On disk, each archive is a file of its own, 0600 under a 0700 directory, resolved to an absolute path when the store is made.

The tool that mints the ticket (icp_deploy_upload) is in #232 with the rest of the tool group, and the route that takes the PUT is in #243.

Where this came from

uploads.rs was part of #243; the file is unchanged from the top of the old stack. It is a PR of its own so that the ticket's properties can be reviewed apart from the HTTP composition.

Review so far

Carried over from #243:

  • aterga's expect wording nit is applied.
  • Open: aterga asked blind-oracle to check that the ticket header works through the IC gateways.
  • Open: whether having the agent run curl is the right way to upload.

Changes

  • crates/imcp2-deploy/src/uploads.rs (294 lines of code, 101 of tests).
  • crates/imcp2-deploy/Cargo.toml adds getrandom.

Testing

  • cargo build --locked --workspace --all-targets
  • cargo test --locked --workspace --all-targets
  • cargo fmt --all -- --check

Tested: the ticket lifecycle, session binding, the cap declared and undeclared, nothing kept of a refused upload, re-minting.

The stack

Six stacked PRs that bring icp deploy to the MCP servers through the icp CLI's own project library. Re-cut on 2026-11-18 so that each file arrives once, in the form it has at the top; the tree at the top is unchanged from before the re-cut, rebased onto current main.

PR What
1 #230 The crate and the icp-project host for an untrusted bundle
2 #246 Signing: canister calls over ic-agent, an identity that refreshes
3 #231 The deploy pipeline, its events and its interruption
4 #247 The upload-ticket store
5 #232 The MCP tools, and the local server serving them
6 #243 The hosted server serving them

#242 (streamed phases, interruption) and #245 (one bundle source per server, crates.io) are closed: their changes are folded into the PRs above.

Checklist

  • I have read the Contributing guidelines.
  • Docs (README / comments) updated for any user-visible change.
  • No secrets, credentials, or internal-only information are included.

🤖 Generated with Claude Code

… a file to

A model cannot write an archive into a tool call, so a server on another
machine than the project needs the bytes another way. `Uploads` is the
store behind that way: a ticket minted for a session (256 random bits,
single use, five minutes, one pending per session), the archive streamed to
a private file under a size cap on presenting it, and the upload held
fifteen minutes for the session that minted the ticket to take, once.

The store alone; the tool that mints the ticket and the route that takes
the PUT follow.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@raymondk

Copy link
Copy Markdown
Contributor Author

Superseded by the stack #254 → #259, which carries the same code in six PRs from main, with the deploy tools living in imcp2-core instead of a separate crate. The upload store is in #255.

@raymondk raymondk closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant