context-mode
Installation

VS Code Copilot

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

The VS Code Copilot agent is GitHub Copilot's agentic mode inside VS Code. It integrates context-mode through a workspace MCP server and JSON lifecycle hooks — PreToolUse, PostToolUse, PreCompact, and SessionStart — that 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 register the server and hooks in your workspace.

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

Register the MCP server

Register the context-mode MCP server in the workspace mcp.json under the .vscode directory. The global form runs the context-mode binary with no arguments. Reload the window after saving so VS Code picks up the new server.

.vscode/mcp.json
{
  "servers": {
    "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 vscode-copilot <event> with a lowercase event name.

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

Confirm the server is connected

Reload the window, then open the MCP Servers view from the Extensions panel (or run the "MCP: List Servers" command from the Command Palette). Confirm the context-mode server is running and its tools are exposed.

Tool names

In the VS Code Copilot agent, context-mode tools are exposed with an f1e_ prefix instead of the usual mcp__ prefix. Recognize the tool names by that prefix when you see them in the agent — for example f1e_ctx_execute and f1e_ctx_search are the same tools documented elsewhere as ctx_execute and ctx_search.

The .vscode/mcp.json server and the .github hooks file are separate. The agent needs both — the server for the tools and the hooks file for the routing that keeps raw bytes out of your window.

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