ctxwise MCP server
2026년 11월 15일 커밋MCP 스키마 트리 쉐이킹, 멀티 에이전트 규칙 동기화, 프롬프트 인젝션 및 비밀 정보 유출 방지를 통해 AI 에이전트 컨텍스트를 최적화합니다.
다른 이름 FramY2/ctxwise
- 스타
- 8
- Tools
- —
- 다운로드, 30일
- —
- 최신 버전
- —
- 마지막 커밋
- 2026년 11월 15일
- 라이선스
- Apache-2.0
ctxwise MCP란?
MCP 스키마 트리 쉐이킹, 멀티 에이전트 규칙 동기화, 프롬프트 인젝션 및 비밀 정보 유출 방지를 통해 AI 에이전트 컨텍스트를 최적화합니다.
프로젝트 README에서 생성된 요약
ctxwise MCP server 정보
CtxWise는 Claude Code, OpenAI Codex, Cursor를 사용하는 개발자가 토큰 낭비를 줄이고 워크스페이스 파일을 보호하여 AI 에이전트 컨텍스트를 최적화할 수 있도록 지원합니다. 이 로컬 우선 도구는 컨텍스트 방화벽 및 토큰 프로파일러 역할을 하며, 사용자가 에이전트 턴 중에 과도한 토큰을 소비하는 무거운 MCP tool 스키마를 감사하고 정리할 수 있게 합니다. API 호출이나 모델 의존성 없이 완전히 로컬에서 작동하므로 에이전트 지침을 빠르고 안전하게 관리할 수 있습니다.
사용자는 CLAUDE.md, AGENTS.md, .cursor/rules와 같은 다양한 에이전트 설정 파일 간의 규칙을 동기화하여 규칙 불일치를 방지할 수 있습니다. 또한 컨텍스트 파일 내에서 유출된 API 키, 프롬프트 인젝션 시도, 숨겨진 유니코드 문자를 감지하는 보안 기능을 제공합니다. 프로파일링을 위한 mcp-xray나 압축을 위한 sync와 같은 명령어를 사용하면 모델에 노출되는 프롬프트 크기를 크게 줄이고 코딩 에이전트를 위한 가볍고 안전한 환경을 유지할 수 있습니다.
활용 사례
- 1MCP 토큰 소비 감소턴당 수천 개의 토큰을 소비하는 비대한 도구 스키마를 식별하고 정리합니다.
- 2멀티 에이전트 규칙 동기화Claude Code, Codex, Cursor용 지침 파일을 일관되게 유지하고 압축합니다.
- 3비밀 정보 및 인젝션 유출 방지컨텍스트 파일 내의 하드코딩된 API 키 또는 악성 프롬프트 인젝션 페이로드를 스캔합니다.
- 4CI에서 컨텍스트 품질 자동화에이전트 컨텍스트에 토큰 낭비나 보안 리스크를 초래하는 풀 리퀘스트를 차단합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능framy2/ctxwise is public and reachablegithub.com/framy2/ctxwise ↗통과
- 패키지가 이 저장소를 소스로 명시검사되지 않음
- 빌드 출처(Sigstore 증명)검사되지 않음
- 오픈 소스 라이선스 (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-11-13github.com/framy2/ctxwise ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음검사되지 않음
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
- 모델에 대한 숨겨진 지침 없음Instruction aimed at the model found in the description or README결함 발견
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기CtxWise
💡 Using Claude Code, OpenAI Codex, or Cursor? Drop a ⭐ Star on GitHub so you can find CtxWise whenever your MCP servers or
CLAUDE.md/AGENTS.mdfiles start bloating your context window!
⚡ 30-Second Quickstart
Zero config, zero API keys, zero model calls. Run directly with npx in any repository:
# 1. Profile MCP servers & find bloated tool schemas silently eating your context window
npx @framy2/ctxwise mcp-xray --probe-stdio
# 2. Audit startup tokens & parity across Claude Code (CLAUDE.md), Codex (AGENTS.md), and Cursor
npx @framy2/ctxwise agents
# 3. Scan context files & skills for leaked API keys, prompt injection, and hidden Trojan Unicode
npx @framy2/ctxwise shield --fail-on-risk
# 4. Sync CLAUDE.md <-> AGENTS.md <-> Cursor rules and apply lossless Token Diet compression
npx @framy2/ctxwise sync --compress --cursor
📊 Before vs. After CtxWise
Modern coding agents (Claude Code, OpenAI Codex CLI, Cursor) load CLAUDE.md, AGENTS.md, .cursor/rules, skill catalogs, and every connected MCP server's JSON schema on every turn:
| Problem Surface | ❌ Without CtxWise | ✅ With CtxWise v1.0 |
|---|---|---|
| Idle MCP Tool Schemas | 4–5 MCP servers silently burn 15,000–35,000 tokens/turn | ctxwise mcp-xray ranks every tool schema & flags [BLOATED] tools |
| Multi-Agent Rule Drift | CLAUDE.md, AGENTS.md, and .cursor/rules diverge fast |
ctxwise sync --compress keeps all 3 synced + strips 25–40% boilerplate |
| Leaked API Keys in Context | sk-ant-*, sk-proj-*, ghp_* inside .mcp.json or skills |
ctxwise shield blocks secrets before they enter git or model prompts |
| Prompt Injection & Trojan Source | Hidden <!-- curl ... --> comments or zero-width Unicode |
ctxwise shield --fail-on-risk fails CI (exit 2) in <20ms |
| Measured Prompt Overhead | Unbounded context growth across PRs | -73.3% model-visible prompt & -29.1% turn tokens (20/20 pass) |
🏗️ How It Works
flowchart LR
subgraph Sources["Active Agent Context Surface"]
C["Claude Code\nCLAUDE.md · .mcp.json · .claude/skills"]
O["OpenAI Codex\nAGENTS.md · config.toml · .codex/skills"]
U["Cursor\n.cursorrules · .cursor/rules/*.mdc"]
end
subgraph Engine["CtxWise Local Engine (0 API Calls · <50ms)"]
A["ctxwise agents & sync\nCross-Agent Parity + Token Diet"]
M["ctxwise mcp-xray\nMCP Tool Schema Tree-Shaker"]
S["ctxwise shield\nSecret & Prompt-Injection Firewall"]
B["ctxwise budget & drift\nDeterministic Lock & CI Gate"]
end
Sources --> Engine
Engine --> Out1["Lean, Synced Context\n(-29% to -73% Token Overhead)"]
Engine --> Out2["GitHub Action CI Gate\nuses: FramY2/ctxwise@v1"]
🔥 Core Features
1. 🌳 MCP Schema Tree-Shaking (mcp-xray)
Discover all MCP servers declared across .mcp.json, ~/.claude.json, and ~/.codex/config.toml. Measure exact token weights per tool schema (from a saved tools/list JSON file or by probing local stdio servers live) and spot [BLOATED] tools (>= 250 tokens or >= 12 input properties):
npx @framy2/ctxwise mcp-xray --probe-stdio
CtxWise mcp-xray · 3 MCP servers declared · 18 tool schemas analyzed · ~6,420 schema tokens (estimated)
Heaviest MCP tool schemas:
- ~890 tokens · github/create_or_update_pull_request (16 params, 3,560 chars) [BLOATED]
- ~640 tokens · postgres/execute_migration_plan (14 params, 2,560 chars) [BLOATED]
Tree-shaking potential: ~1,530 tokens/turn savable by pruning bloated tools.
2. 🔄 Multi-Agent Context Audit & "Token Diet" Sync (agents & sync)
Keep Claude Code (CLAUDE.md, .claude/skills, .claude/commands, .mcp.json), OpenAI Codex (AGENTS.md, .codex/skills), and Cursor (.cursor/rules/*.mdc) 100% aligned while stripping markdown bloat (HTML comments, duplicate bullet rules, blank padding) without touching fenced code blocks:
npx @framy2/ctxwise agents
npx @framy2/ctxwise sync --compress --cursor
3. 🛡️ Context Security Shield (shield)
Protect your repository before an agent reads your workspace or before a PR merges:
- Secret Exposure Detection: Catches hardcoded Anthropic (
sk-ant-...), OpenAI (sk-proj-...), GitHub (ghp_...), AWS (AKIA...), and private key blocks insideCLAUDE.md,AGENTS.md,.mcp.json, and skills. - Prompt Injection & Trojan Unicode Guard: Detects override directives (
ignore all previous instructions), covert HTML comment payloads (<!-- curl ... -->), and hidden bidirectional/zero-width Unicode characters. - Claude Settings Hygiene & SARIF 2.1.0 Output: Flags misplaced
"mcpServers"blocks inside.claude/settings.json(anthropics/claude-code#105885) and emits SARIF 2.1.0 (--sarif ctxwise.sarif) for GitHub Code Scanning.
npx @framy2/ctxwise shield --fail-on-risk --sarif ctxwise.sarif
4. 📦 Curated Stack Presets (preset)
Bootstrap a reviewable token budget (ctxwise.budget.yaml) and lean starter AGENTS.md + CLAUDE.md files tailored to your stack in one command:
npx @framy2/ctxwise preset
npx @framy2/ctxwise preset nextjs-typescript --with-guidance
Built-in presets include:
nextjs-typescript(Next.js + TypeScript + Tailwind)sveltekit/sveltekit-typescript(SvelteKit 2 + Svelte 5 Runes + TypeScript)python-fastapi(Python 3.12 + FastAPI + Pydantic v2)rust-cargo(Rust + Cargo Workspace)go-microservice(Go 1.23+ Service)mcp-server-dev(Model Context Protocol Server)monorepo-turbo(Turborepo / pnpm Monorepo)
🤖 GitHub Action (CI Guard)
Add CtxWise to .github/workflows/ci.yml in 5 lines to automatically block secret leaks, prompt injection, and context token bloat on every Pull Request:
- name: AI Context Firewall & Token Budget Guard
uses: FramY2/ctxwise@v1
with:
max-known-tokens: "4000"
fail-on-secrets: "true"
check-agent-parity: "true"
sarif-file: "ctxwise-shield.sarif"
🧩 Companion Tools / Ecosystem
FramY2/mcp-diet(@framy2/mcp-diet): Zero-dependency stdio MCP proxy & runtime firewall — deterministictools/listtree-shaking (--allow,--deny,--read-only,--max-desc), oversizedtools/callcrash guard (--max-result-kbforanthropics/claude-code#105703), and live credential redaction (--redact-secrets).FramY2/agent-wire-tap(@framy2/agent-wire-tap): Zero-cost local loopback HTTP interceptor & CI contract tester for coding agents (codex,claude) — captures exact outbound wire payloads and verifies system prompt, tool count, and byte budget contracts with $0.00 API cost.- Interactive Context & MCP Token Tax Calculator: 100% client-side web app to measure per-turn MCP schema tax, 50-turn session cost across Claude Opus 4.7 / Sonnet 4.6 / GPT-6.1-Sol / GPT-6-Luna, Codex
32 KiBtruncation status, and leaked secrets. ctxwise-vscode(editors/vscode): Lightweight VS Code & Cursor status-bar extension displaying live workspace token tax, Context Grade (A–F), Codex32 KiBcap percentage, and secret alerts.
🎥 20-Second Live Demo & Benchmarks
The public microbenchmark ran 10 paired tasks across requested GPT-5.6 Luna, Terra, and Sol profiles: 20/20 answers passed the same exact validator. Removing irrelevant discovered context reduced the estimated model-visible prompt by 73.3% and exact aggregate turn tokens by 29.1% (with a second maintainer repeat measuring 28.5% across nine comparable pairs).
Read the method and limitations or inspect the machine-readable summary.
🧰 Full CLI Reference
| Command | What it does | Network / Model Call |
|---|---|---|
ctxwise agents |
Audits startup tokens and parity across Claude Code, OpenAI Codex, and Cursor | None |
ctxwise sync |
Synchronizes AGENTS.md ↔ CLAUDE.md ↔ .cursor/rules with optional --compress Token Diet |
None |
ctxwise codex-doctor |
Audits AGENTS.override.md / AGENTS.md hierarchy against Codex's 32 KiB truncation limit |
None |
ctxwise mcp-xray |
Profiles MCP server tool-schema token weights and flags bloated tools for tree-shaking | None (or local stdio probe) |
ctxwise mcp-prune |
Disables bloated or unused MCP servers in .mcp.json / .codex/config.toml with .bak save |
None (or local stdio probe) |
ctxwise shield |
Scans agent context files & skills for leaked API keys, prompt injection, and hidden Unicode | None |
ctxwise preset |
Lists or applies curated stack budgets and AGENTS.md / CLAUDE.md templates |
None |
ctxwise snapshot |
Ranks known Codex context contributors, coverage gaps, and safe next actions | None |
ctxwise budget |
Checks estimated known context against CLI or YAML limits; exits 2 on violation in CI |
None |
ctxwise audit |
Inventories config plus active root-to-CWD guidance, skills, plugins, agents, and MCPs | None |
ctxwise map |
Renders a bounded Mermaid map of context sources and discovery overhead | None |
ctxwise xray |
Summarizes model-visible prompt JSON without echoing its text | None |
ctxwise profile |
Compiles YAML into native ~/.codex/<name>.config.toml, with dry-run and backups |
None |
ctxwise lock |
Hashes a redacted capability surface (ctxwise.lock.json) for reproducibility |
None |
ctxwise drift |
Compares a capability lock with a file or live setup; can fail CI on drift | None |
ctxwise quota |
Reads the current plan and quota window through local Codex app-server | Codex account read only |
ctxwise receipt |
Calculates an honest receipt from saved codex exec --json usage |
None |
ctxwise run |
Runs Codex and appends exact usage plus an optional pre-turn prompt X-Ray | Requested Codex turn |
🤝 Contribute a Stack Preset in 5 Minutes
Want to make your first open-source contribution to an AI developer tool? Adding a new stack preset in presets/ takes less than 5 minutes (just 1 YAML file, validated automatically by npm test):
- 🟢 Issue #23 — Add
sveltekit-typescriptpreset (SvelteKit 2 + Svelte 5 Runes) - 🟢 Issue #24 — Add
astro-contentpreset (Astro 5 + Content Layer) - 🟢 Issue #25 — Add
django-ninjapreset (Python + Django 5 + Django Ninja) - 🟢 Issue #26 — Add
laravel-inertiapreset (Laravel 11 + Inertia.js + PHP 8.3) - 🟢 Issue #27 — Add
kotlin-spring-bootpreset (Kotlin + Spring Boot 3) - 🟢 Issue #28 — Add
cloudflare-workers-honopreset (Cloudflare Workers + Hono)
See CONTRIBUTING.md for the 3-step guide!
Cost Honesty by Design
| Authentication | Default display | Dollar meaning |
|---|---|---|
| OpenAI API key | Exact runtime tokens + dated API estimate | Estimated billable API charge |
| ChatGPT Plus/Pro/Business | Tokens + credit equivalent + quota snapshot | No dollar amount |
Subscription with --api-equivalent |
Same data + API comparison | Comparison only; not charged |
See Architecture, Cost semantics, and Privacy and security.
License
Apache-2.0. See LICENSE and NOTICE.
ctxwise MCP 질문
CtxWise가 MCP server 토큰 사용량을 어떻게 관리하나요?
mcp-xray 명령어를 사용하여 도구 스키마의 토큰 가중치를 프로파일링하고, 과도한 컨텍스트를 소비하는 비대한 도구를 식별합니다.
CtxWise가 API 키가 AI 모델로 전송되는 것을 방지할 수 있나요?
네, shield 명령어를 통해 컨텍스트 파일과 SKILL.md 내에 하드코딩된 Anthropic, OpenAI, GitHub 키와 같은 비밀 정보를 감지합니다.
CtxWise를 사용하려면 인터넷 연결이나 API 호출이 필요한가요?
아니요, API 호출이나 모델 호출 없이 작동하는 로컬 우선 엔진입니다.
