JetBrains MCP Server: Fix Context Limits in IntelliJ
JetBrains IDEs — IntelliJ IDEA, PyCharm, GoLand, WebStorm — support MCP servers through Junie and the AI Assistant plugin. Token Limits installs as an MCP server and compresses every file read, search, and code analysis tool call before it reaches the model. One command sets up Junie automatically, AI Assistant needs a one-time manual config.
JetBrains added MCP server support to Junie (their AI coding agent) and the AI Assistant plugin. When Token Limits is registered as an MCP server, it intercepts tool calls from both, compressing outputs by 60-80% before they are included in the model's context. This means longer sessions, fewer interruptions, and significantly lower API usage for teams on metered billing.
Which JetBrains tools support MCP?
| JetBrains tool | MCP support | Config method |
|---|---|---|
| Junie (AI agent) | Yes | Auto via token-limits setup-jetbrains |
| AI Assistant plugin | Yes (manual) | Settings > Tools > AI Assistant > MCP |
| IntelliJ IDEA | Via Junie / AI Assistant | See above |
| PyCharm | Via Junie / AI Assistant | See above |
| GoLand / WebStorm | Via Junie / AI Assistant | See above |
How to install Token Limits MCP for JetBrains
- Install: curl -fsSL https://tokenlimits.app/api/install | bash
- Run setup: token-limits setup-jetbrains
- Enter your license key when prompted (free trial: 50 requests)
- For Junie: setup is automatic — the config is written to ~/.junie/mcp/mcp.json
- For AI Assistant: open Settings > Tools > AI Assistant > MCP Servers, add the server details shown by the setup command
- Restart your JetBrains IDE. Tool calls are now compressed automatically.
Why JetBrains sessions hit token limits
JetBrains IDEs are deeply integrated with large codebases. When Junie or AI Assistant reads files, searches across a project, or inspects build output, the raw results include verbose paths, line numbers, IDE-specific metadata, and duplicate structural information. A single project-wide search can return tens of thousands of tokens before the model has read a single meaningful result.
- ✓Project-wide search results: 20-50k tokens raw, 4-10k after compression
- ✓Build output (Gradle, Maven, sbt): 15-30k tokens raw, 2-5k after compression
- ✓File reads across multiple modules: accumulates fast across long sessions
- ✓Diff views and change lists: repeated path headers compound quickly
Token Limits MCP tools available in JetBrains
Token Limits registers 8 compressed tools: local_read, local_expand, local_search, local_ls, local_exec, local_json, local_diff, and local_map. These replace the standard file and search operations with compression-aware equivalents. Junie and AI Assistant will use these tools automatically when Token Limits is registered as an MCP server.
Compress JetBrains AI tool calls by 60-80%
Token Limits MCP works with Junie and AI Assistant in all JetBrains IDEs. Free trial, no credit card. Setup in under 3 minutes.
FAQ
Does Token Limits work with Junie?
Yes. Junie supports MCP servers and Token Limits auto-configures for Junie by writing to ~/.junie/mcp/mcp.json. Run token-limits setup-jetbrains and restart your IDE.
Does Token Limits work with JetBrains AI Assistant?
Yes, but AI Assistant requires manual config. After running token-limits setup-jetbrains, go to Settings > Tools > AI Assistant > MCP Servers and add the server connection details.
Which JetBrains IDEs are supported?
All JetBrains IDEs that support Junie or the AI Assistant plugin: IntelliJ IDEA, PyCharm, GoLand, WebStorm, Rider, CLion, DataGrip, and others. The MCP configuration is IDE-agnostic.
Does Token Limits require a JetBrains plugin?
No. Token Limits is an MCP server that runs as a separate process. It does not require installing a JetBrains plugin. Junie and AI Assistant connect to it over the standard MCP protocol.
What version of JetBrains tools supports MCP?
Junie MCP support was added in 2025. AI Assistant MCP support requires a recent version of the AI Assistant plugin. Update both Junie and the AI Assistant plugin to the latest version if MCP server configuration is not visible.