code-mode

Solid

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.).

AI & Automation 19 stars 5 forks Updated 2 months ago MIT

Install

View on GitHub

Quality Score: 76/100

Stars 20%
43
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# 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. --- ## ...

Details

Author
chenhunghan
Repository
chenhunghan/code-mode-skill
Created
2 months ago
Last Updated
2 months ago
Language
N/A
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

smalltalk-mcp

Interact with live Smalltalk images (Squeak, Cuis) via MCP. Evaluate code, browse classes, view method source, define and modify classes and methods, query hierarchies and categories in a running Smalltalk environment.

17 Updated 2 months ago
CorporateSmalltalkConsultingLtd
AI & Automation Solid

collaborating-with-claude-code

Delegate code implementation/review/debugging/alternatives to Claude Code via a JSON bridge script. Multi-turn via SESSION_ID.

37 Updated 3 months ago
ZhenHuangLab
AI & Automation Solid

xcodebuildmcp

Build/test Xcode projects via the XcodeBuildMCP MCP server using a local CLI wrapper for pi (no MCP support). Use when the user mentions Xcode, xcodebuild, iOS builds/tests, or XcodeBuildMCP.

109 Updated 6 days ago
w-winter
AI & Automation Featured

mcp-apps-builder

**MANDATORY for ALL MCP server work** - mcp-use framework best practices and patterns. **READ THIS FIRST** before any MCP server work, including: - Creating new MCP servers - Modifying existing MCP servers (adding/updating tools, resources, prompts, widgets) - Debugging MCP server issues or errors - Reviewing MCP server code for quality, security, or performance - Answering questions about MCP development or mcp-use patterns - Making ANY changes to server.tool(), server.resource(), server.prompt(), or widgets This skill contains critical architecture decisions, security patterns, and common pitfalls. Always consult the relevant reference files BEFORE implementing MCP features.

9,994 Updated today
mcp-use