Setup guide for using context-mode with JetBrains IDEs (IntelliJ IDEA, WebStorm, PyCharm, etc.) via the GitHub Copilot plugin.
- Node.js 18+ (
node --version) - JetBrains IDE — any JetBrains IDE (IntelliJ IDEA, WebStorm, PyCharm, GoLand, Rider, CLion, etc.)
- GitHub Copilot plugin v1.5.57+ — install from Settings > Plugins > Marketplace, search "GitHub Copilot"
JetBrains configures MCP servers via the Settings UI, not a file.
- Open your JetBrains IDE.
- Go to Settings > Tools > AI Assistant > Model Context Protocol (MCP).
- Click Add Server and configure:
- Name:
context-mode - Command:
npx - Args:
-y context-mode
- Name:
- Click OK to save.
Alternatively, you can use a global install (npm install -g context-mode) and set the command to context-mode with no args.
Example MCP config (for reference): configs/jetbrains-copilot/mcp.json
Install hooks using the automated setup command:
npx context-mode@latest setup --adapter jetbrains-copilotThis creates .github/hooks/context-mode.json in your project with the following hook configuration:
{
"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" }
]
}
}Full hook config reference: configs/jetbrains-copilot/hooks.json
Update context-mode to the latest version:
context-mode upgrade
Or from within a Copilot chat session, type ctx upgrade.
Run the diagnostics to verify everything is working:
context-mode doctor
Or from within a Copilot chat session, type ctx doctor.
All checks should show [x]. The doctor validates runtimes, hooks, FTS5, and MCP registration.
You can also verify context savings by typing ctx stats in a Copilot chat session.
MCP server not connecting
- Ensure Node.js 18+ is in your PATH.
- Restart the JetBrains IDE after adding the MCP server.
- Check Settings > Tools > AI Assistant > MCP and confirm "context-mode" shows a green status indicator.
Hooks not firing
- Verify
.github/hooks/context-mode.jsonexists in your project root. - JetBrains Copilot reads hooks from
.github/hooks/— the same location as VS Code Copilot. - Re-run
npx context-mode@latest setup --adapter jetbrains-copilotto regenerate the hook config.
"context-mode: command not found"
- Install globally:
npm install -g context-mode - Verify:
which context-modeshould return a path. - If using
npx, ensure npx is in your IDE's PATH.
Tools appear but routing is not enforced
- Hooks enforce routing programmatically. Without hooks, the model can still use context-mode tools but won't be redirected to prefer them.
- Ensure the hook config file is in
.github/hooks/context-mode.json(not.github/hooks.json).
Session continuity not working
- Verify all four hooks (PreToolUse, PostToolUse, PreCompact, SessionStart) are configured.
- Run
ctx doctorto check hook registration status.