Copilot CLI
Install context-mode in GitHub Copilot CLI with one plugin command — it registers the MCP server, the routing skill, and camelCase JSON hooks.
GitHub Copilot CLI integrates context-mode through JSON stdin/stdout hooks that use camelCase event names. The hooks route data-heavy tool output into the sandbox and keep the bulk of raw payload bytes out of your window — the model writes a program that processes the data and prints only the answer. A single plugin command registers the MCP server, the routing skill, and the capture hooks at once.
context-mode runs 100% locally with zero telemetry. Indexing and execution never leave your machine.
Install
The plugin install is a pure plugin command, but the Copilot MCP server runs the
global context-mode binary, so npm install -g context-mode is a prerequisite.
Install the package
Install context-mode globally. The MCP server launches this binary, and the hooks dispatch through it.
npm install -g context-modeInstall the plugin
Run the plugin install. This single command registers the MCP server, the
routing skill, and the capture hooks — there is no separate context-mode upgrade step or agent call to run afterward.
copilot plugin install mksglu/context-mode:configs/copilot-cliThe install registers six capture hooks — preToolUse, postToolUse,
sessionStart, userPromptSubmitted, agentStop, and preCompact — each
dispatching context-mode hook copilot-cli <event>.
Platform detection
The MCP server is launched with CONTEXT_MODE_PLATFORM=copilot-cli, so it
self-identifies as Copilot CLI regardless of any other CLI installed on the
machine. Platform detection and ctx_upgrade always resolve copilot-cli,
never a co-installed Claude Code.
Alternative (no plugin)
The plugin path above is strongly preferred — it wires the six capture hooks
automatically. This alternative registers the MCP server only and leaves you
without hooks until you run ctx_upgrade from inside Copilot, so reach for it
only if you cannot use the plugin install.
If you prefer to register the MCP server directly instead of using the plugin,
add it with copilot mcp add. The CONTEXT_MODE_PLATFORM env keeps detection
unambiguous.
copilot mcp add context-mode --env CONTEXT_MODE_PLATFORM=copilot-cli -- context-modeThis path is MCP-only and ships no hooks. To also install the capture hooks, run
the upgrade from inside Copilot — so it detects copilot-cli through the live
MCP client — rather than standalone.
copilot -p "Use the context-mode ctx_upgrade tool to install context-mode's hooks." --allow-allVerify
Confirm the install with the doctor. It checks language runtimes, the FTS5 knowledge base, and hook registration, then reports anything that needs attention.
context-mode doctorA clean run means context-mode is ready to route your next data-heavy command.
Caveats
context-mode writes Copilot CLI's native camelCase hook keys (preToolUse,
postToolUse, and so on). The Copilot CLI also accepts PascalCase event names,
so the casing is not load-bearing — but the plugin and context-mode upgrade
always write camelCase to match the CLI's native naming.
Related
Codex CLI
Install context-mode on Codex CLI through its plugin marketplace — add the marketplace, enable two feature flags, and optionally copy the routing file.
Cursor
Install context-mode on Cursor with native JSON hooks in .cursor/hooks.json. Local-folder plugin today, one-click Marketplace plugin once published.