parecode
Parecode is a context-window-aware code search and editing MCP server that reduces token usage on large codebases while maintaining correctness. All processing is local with no network calls.
ParecodeSearch — Ripgrep-backed regex searches returning matches with surrounding context in a single call:
Pass an array of patterns for parallel searches (e.g., tracing event flows like
['HandleX', 'OnX', 'XClosed'])Automatically merges overlapping/adjacent match windows within the same file
Returns
estimatedTokensat match and response level for agent self-budgetingOptionally surfaces related symbols via
relatedSymbols: trueReports omitted line ranges when per-file content exceeds the byte cap
Deduplicates repeated windows across calls using lightweight
kind: 'reference'placeholders
ParecodeExpand — Read a specific line range without loading the whole file:
Natural follow-up to a
ParecodeSearchmatch oromittedLineRangesentrySupports optional
contextBefore/contextAfterpaddingReturns
estimatedTokensconsistent withParecodeSearch
ParecodeEdit — Batch atomic edits across multiple files in a single call:
Cross-file operations run in parallel
Supports line-range operations (
replaceLines,insertAfter) anchored by anexpectguard to detect driftSupports string-patch operations (
oldString/newString) with optional fuzzy matchingFuzzy modes: whitespace-tolerant (
fuzzy: true) or Unicode normalization (fuzzy: 'aggressive'); matches below 0.85 confidence are rejectedAtomic writes per file (temp + rename) with mtime-based conflict detection
Claude Code Integration — Registers a SessionStart hook to prefer Parecode tools over native ones, plus a parecode-explore plugin for cost-effective exploration via a dedicated read-only subagent.
Usage Statistics (parecode stats) — Local JSONL session log estimating tokens saved, with retroactive scanning of past Claude Code sessions (e.g., parecode stats --retroactive --since 30d). Zero network calls, zero telemetry.
parecode
An MCP server that gives coding agents context-window-aware search and safe, atomic multi-file edits — built to cut token usage on large codebases without giving up correctness.
Requirements
Node.js 20 or newer (ESM, native test runner, stable
fetch-free runtime).ripgrep on
PATH(rgon Linux/macOS,rg.exeon Windows). Install via your package manager:macOS:
brew install ripgrepDebian/Ubuntu:
apt install ripgrepWindows:
winget install BurntSushi.ripgrep.MSVCorchoco install ripgrep
A supported MCP client (Claude Code is the reference target).
Parecode does not bundle ripgrep — it shells out to the system binary so you stay on a single, audited version.
Related MCP server: LocalNest MCP
Install
npm install -g parecodePure JavaScript — no native dependencies, no C/C++ toolchain required.
Quick start
Register the server with Claude Code:
parecode init # user scope; installs MCP + SessionStart hook + parecode-explore plugin (defaults)
parecode init --scope project # commit MCP config + hook to the repo
parecode init --no-hook # register MCP only; skip the SessionStart hook
parecode init --no-plugin # skip the parecode-explore Claude Code plugin
parecode init --print # print the equivalent command without running it
parecode init --remove-hook # remove the SessionStart hook (MCP stays registered)
parecode init --remove-plugin # uninstall the parecode-explore Claude Code pluginThe SessionStart hook injects a short directive at the start of each session telling Claude to prefer ParecodeSearch / ParecodeEdit over the equivalent native tools. Without it, Claude's first-party Grep / Read / Edit tools typically win by default and Parecode's token savings never land. The hook payload is a static string; parecode hook session-start prints it. Pass --no-hook if you would rather opt in explicitly per session via your own tooling.
The bundled parecode-explore Claude Code plugin adds a read-only subagent (pinned to Haiku, given only ParecodeSearch) and a matching skill, so exploration-style questions ("where is X?", "how does Y work?", "find all usages of Z") get answered in a cheap, isolated context window instead of burning tokens in your main session. init registers a local marketplace pointing at the npm-installed copy and runs claude plugin install parecode-explore@parecode. If your Claude Code build doesn't support the plugin subcommand the step soft-fails with a warning and the rest of init still succeeds; pass --no-plugin to skip it entirely, or --with-plugin to make any plugin-step failure hard-fail.
Then in any session, the ParecodeSearch, ParecodeExpand, and ParecodeEdit tools become available. Run parecode doctor to confirm registration, hook status, and .codegraph/ pairing if present.
What it does
ParecodeSearch— ripgrep-backed search that returns matches with surrounding context windows in a single call, with per-file byte chunking so large result sets do not blow up your context.patternaccepts a single string or an array of strings; arrays dispatch parallel ripgrep runs sharing the samepaths/contextLines, and each match carries apatterns: string[]field listing which input patterns contributed. One call replaces N back-to-back greps for related-keyword flow tracing.Overlapping or adjacent windows within the same file are merged automatically (gap ≤
contextLines), with bridging lines loaded from disk.Per-match and response-level
estimatedTokensare returned so the agent can self-budget before consuming results.Opt-in
relatedSymbols: truesurfaces likely event-flow neighbours (Handle<X>,On<X>,<X>Handler/Listener/Closed/Completed/Started) discovered in each match, capped at 10.Omitted line ranges are reported so the agent can widen with
ParecodeExpandwithout re-reading the whole file.
ParecodeExpand— widen a known(file, startLine, endLine)range with optionalcontextBefore/contextAfterpadding. Designed as the natural follow-up to aParecodeSearchmatch. Returns the sameestimatedTokensshape so the same self-budgeting heuristic applies. Prefer this over a full-fileReadafter locating a line.ParecodeEdit— batched multi-file edits with whitespace-tolerant fuzzy matching (and an opt-in Unicode-lookalike mode), pre/poststatconflict detection, and atomic same-directory rename writes. Cross-file edits run in parallel.parecode stats— local JSONL session log with token-saved estimates. Zero network. Zero telemetry.
Measured savings
On search-and-edit tasks — finding call sites, multi-file refactors, "do X to every Y" — Parecode cut cost ~40% and assistant turns ~75–83% in matched A/B tests:
repo | task | cost | turns |
TypeScript | find every call site of a symbol, edit each (17 sites, 8 files) | −43% | −83% |
Unity / C# | find every call site of a symbol, edit each (11 sites, 5 files) | −41% | −76% |
Method: the identical task run with Parecode on vs off, a fresh session per run, n=3 per arm with alternated order, Sonnet 4.6. Savings come from collapsing many Grep / Read / Edit round-trips into single ParecodeSearch / ParecodeEdit calls — so the win scales with how much searching and multi-file fan-out a task involves, and shrinks toward zero on single-file or reasoning-heavy tasks. These are measured per-session token and cost numbers, not the estimates in the scan below.
Retroactive Savings Scan
Curious how much Parecode would have saved you if you had installed it earlier? You can scan your past Claude Code sessions:
parecode stats --retroactive --since 30dSample output:
Parecode — last 30d (retroactive scan)
─────────────────────
Sessions: 42
Tool calls: 156
Calls batched (est): 89
Tokens saved (est): 1,200,000
* Note: Retroactive savings are estimated, not measured.Privacy disclaimer: This scan runs entirely locally against Claude Code's session transcripts (~/.claude/projects/**). By default, it parses only structured fields (tool names, paths, patterns, and token counts). It does not send any data over the network. The --include-content flag (which allows reading tool input/output) is strictly opt-in and loudly flagged if used.
Privacy
Parecode performs no network calls at runtime. Session logs are written to your OS data directory (resolved via env-paths) with 0600 permissions on Unix. Logs are self-maintaining: each server start prunes session data older than 30 days and caps the envelope log at 5 MB. Prune earlier with parecode prune <days> or wipe the data dir. Update to the latest release (and refresh hooks/plugin) with parecode update.
License
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BasilSkyWalk/parecode'
If you have feedback or need assistance with the MCP directory API, please join our Discord server