Skip to main content

MCP server (apps/mcp)

Clone — the user model that sits between you and your AI agents — exposed as an MCP server. Drop it into Claude Code, Claude Desktop, Cursor, or any MCP-aware client and your agents start talking to your Clone instead of you whenever Clone is confident enough.

The package is intentionally a 1:1 facade over apps/server. No business logic lives here; every threshold, prompt template, and memory shape is owned by the Django side.

Tools

ToolPurpose
predict_next_promptTop-K ranked candidate replies with calibrated probabilities. Clients implement automation (auto-respond when confidence ≥ threshold) or autocomplete (rank suggestions) on top of this.
predict_continuationPersonalized loop-termination decision for ralph-style self-correcting agents — returns should_continue: bool with calibrated confidence so the plugin can stop iterating when the user would already be satisfied.
submit_feedbackClose the prediction loop — accepted / edited / rejected so Platt calibration and fact decay learn.
start_session / stop_sessionOpen / close a recording session; start_session returns the session_id to thread through later calls.
record_agent_prompt / record_agent_responsePush agent.prompt / agent.response events. UUID + timestamp are auto-generated; the prompt's event_id pairs with the response's in_response_to.

Tool-by-tool detail with payload examples lives in MCP Server reference.

Transports

ModeWhenAuth
stdio (default)Local install (Claude Code, Cursor, Claude Desktop).Single-tenant — CLONE_API_TOKEN is required at process start.
httpPublic deployment behind https://clone.is/mcp.Multi-tenant — each MCP session is bound to the JWT carried in Authorization: Bearer … on its initialize request.

apps/mcp/src/index.ts picks the mode from MCP_TRANSPORT (defaults to stdio). HTTP mode falls back to CLONE_API_TOKEN if a per-request bearer is missing, so the same image can also serve a single-tenant deployment.

Token shapes

apps/mcp/src/index.ts chooses the auth header from the token shape:

  • Token starts with clone_X-Clone-API-Key: clone_… (long-lived API key).
  • Anything else → Authorization: Bearer <jwt> (60-min JWT).

Install — Claude Code (stdio)

claude mcp add clone -- npx -y @clone/mcp \
-e CLONE_API_URL=https://api.clone.is \
-e CLONE_API_TOKEN=clone_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Install — Smithery (HTTP, hosted at clone.is/mcp)

npx -y @smithery/cli mcp publish "https://clone.is/mcp" -n cloneisyou/clone

End users supply their own CLONE_API_TOKEN in Smithery's config UI; that token is forwarded as Authorization: Bearer … on every request, so one MCP instance serves many users.

Run it locally

cd apps/mcp
npm install

# stdio mode (matches Claude Code launch)
export CLONE_API_URL=http://localhost:8001
export CLONE_API_TOKEN=<dev API key>
npm run dev

# http mode (matches production behind clone.is/mcp)
MCP_TRANSPORT=http PORT=3000 npm run dev
# → http://127.0.0.1:3000/mcp + /health

Tests: npm test runs 16 unit tests across api / server / http transports. End-to-end smoke tests (real Anthropic call) are at npm run test:e2e (stdio) and npm run test:e2e:http (against a deployed URL).