Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Missing shutdown cancellation and deployment draining risk losing recovery IDs after cycles are spent, while blocked log forwarding can retain deployment slots and prevent shutdown from completing.
6 open issues
Drain active deploys on shutdown · New Derive identity before consuming the upload · New Bound and cancel blocked log forwarding · New Preserve upload error bodies in the generated curl command · New Document hosted OAuth recovery separately · New Specify the environment used for bundling and deployment · New
What changed in this PR
Exposes the existing deployment pipeline through shared MCP tools and enables deployment in imcp2-local, signing as the user’s default account at https://cli.id.ai.
Changes:
- Adds deployment, balance, upload-ticket, and guide tools with bundle validation, shared concurrency limits, cancellation, and outcome reporting.
- Composes deploy tools and resources alongside the core and local login surfaces.
- Documents the deployment workflow and expands local integration tests.
| File | Description |
|---|---|
crates/imcp2-local/src/server.rs |
Composes deploy tools with core and login handlers; extends integration tests. |
crates/imcp2-local/src/main.rs |
Enables local deployment and configures its working directory. |
crates/imcp2-local/README.md |
Documents deployment, signing identity, progress, and recovery. |
crates/imcp2-core/static/skills/deploy-with-mcp.md |
Adds agent guidance for bundling, deploying, and saving canister mappings. |
crates/imcp2-core/src/tools.rs |
Extracts the core deployment disclaimer for replacement by composed servers. |
crates/imcp2-core/src/management.rs |
Extracts a reusable cycles-balance query for a supplied principal. |
crates/imcp2-core/src/lib.rs |
Exports balance helpers and the deployment disclaimer. |
crates/imcp2-core/src/deploy/server.rs |
Adds the shared handler for deploy tools, resources, and instructions. |
crates/imcp2-core/src/deploy/observe.rs |
Defines deploy refusal and completion observer events. |
crates/imcp2-core/src/deploy/mod.rs |
Implements MCP tools, argument validation, slot management, and progress forwarding. |
Review effort: Max
Comment on lines
+193
to
+195
| let deploy = IcDeployTools::new(identities.clone(), slot.resolver()) | ||
| .deploys_in(&data.join("imcp2-local").join("deploys")) | ||
| .map_err(anyhow::Error::msg)?; |
| None, | ||
| ), | ||
| Some((uploads, _)) => { | ||
| let taken = match uploads.take(&bundle, &sid).await { |
| let result = deploy_bundle(identity, request, watch).instrument(span.clone()).await; | ||
| // The sender went with the run; the forwarder ends once it has | ||
| // delivered what is left. | ||
| let _ = forwarder.await; |
| let minted = uploads.mint(&sid).await; | ||
| let output = UploadTicketOutput { | ||
| curl: format!( | ||
| "curl -fsS -T <bundle.tar.gz> -H '{TICKET_HEADER}: {}' '{url}'", |
Comment on lines
+37
to
+40
| - A signed-in session with the "Actions & questions" access level. If a | ||
| tool answers that it needs an authenticated session, call `authenticate`, | ||
| have the user open the returned id.ai link, then retry. Check with | ||
| `auth_status`. |
Comment on lines
+59
to
+80
| This builds every canister, then writes a gzipped tar archive holding the | ||
| built wasms, the plugins the sync steps need, and a rewritten `icp.yaml` | ||
| whose build steps reference the bundled wasms, pinned by sha256. The bundle | ||
| is self-contained: the server needs no toolchain to deploy it. | ||
|
|
||
| Rules that matter here: | ||
|
|
||
| - Use an absolute output path outside any directory a canister syncs (a | ||
| frontend's `dist/`, for example), or the archive would include itself. | ||
| - Only `plugin` sync steps can be replayed from a bundle. A canister with a | ||
| `script` sync step cannot be bundled; the CLI says so. | ||
| - A server that deploys for others runs only the sync plugins it knows: the | ||
| released plugins that upload a frontend's assets, each known by the hash | ||
| of its module. A bundle whose canister is synced by any other plugin — a | ||
| build of your own, a release the server has not been told of — is refused | ||
| on the upload (`422`) or by the deploy, and the refusal lists the hashes | ||
| the server runs. That is not something to retry or work around: tell the | ||
| user, who can switch the project to a listed plugin release and bundle | ||
| again, or deploy with a server of their own (`imcp2-local`, or `icp | ||
| deploy`), which runs whatever the project brings. | ||
| - The bundle is built for the environments the manifest declares. Pick the | ||
| one you will deploy in step 2 now, and build with the matching settings. |
raymondk
force-pushed
the
deploy-core-4-tools-local
branch
from
November 19, 2026 04:06
4a07377 to
4d8c6d1
Compare
raymondk
force-pushed
the
deploy-core-4-tools-local
branch
from
November 19, 2026 15:59
4d8c6d1 to
3835cbd
Compare
- **The tools** (`imcp2_core::deploy::IcDeployTools`, mounted beside the core surface by `WithDeploy`): `icp_deploy_bundle` deploys a bundle to the Internet Computer as the user, every phase of `icp deploy`, creating the canisters the given mapping does not name and upgrading those it does, and reports each phase as it completes; `icp_cycles_balance` reports the balance those deploys create canisters from, and the principal that holds it; `icp_deploy_upload` mints an upload ticket, on a server that takes its bundles that way; `icp_deploy_guide` returns the skill that walks an agent through the loop (also a resource). - **One way in per server.** A server on the project's machine reads the bundle at the path the agent names; one the agent cannot hand a file to takes an upload, and reads no path a caller gives it. Each lists the one argument it takes. - **Bounded.** One deploy per session, and so many at once across sessions in slots a process can share between its endpoints: past either a deploy is refused, not queued. A server that is stopping begins none and interrupts those running, and can wait for them to have ended. - **Observable.** What became of each deploy call — refused, and why; or how it ended, and how long it held its slot — is told to an observer, for a server to count: the call itself is one request among many to the transport that carries it. - **imcp2-local serves them**, signing as the user's default Internet Identity account at `https://cli.id.ai`, the principal `icp identity link web` links the CLI to, with each deploy's directory under the user's local data directory. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01XSXgo38kH12wagL3rstXfV
raymondk
force-pushed
the
deploy-core-4-tools-local
branch
from
November 19, 2026 16:21
3835cbd to
7ebe764
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fourth of six. Stacked on the deploy pipeline PR.
What this PR adds
The MCP tools (
imcp2_core::deploy::IcDeployTools, mounted beside the core surface byWithDeploy):icp_deploy_bundle: deploys a bundle as the user, creating the canisters the given mapping does not name and upgrading those it does, reporting each phase as it completes.icp_cycles_balance: the balance those deploys draw on, and the principal that holds it.icp_deploy_upload: mints an upload ticket, on a server that takes bundles that way.icp_deploy_guide: returns the skill that walks an agent through the loop (also served as a resource).Rules the tools enforce:
imcp2-localserves them, signing as the user's default Internet Identity account athttps://cli.id.ai, the principalicp identity link weblinks the CLI to.Open questions carried over from #243
A reviewer raised these on the old PR and they were not answered. They apply to code in this PR:
These are design decisions I have not made on the author's behalf.
Testing
Argument handling for both kinds of server, the tool listing, slot sharing, stop propagation, outcome classification, and the local server's composition.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XSXgo38kH12wagL3rstXfV