CC

chenhunghan/code-mode-skill

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

21 stars 품질 55 트렌드 10MIT

Claude Code skill: add code mode to any MCP server for 65-99% context reduction

개요

An agent skill that helps you add to any MCP server — so LLMs can write small processing scripts that run against large API responses in a sandboxed runtime, and only the script's compact output enters the context window. Works with any AI agent that supports agent skills. When an MCP tool returns a large API response (e.g. listing 500 Kubernetes pods, 200 SCIM users, or thousands of GitHub issues), that entire payload enters the LLM's context window — consuming tokens and degrading performance. Code mode flips the approach: instead of dumping raw data into context, the LLM writes a small processing script. The MCP server runs the script in a against the raw data, and only the script's stdout enters context. This works especially well with well-known APIs (SCIM, Kubernetes, GitHub, Stripe, Slack, AWS, etc.) because LLMs already know the response schemas from training data. Inspired by Cloudflare Code Mode and claude-context-mode. This is an .

README

Code Mode Skill

An agent skill that helps you add code mode to any MCP server — so LLMs can write small processing scripts that run against large API responses in a sandboxed runtime, and only the script’s compact output enters the context window. Works with any AI agent that supports agent skills.

Typical result: 65–99% context reduction.

What is Code Mode?

When an MCP tool returns a large API response (e.g. listing 500 Kubernetes pods, 200 SCIM users, or thousands of GitHub issues), that entire payload enters the LLM’s context window — consuming tokens and degrading performance.

Code mode flips the approach: instead of dumping raw data into context, the LLM writes a small processing script. The MCP server runs the script in a sandboxed runtime against the raw data, and only the script’s stdout enters context.

This works especially well with well-known APIs (SCIM, Kubernetes, GitHub, Stripe, Slack, AWS, etc.) because LLMs already know the response schemas from training data.

Inspired by Cloudflare Code Mode and claude-context-mode.

What This Skill Does

This is an interactive planning skill. It works with you step-by-step to:

  1. Understand your MCP server (language, framework, which tools return large data)
  2. Select a sandbox that fits your server language and security requirements
  3. Plan the implementation together
  4. Implement the code mode tool, sandbox executor, and wiring
  5. Benchmark before/after context sizes to verify the reduction

Supported Server Languages

Server Language Sandbox Options
TypeScript/JavaScript quickjs-emscripten (WASM), pyodide (WASM), isolated-vm (V8)
Python RestrictedPython, pyodide (WASM), quickjs bindings
Go goja, Wazero (WASM), starlark-go
Rust boa_engine, wasmtime/wasmer (WASM), deno_core

All sandbox options are isolated from the host filesystem and network by default.

Install

npx skills add chenhunghan/code-mode-skill

Or manually copy the SKILL.md and references/ directory into your agent’s skills directory.

Usage

Just ask your agent to add code mode to your MCP server:

  • “I want to add code mode to my MCP server to reduce token usage”
  • “Add a sandboxed code execution tool to my TypeScript MCP server”
  • “My get-users tool returns 50KB+ responses, help me reduce context size”

The skill will guide you through the process interactively.

License

MIT

GitHub에서 전체 README 보기

추천 도구

다른 키워드를 입력하거나 필터를 제거해 보세요.

설치

npx skillfish add chenhunghan/code-mode-skill
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →