Repository navigation
Conversation
ebdac6f to
b397fd4
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent deployments or retries after an interrupted response can create duplicate funded canisters; balance checks may use the wrong network, and revoked grants may continue signing.
6 open issues
Disable signing after terminal authorization failures · New Persist canister creation progress across interrupted requests · New Prevent concurrent deploys from creating duplicate canisters · New Check the deployment balance on mainnet · New Keep the resolved II account stable during deployment · New Clarify which identity the deploy tool uses · New
What changed in this PR
Completes the three-part deployment integration by exposing bundle deployment and cycles-balance tools through the local MCP server, while keeping deployment dependencies out of the published core crates.
Changes:
- Adds authenticated deployment tools with validated inputs, structured results, and refreshing signing identities.
- Composes the tools and deployment skill into the local server, with expanded MCP round-trip tests.
- Documents the bundle–deploy–save-mapping workflow and exposes reusable core balance helpers.
| File | Description |
|---|---|
crates/imcp2-local/src/server.rs |
Routes deployment tools, serves the skill, and extends integration tests. |
crates/imcp2-local/src/main.rs |
Constructs and wires the deployment tool group. |
crates/imcp2-local/README.md |
Documents deployment inputs, identities, and mapping persistence. |
crates/imcp2-local/Cargo.toml |
Adds the deployment crate dependency. |
crates/imcp2-deploy/static/skills/deploy-with-mcp.md |
Adds agent guidance for bundling, deploying, and saving IDs. |
crates/imcp2-deploy/src/lib.rs |
Implements tool schemas, validation, authorization, and results. |
crates/imcp2-deploy/src/identity.rs |
Adds delegation refresh during long-running deployments. |
crates/imcp2-core/src/management.rs |
Extracts a balance helper for an explicit principal and agent. |
crates/imcp2-core/src/lib.rs |
Exports balance helpers and their result type. |
crates/imcp2-core/src/identities.rs |
Makes identity-specific agent construction public. |
Cargo.lock |
Records the local server’s deployment dependency. |
Review effort: Balanced
b397fd4 to
70e073e
Compare
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
10 open issues
Check the deployment balance on mainnet Prevent concurrent deploys from creating duplicate canisters Persist canister creation progress across interrupted requests Disable signing after terminal authorization failuresbundle_pathis documented (and taught in the skill) as requiring an absolute path, but… · Newlist_resourcesappends an extra resource after delegating toself.tools.list_resources(...),… · New Clarify which identity the deploy tool uses Keep the resolved II account stable during deployment The rejection message saysis not a canister id, but the parser used (Principal::from_text)… · New This comment says \"The deploy tool\" but the PR adds a deploy tool group with two tools… · New
Review effort: Lite
70e073e to
2725472
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Recovery records can be lost or incomplete, risking duplicate funded canisters, while untrusted plugins can exhaust server memory.
4 open issues
10 resolved since last review
Check the deployment balance on mainnet Prevent concurrent deploys from creating duplicate canisters Persist canister creation progress across interrupted requests Disable signing after terminal authorization failureslist_resourcesappends an extra resource after delegating toself.tools.list_resources(...),…bundle_pathis documented (and taught in the skill) as requiring an absolute path, but… Clarify which identity the deploy tool uses Keep the resolved II account stable during deployment This comment says \"The deploy tool\" but the PR adds a deploy tool group with two tools… The rejection message saysis not a canister id, but the parser used (Principal::from_text)…
Review effort: Balanced
| Ok(id) => id, | ||
| Err(e) => return Ok(err(e)), | ||
| }; | ||
| match deploy_bundle(identity, request).await { |
There was a problem hiding this comment.
Still open: the runner builds its own engine and store (icp-sync-plugin), so the limiter belongs upstream, and host_for's doc records the gap. Refusing sync steps until then would refuse the asset canister a bundle is deployed for. Left open until the runner has one.
2725472 to
b338b60
Compare
b338b60 to
bfbaff6
Compare
bfbaff6 to
2cda921
Compare
2cda921 to
a02bfb5
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The deployment guide overstates compatibility protection because the upstream check skips comparison when deployed Candid metadata is unreadable; qualify the guarantee and advise separate verification in that case.
2 open issues
3 resolved since last review
Review effort: Balanced
| Canisters named in `canister_ids` are upgraded with the Candid compatibility | ||
| check; an incompatible interface change fails the deploy before any code is | ||
| replaced. Pass `skip_candid_check: true` only when the user has accepted the | ||
| break. `mode` (default `auto`; `install`, `reinstall`, `upgrade`), |
08516e7 to
5217b77
Compare
5217b77 to
150a493
Compare
…icp_cycles_balance, icp_deploy_guide `IcDeployTools` is the tool group over the pipeline, and `WithDeploy` the handler that serves it beside the core surface. A deploy is signed as the user's developer principal, runs as one blocking call that reports each phase as it completes (a progress notification, or a log message for a client that sent no token), and is interrupted when the call is cancelled. One deploy runs per session, and a server caps how many run at once; past either a deploy is refused, not queued. Each deploy's working directory is its owner's alone, under a directory the server names. A server takes the bundle one way and lists that argument alone: a path on a server that sits with the project, an upload on one that does not. The upload side (`icp_deploy_upload`, on the store from the previous change) is here with the rest of the tool group; nothing mounts it until the hosted server does. The deploy skill is served as `skill://deploy-with-mcp` and returned by `icp_deploy_guide` for a client that reads no resources. imcp2-local composes the group always, takes the bundle by path, and refuses to start without a local data directory for deploy records. Co-Authored-By: Claude Fable 5.2 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The test cleanup can destroy pre-existing files by recursively deleting the working directory’s entire state folder, and the guide misstates hosted authentication recovery and compatibility-check guarantees.
4 open issues
Review effort: Balanced
| let tools = tools().deploys_in(std::path::Path::new("state/deploys")).unwrap(); | ||
| let dir = tools.deploys_dir.clone().unwrap(); | ||
| assert!(dir.is_absolute(), "{dir}"); | ||
| let cwd = std::env::current_dir().unwrap().canonicalize().unwrap(); | ||
| assert_eq!(dir.as_std_path(), cwd.join("state/deploys")); | ||
| assert!(dir.is_dir(), "made now, not on first use"); | ||
| std::fs::remove_dir_all(cwd.join("state")).unwrap(); |
| - 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`. |
150a493 to
b9cab2f
Compare



Summary
The MCP tools over the pipeline, the handler that serves them beside the core surface, and
imcp2-localcomposing them.icp_deploy_bundletakes a bundle, the environment name, and optionally the canister-id mapping an earlier deploy returned. It answers with the status, the mapping to pass back next time, the canisters created and a per-phase log, as structured content under a declared output schema. A failed or interrupted run still reports every canister it created.bundle_path; one the agent cannot hand a file to takesbundle_upload, the id of an upload received through imcp2-deploy 4/6: receive a bundle by upload ticket #247's store. Each server lists the one argument it takes and refuses the other before anything is read, so a server reached over the network reads no path a caller names.icp_cycles_balancereports that principal and its cycles balance.icp_deploy_guidereturns the deploy skill, which is also served asskill://deploy-with-mcp, for a client that reads no resources.icp_deploy_uploadmints an upload ticket and is listed only by a server with an upload store; nothing mounts one until #243.WithDeploy<H>serves an inner handler's tools with the deploy tools beside them, the skill next to the inner resources, and puts a DEPLOYING paragraph in the place of core's "no tool here deploys" paragraph (DEPLOYS_ELSEWHERE).imcp2-localwrapsWithDeploy<IcTools>, takes the bundle by path, keeps each deploy's working directory under the OS's local data directory, and refuses to start without one.What changed in this PR at the re-cut
WithDeploy, the slots across sessions,icp_deploy_upload,ClientGone) and what Take the bundle one way per server: a path locally, an upload on the hosted one #245 changed (one bundle source per server,bundle_base64removed, the shorter instructions).identity.rsmoved down to imcp2-deploy 2/6: sign a deploy's calls as the user, with an identity that refreshes #246.Review so far
icp_deploy_guidereturns it as a tool result.icp_cycles_balancedescription and the skill no longer namecli.id.aior CLI identity commands; the slot count is not in the instructions; the skill treats the canister ids as a file to pass in and write back unchanged; the instructions point to the guide once.Changes
crates/imcp2-deploy/src/lib.rs(868 lines of code, 276 of tests),src/server.rs,static/skills/deploy-with-mcp.md;Cargo.tomladdsrmcp,serde,http,url.imcp2-core:cycles_balance_ofsplit out ofcycles_balance;DEPLOYS_ELSEWHEREexported.crates/imcp2-local:server.rs,main.rs,Cargo.toml, README.Testing
cargo build --locked --workspace --all-targetscargo test --locked --workspace --all-targetscargo fmt --all -- --checkTested: each kind of server accepts its bundle argument and refuses the other, and lists the one it takes; the request's defaults, its parsed ids, and the rejections that name a bad mode, id or subnet; a relative deploy directory made absolute; the tool list; the human-readable result; the skill document's shape. The local server's round-trip tests cover the deploy tools in its listing and the skill among its resources.
Not covered: the Internet Identity round trip that mints the deploy delegation, and an on-chain deploy (see #231).
The stack
Six stacked PRs that bring
icp deployto 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 currentmain.icp-projecthost for an untrusted bundleic-agent, an identity that refreshes#242 (streamed phases, interruption) and #245 (one bundle source per server, crates.io) are closed: their changes are folded into the PRs above.
Checklist
🤖 Generated with Claude Code