← ClaudeAtlas

code-modelisted

Add a "code mode" tool to an existing MCP server so LLMs can write small processing scripts that run against large API responses in a sandboxed runtime — only the script's compact output enters the LLM context window. Use this skill whenever someone wants to add code mode, context reduction, script execution, sandbox execution, or LLM-generated-code processing to an MCP server. Also trigger when users mention reducing token usage, shrinking API responses, running user-provided code safely, or adding a code execution tool to their MCP server — in any language (TypeScript, Python, Go, Rust, etc.).
chenhunghan/code-mode-skill · ★ 19 · AI & Automation · score 71
Install: claude install-skill chenhunghan/code-mode-skill
# Code Mode for MCP Servers ## 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 the LLM already knows the response schema from training data — it can write the extraction script in one shot without inspecting the data. **Typical results: 65–99% context reduction.** ### Inspiration - [Cloudflare Code Mode](https://blog.cloudflare.com/code-mode-mcp/) - [claude-context-mode](https://github.com/mksglu/claude-context-mode) --- ## How This Skill Works This is an **interactive planning skill**. Work with the user step-by-step: 1. **Understand** their MCP server (language, framework, what tools return large data) 2. **Select** a sandbox that fits their server language and security needs 3. **Plan** the implementation together 4. **Implement** the code mode tool, sandbox executor, and benchmark 5. **Verify** with benchmarks comparing before/after context sizes Do not jump ahead. Confirm each step with the user before proceeding. --- ##