Content
# chop
`chop` is the AI Context Packer: one command turns a codebase into a single,
structured context block for Claude, GPT, Cursor, Windsurf, and other coding
agents.
```sh
chop src/
chop . --format gpt --tokenizer gpt
chop . --include '**/*.rs' --exclude 'tests/**' --copy
chop . --stats-only
chop . --focus 'authentication login bug' --max-tokens 60000
```
It follows `.gitignore`, skips version-control directories, dependencies, build
output, binary files, and files larger than 2 MiB. Claude-compatible XML is
the default; GPT Markdown and plain text are built in.
## Safe by default
`chop` is designed so agents can call it on an unfamiliar repository root:
- Output is capped at 100,000 tokens by default.
- Source and project configuration are prioritized under the budget.
- `--focus` boosts files related to a task, feature, or symbol.
- Generated files, caches, logs, archives, minified assets, and build output are
discarded.
- `.env`, credentials, private keys, signing stores, and similar files are
protected.
- Repository-local AI instructions are excluded to reduce prompt-injection risk.
- Every response reports available, selected, omitted, generated, and sensitive
file counts.
- `--stats-only` lists only the 100 largest eligible files.
Change the budget with `--max-tokens`. A value of `0` disables the CLI limit and
should only be used deliberately. Sensitive files require the explicit
`--allow-sensitive` option.
Repository agent instructions require `--allow-agent-config`.
## Install
No Rust or Cargo installation is required.
macOS and Linux:
```sh
curl --proto '=https' --tlsv1.2 -LsSf \
https://raw.githubusercontent.com/Prayag887/chop-mcp/main/install.sh | sh
```
Windows PowerShell:
```powershell
irm https://raw.githubusercontent.com/Prayag887/chop-mcp/main/install.ps1 | iex
```
The installers detect the operating system and CPU, download the appropriate
release, verify its SHA-256 checksum, and install it in a user-owned directory.
They do not install or invoke Cargo. Set `CHOP_INSTALL_DIR` to choose another
location or `CHOP_VERSION` to install a specific release.
### Manual installation
Download the archive for your platform from
[GitHub Releases](https://github.com/Prayag887/chop-mcp/releases):
| Platform | Architecture | Release target |
| --- | --- | --- |
| Linux | x86-64 | `x86_64-unknown-linux-musl` |
| Linux | ARM64 | `aarch64-unknown-linux-musl` |
| macOS | Intel | `x86_64-apple-darwin` |
| macOS | Apple silicon | `aarch64-apple-darwin` |
| Windows | x86-64 | `x86_64-pc-windows-msvc` |
| Windows | ARM64 | `aarch64-pc-windows-msvc` |
Extract the archive, then place `chop` (`chop.exe` on Windows) somewhere on
your `PATH`. Linux builds use musl and do not require a particular system libc.
Developers who already have Rust can instead build from source:
```sh
cargo install --git https://github.com/Prayag887/chop-mcp
```
Release binaries are self-contained and need no language runtime. The code is
portable across macOS, Linux, and Windows.
## Claude Code MCP
After installing the binary, register it as a user-level stdio MCP server:
```sh
claude mcp add --scope user chop -- chop mcp
```
Verify the connection:
```sh
claude mcp list
```
To share the MCP configuration with everyone working on a repository, run this
from that repository instead:
```sh
claude mcp add --scope project chop -- chop mcp
git add .mcp.json
git commit -m "Configure chop MCP server"
```
Claude Code will ask users to approve project-scoped MCP servers. Once enabled,
ask Claude:
```text
Use pack_context on the current project with focus "architecture and module
boundaries" and max_tokens 60000, then explain its architecture.
```
If `chop` is not on `PATH`, replace the second `chop` in the registration
command with the absolute path to the executable.
## Claude Desktop
Claude Desktop supports local binary MCP servers. Add the following server to
its MCP configuration, using an absolute executable path:
```json
{
"mcpServers": {
"chop": {
"command": "/absolute/path/to/chop",
"args": ["mcp"]
}
}
}
```
Restart Claude Desktop after saving the configuration.
## Other MCP clients
Start the stdio server:
```sh
chop mcp
```
Example client configuration:
```json
{
"mcpServers": {
"chop": {
"command": "chop",
"args": ["mcp"]
}
}
}
```
The server exposes:
```text
pack_context(
path,
format?,
tokenizer?,
include?,
exclude?,
stats_only?,
max_tokens?,
focus?,
allow_sensitive?,
allow_agent_config?
)
```
`format` accepts `claude`, `gpt`, or `plain`.
MCP calls default to a 100,000-token ceiling and enforce a 200,000-token maximum.
Agents should provide a concise `focus` describing the current task for the best
selection.
## Project detection
Detection includes Rust, Go, Python, Django, Node.js, TypeScript, Next.js,
Angular, Svelte, Kotlin, Kotlin Multiplatform, Compose Multiplatform, Flutter,
Dart, Swift, Java, .NET, PHP, and Ruby projects. Packing itself is
language-independent and works with any UTF-8 text source files.
## Token counting
GPT counts use the real `o200k_base` tokenizer embedded in the binary. Anthropic
does not publish an offline Claude tokenizer, so Claude counts are clearly
reported as a conservative local estimate. Exact Claude counts require
Anthropic's network API and credentials, which would conflict with `chop`'s
offline, zero-runtime-dependency design.
## Build
```sh
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
cargo build --release
```
Every version tag builds and publishes checksummed binaries for Linux, macOS,
and Windows on both x86-64 and ARM64. The release workflow can also be run
manually; manual runs retain the binaries as workflow artifacts without creating
a GitHub Release.