Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
05438d9
Add scoping doc for a local-deployment MCP instance
claude Jul 23, 2026
343f2c4
Rescope: minimal stdio local binary, no OAuth, prod II
claude Jul 23, 2026
286b34f
Keep the crate named imcp2 in the layout
claude Jul 24, 2026
ffbfaba
Add "Working with AI tool clients" section
claude Jul 27, 2026
c7c13e0
Update the scoping doc for the 63-commit rebase onto v0.2.0
claude Aug 20, 2026
438fef7
Restructure the design doc to the standard feature-doc shape
claude Aug 20, 2026
0a88e9d
Add a concise high-level companion to the local-deployment design
claude Aug 20, 2026
fcaa62e
Refer to ICP CLI-spawned local replicas, not dfx
claude Aug 20, 2026
975181b
Make the local-replica mode a test configuration, not a non-goal
claude Aug 20, 2026
3916d21
State the no-listening-socket claim precisely
claude Aug 20, 2026
12205c6
Recommend an imcp2-core crate over the hosted feature flag
claude Aug 20, 2026
5c4dc94
Make the session-handling component self-contained in the overview
claude Aug 20, 2026
7bf434b
Make the design docs self-contained
claude Aug 23, 2026
b42ed13
Drop the local-replica bullet from Non-goals
claude Aug 23, 2026
f35d9b6
Resolve the login-flow choices like the ICP CLI; add end-user setup UX
claude Aug 23, 2026
de2918c
Add the upgrade story to the end-user setup UX
claude Aug 23, 2026
e692051
Add signing and provenance to the end-user setup component
claude Aug 24, 2026
bad2c55
Promote signing and provenance to its own design component
claude Aug 24, 2026
92ddb1e
Commit to PocketIC as the integration-test dependency
claude Aug 24, 2026
c498f8c
Reconcile the dependency and AuthStore claims with the axum decision
claude Aug 24, 2026
8ffe6b7
docs: address second review round on the local-deployment design
claude Aug 24, 2026
0cecf83
docs: address third review round on the local-deployment design
claude Aug 24, 2026
e045f09
docs: address fourth review round on the local-deployment design
claude Aug 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions docs/local-deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# IMCP2 local deployment — overview

Status: **draft**. This is the concise, high-level doc; the full design with code-level
detail and evidence lives in [`scoping-local-deployment.md`](scoping-local-deployment.md).

## Summary

We will ship **`imcp2-local`**: a small binary users run on their own machine and register
with their AI tool (Claude, Codex, Cursor, …) as a local MCP server. It speaks MCP over
**stdio**, talks to **mainnet** and **production Internet Identity**, and keeps the full II
experience — the user logs in with their real anchor via a browser handshake, and the server
mints per-app account delegations on demand. What it drops is the entire **OAuth 2.1
authorization server**: a single-user process reached over a pipe needs no bearer tokens.
The shared components move into a new `imcp2-core` library; the existing `imcp2` crate
remains the hosted server built on it.

## Problem

Today IMCP2 exists only as a hosted, multi-tenant server: a public streamable-HTTP endpoint
gated by OAuth 2.1. For someone working from a desktop or IDE AI tool this has two costs:

- **Trust.** Their Internet Identity login — and every delegation minted from it — runs
through a third-party server, even though they are acting on their own mainnet accounts.
- **Weight.** OAuth exists so *remote* clients can authenticate to a *public* endpoint. A
local single-user server inherits all of that machinery (tokens, PKCE, client
registration, discovery documents, a state directory) without needing any of it.

At the same time, every major desktop AI tool can spawn **local stdio MCP servers** — and
there is no IMCP2 artifact that fits that slot.

## Non-goals

- **No change to the hosted server** — its name, behavior, and deployments stay as they are.
- **No session persistence in v1** — sessions are in-memory; the user signs in again after
a restart, when the grant expires, or if they revoke it.
- **Not for cloud-only AI surfaces** — claude.ai web/mobile, Perplexity web, and Codex Cloud
cannot reach a local process; they continue to use the hosted server.

## Approach

