context-mode
Installation

JetBrains Copilot

Install context-mode in the JetBrains Copilot agent, a package host that integrates through JSON hooks and an MCP server.

The JetBrains Copilot agent is GitHub Copilot's agentic mode inside JetBrains IDEs. It runs context-mode with the same JSON lifecycle hooks as the VS Code Copilot agent — PreToolUse, PostToolUse, PreCompact, and SessionStart — and the same f1e_ tool prefix. These four hooks route data-heavy tool output into the sandbox and keep about 98% of raw payload bytes out of your window. The model writes a program that processes the data and prints only the answer.

context-mode runs 100% locally with zero telemetry. Indexing and execution never leave your machine.

Install

The Copilot agent has no plugin marketplace, so install the package globally first, then configure the server and hooks.

Check the prerequisites

You need Node 22.5+ or Bun on your PATH. The hook dispatcher and sandbox run on this runtime.

Check the runtime
node --version

Install the package

This installs the MCP server, the hook dispatcher, and the context-mode command line.

Global install
npm install -g context-mode

Configure the MCP server

Configure the context-mode MCP server from the IDE settings under Settings, then Tools, then GitHub Copilot, then MCP. Add context-mode as the command with no arguments, then confirm the server connects. JetBrains stores this registration in the Settings UI, not in a project file.

MCP server entry
{
  "context-mode": {
    "command": "context-mode"
  }
}

Add the hooks

Add the context-mode hooks file at .github/hooks/context-mode.json. The four hooks point at the context-mode dispatcher, which decides whether a tool call should run in the sandbox. The dispatch command is context-mode hook jetbrains-copilot <event> with a lowercase event name.

.github/hooks/context-mode.json
{
  "hooks": {
    "PreToolUse": [
      { "type": "command", "command": "context-mode hook jetbrains-copilot pretooluse" }
    ],
    "PostToolUse": [
      { "type": "command", "command": "context-mode hook jetbrains-copilot posttooluse" }
    ],
    "PreCompact": [
      { "type": "command", "command": "context-mode hook jetbrains-copilot precompact" }
    ],
    "SessionStart": [
      { "type": "command", "command": "context-mode hook jetbrains-copilot sessionstart" }
    ]
  }
}

Tool names

context-mode tools are exposed with an f1e_ prefix here instead of the usual mcp__ prefix. Recognize the tool names by that prefix — for example f1e_ctx_execute and f1e_ctx_search are the same tools documented elsewhere as ctx_execute and ctx_search.

GitHub Copilot plugin v1.5.57 or newer is required for MCP server support and the f1e_ tool surface. Update the plugin from the JetBrains plugins marketplace before configuring context-mode.

Verify

Confirm the install with the doctor. It checks language runtimes, the FTS5 knowledge base, and hook registration, then reports anything that needs attention.

Verify the setup
context-mode doctor

A clean run means context-mode is ready to route your next data-heavy command.

On this page