ContextPack MCP server
2026년 11월 7일 커밋Converts codebases, directories, and Git diffs into token-budgeted, LLM-ready context in XML, Markdown, or llms.txt formats.
다른 이름 fastpresspages/contextpack
- 스타
- 0
- Tools
- —
- 다운로드, 30일
- —
- 최신 버전
- —
- 마지막 커밋
- 2026년 11월 7일
- 라이선스
- Apache-2.0
ContextPack MCP란?
Converts codebases, directories, and Git diffs into token-budgeted, LLM-ready context in XML, Markdown, or llms.txt formats.
프로젝트 README에서 생성된 요약
ContextPack MCP server 정보
Preparing codebases and Git diffs for large language models is what ContextPack enables for developers using Claude, GPT, or DeepSeek. This tool converts directories and file changes into structured context using XML, Markdown, or llms.txt formats. It functions as a local CLI, a Node.js library, or a stdio-ready MCP server that integrates with environments like Claude Desktop, Cursor, and Zed.
Users can manage prompt size by setting specific token budgets, such as 32k or 128k, ensuring that the most important files are prioritized without overflowing the model. The server includes specialized tools like pack_codebase for directory packing, get_tree for visual directory structures, pack_diff for Git changes, and estimate_tokens for calculating text length. It automatically respects .gitignore files and skips binary data or build artifacts like node_modules to keep the context clean and relevant.
활용 사례
- 1Manage token limits for promptsA developer can specify a maximum token ceiling to ensure their codebase context fits within the model's window.
- 2Provide Git diffs to AI agentsYou can send only the staged or unstaged changes from a Git repository to an AI to explain recent code modifications.
- 3Visualize project structureGenerate an ASCII or Unicode directory tree to give an AI a high-level overview of the file system.
- 4Automate context creation in CI/CDIntegrate context packing into GitHub Workflows to prepare data for automated pull request reviews.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
자동 검사
2026년 11월 15일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능fastpresspages/contextpack is public and reachablegithub.com/fastpresspages/contextpack ↗통과
- 패키지가 이 저장소를 소스로 명시검사되지 않음
- 빌드 출처(Sigstore 증명)검사되지 않음
- 오픈 소스 라이선스 (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-11-07github.com/fastpresspages/contextpack ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음검사되지 않음
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기ContextPack 📦
Pack codebases, directories, and Git diffs into token-budgeted, LLM-ready context.
Website · MCP Spec · GitHub Action · FastPress Labs
ContextPack is a 100% free, zero-runtime-dependency CLI, Node.js library, and Model Context Protocol (MCP) server that turns any codebase, subdirectory, or Git diff into clean, token-budgeted context for Claude, GPT, DeepSeek, and coding agents.
It formats context in Anthropic-standard XML (<documents><document>), Markdown, or llms-full.txt, includes an ASCII/Unicode directory tree, integrates staged/unstaged Git diffs, and respects token budgets so your prompts never overflow.
Why ContextPack?
- ⚡ Zero runtime dependencies: Pure Node.js standard library (
node:fs,node:path,node:child_process,node:crypto). Fast startup, zero supply-chain risk. - 🎯 Token-Budget Aware: Specify
--max-tokens 32k(or64k,128k). ContextPack prioritizes key files and warns if files had to be omitted. - 🤖 First-Class MCP Server: Native stdio MCP server (
contextpack-mcp) ready for Claude Code, OpenCode, Cursor, and Zed with tools forpack_codebase,get_tree,pack_diff, andestimate_tokens. - 📁 Smart Filtering: Automatically respects
.gitignore, skips binary files, and ignores build artifacts (node_modules,dist, lockfiles). - 🔄 Git Diff Integration: Pack only changed files, staged files, or append full git diffs with line-level context.
- 🛠️ Composite GitHub Action: Pack repos in CI/CD pipelines and export token counts and packed artifacts for LLM review steps.
Quick Start
1. Run via npx (no install required)
# Pack current directory into Anthropic XML format
npx -p github:fastpresspages/contextpack contextpack .
# Pack into Markdown with a 32,000 token budget
npx -p github:fastpresspages/contextpack contextpack src/ -f markdown -t 32k -o context.md
# Pack only Git diff & modified files against main
npx -p github:fastpresspages/contextpack contextpack . --git-diff --diff-target main -o diff-context.xml
# Just generate an ASCII directory tree with file sizes
npx -p github:fastpresspages/contextpack contextpack . --tree-only
# Generate an llms-full.txt file for your documentation site
npx -p github:fastpresspages/contextpack contextpack . --llms-txt -o site/llms-full.txt
2. Connect to AI Agents via MCP
Add ContextPack to your Claude Desktop, OpenCode, or Cursor MCP configuration:
{
"mcpServers": {
"contextpack": {
"command": "npx",
"args": ["-y", "-p", "github:fastpresspages/contextpack", "contextpack-mcp"]
}
}
}
Available MCP tools:
pack_codebase: Pack directory or files into token-capped XML, Markdown, or llms.txt.get_tree: Return visual directory structure with token estimates and file counts.pack_diff: Pack staged or unstaged Git diffs with changed file contents.estimate_tokens: Fast token count approximation for any text or local file.
Output Formats
1. XML (--format xml / default)
Strict prompt structure modeled on Anthropic best practices:
<documents>
<directory_tree>
├── src/
│ ├── index.js (1.2 KB)
│ └── pack.js (8.4 KB)
└── package.json (820 B)
</directory_tree>
<document index="1">
<source>src/index.js</source>
<document_content>
1: export * from './pack.js';
...
</document_content>
</document>
</documents>
2. Markdown (--format markdown)
Clean, human-readable markdown with language code blocks:
# Codebase Context
## Directory Tree
\`\`\`
...
\`\`\`
## Codebase Contents
### `src/index.js`
\`\`\`javascript
1: export * from './pack.js';
...
\`\`\`
3. LLMS Full Text (--format llms / --llms-txt)
Structured context designed for /llms-full.txt endpoints following the llms.txt convention.
CLI Options
Usage: contextpack [target_dir_or_file] [options]
Options:
-o, --out <path> Write output to file instead of stdout
-f, --format <format> Output format: xml, markdown, llms, json (default: xml)
-t, --max-tokens <tokens> Token budget ceiling (e.g. 16k, 32k, 128k, 200000)
-g, --git-diff Include Git diff in output
--staged Include only staged changes in Git diff
--diff-target <ref> Git ref to diff against (e.g. main, HEAD~1)
--tree-only Output only the visual directory tree
--tokens-only Calculate and print token estimation only
--llms-txt Shortcut for --format llms
--include <pattern> Comma-separated glob-style patterns to include
--exclude <pattern> Comma-separated glob-style patterns to exclude
--max-depth <n> Maximum directory traversal depth (default: 8)
--max-file-size <kb> Max file size in KB to include (default: 500)
--no-tree Omit the directory tree from context
--no-line-numbers Omit 1-based line numbers in file content
--summary Print packing summary to stderr
-v, --version Show ContextPack version
-h, --help Show help information
GitHub Action
Use fastpresspages/contextpack in your GitHub Workflows to prepare context for automated AI PR reviews, changelog generation, or docs updates:
- name: Pack Repository Context
uses: fastpresspages/contextpack@main
id: pack
with:
path: '.'
format: 'xml'
max-tokens: '64k'
with-tree: 'true'
git-diff: 'true'
out: 'context.xml'
- name: Inspect Packing Stats
run: |
echo "Packed ${{ steps.pack.outputs.files }} files"
echo "Total tokens: ${{ steps.pack.outputs.tokens }}"
echo "Omitted files: ${{ steps.pack.outputs.omitted }}"
Node.js Programmatic API
ContextPack can be imported directly in ESM or Node 18+:
import { pack, countTokens, buildTree } from 'contextpack';
const result = await pack({
path: './src',
format: 'xml',
maxTokens: 32000,
includeTree: true,
includeGitDiff: false
});
console.log(`Packed ${result.totalFiles} files (${result.tokens} tokens)`);
console.log(result.output);
Verification & Testing
ContextPack includes a comprehensive native test suite using node:test:
# Run unit & integration tests
node --test test/*.test.js
# Test CLI directly
node bin/contextpack.js . --tokens-only
License
Apache-2.0. Maintained by FastPress Labs. Free forever, no telemetry, no paid APIs.
ContextPack MCP 질문
What formats does ContextPack support?
It supports Anthropic-standard XML, Markdown, and the llms.txt convention.