Hosted-vs-local is a **deployment axis, not a network one**: both talk to the same mainnet
and the same production II. What changes is who can reach the server, and therefore what
machinery is needed.

- **stdio transport.** The MCP tool surface has no listening socket: it is reachable only by
the AI tool that spawned it, over stdin/stdout, so the OS process boundary replaces the
OAuth bearer gate. The one socket the binary ever opens is the transient loopback listener
below — it serves only the login handshake, never the tools.
- **Internet Identity stays.** On first authenticated use the binary opens the user's
browser to II, receives the delegation on a transient localhost callback, redeems it, and
holds the session in memory — the same handshake the hosted server runs, minus the OAuth
wrapper around it.
- **Login is an in-band tool.** No AI client shows a stdio server's logs in chat, so the
login URL is returned as the result of an `authenticate` tool (with best-effort browser
auto-open), lazily on first use and without blocking on the callback.
- **A component core, two thin binaries.** A new `imcp2-core` library holds the shared
components (the tools, II sessions, the connect handshake) from which either server is
composed; `imcp2` keeps its name as the hosted server built on it, and `imcp2-local` is a
new small binary built on it that carries none of the hosted server's OAuth machinery.

## Design components

1. **Crate layout** — `imcp2-core` (shared components), `imcp2` (hosted library + binary;
unchanged name and deployments), `imcp2-local` (new minimal binary).
2. **Dependency profile** — the local closure is the MCP stack (stdio), `ic-agent`/Candid,
the discovery/management essentials, and axum for the transient login listener alone; no
CORS layer, no metrics stack, no OAuth persistence.
3. **IC + II wiring** — a mainnet agent and production II, env-overridable for staging.
4. **Auth partition** — keep the II connect-handshake primitives (link builder, callback
page, delegation parser, the II callback allow-list, a slim redeem); drop the whole
OAuth authorization server.
5. **Browser login** — three transient loopback routes during the handshake; the grant then
lives in memory only.
6. **AI tool clients** — Claude Desktop, Claude Code, Codex, Cursor, Antigravity, and the
Perplexity macOS app run `imcp2-local` directly; cloud surfaces keep using hosted.
7. **Session handling** — every tool call acts as the user's Internet Identity session, so
each server must answer "which session?" The hosted server serves many users and resolves
it from each request's OAuth bearer token; the local server has exactly one user, so its
tools read the single in-memory session established at login. The tool implementations
are identical in both.
8. **Security model** — whoever drives the binary acts as the user's real II accounts on
mainnet: treat the binary and its client config like a wallet.
9. **End-user setup** — no config editing anywhere: double-click the plugin bundle for
Claude Desktop, a one-click install link for Cursor, one pasted command for Claude Code
and Codex, guided connector UIs for Perplexity (macOS) and Antigravity — plus an
`imcp2-local setup` command that detects installed clients and registers the binary for
you. Signing in is one browser round-trip on first use. Upgrading is one command (or a
new double-click for the Claude Desktop bundle): clients point at a stable path, the
installer's updater swaps the binary in place, and there is no state to migrate.
10. **Signing and provenance** — release binaries are Apple-signed + notarized and
Windows-signed (the OS gates that make double-click and client-spawned launches work),
and every artifact carries a keyless supply-chain attestation proving it came from this
repository's release workflow.

## Implementation Stages

1. **Extract `imcp2-core`.** Move the shared components into the new core crate (with
`imcp2` re-exporting them for existing embedders) and introduce the session seam — no
behavior change to the hosted server.
2. **Ship `imcp2-local`.** The stdio server, the browser-login driver, and the loopback
callback listener. Exit: a user logs in against II and uses the tools as their accounts.
3. **Polish.** End-user packaging and setup (the double-click bundle, install links, the
`setup` command, the installers + in-place updater, Apple/Windows-signed binaries with
supply-chain attestations) and the wallet-grade trust note; integration tests that
run `imcp2-local` against PocketIC with an II canister deployed there, extending the
existing end-to-end harness to the local login flow; optional keychain-backed session
persistence.

Loading
Loading