MCP Code Execution
Cut agent token consumption by calling MCP servers through generated code instead of direct tool invocations: present tools as typed wrapper files on a filesystem, discover them progressively, and keep intermediate data in the execution environment (Anthropic measured 150,000 → 2,000 tokens, a 98.7% saving). Trigger when an agent connects to many MCP servers/tools, when tool definitions eat a large share of the context window before work starts, when workflows pipe large intermediate results (transcripts, spreadsheets) between tools, or when sensitive data should not enter model context.
Install
npx skills add Archive228/lab-skills --skill mcp-code-executiongit clone --depth 1 https://github.com/Archive228/lab-skills.git /tmp/lab-skills
mkdir -p ~/.claude/skills
cp -r /tmp/lab-skills/skills/mcp-code-execution ~/.claude/skills/mcp-code-executionPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# MCP via Code Execution — Cut Agent Token Consumption This skill gives you an operating procedure for replacing direct MCP tool invocations with agent-generated code that calls MCP servers as code APIs. Direct tool calling has two token sinks: every tool definition is loaded into context up front, and every intermediate result flows through the model. Presenting MCP tools as files on a filesystem and writing code against them fixes both. On Anthropic's reference workflow (Google Drive → Salesforce), this cut token usage from 150,000 to 2,000 tokens — a 98.7% saving. ## When to use Switch to code execution with MCP when any of these hold: - The agent has access to many tools — developers routinely wire agents into dozens of MCP servers exposing hundreds or thousands of tools. At that scale, definitions alone can consume hundreds of thousands of tokens before the agent reads the request. - A workflow chains tools so one tool's output becomes another's input. With direct calls the full payload flows through the model twice (e.g., a 2-hour sales-meeting transcript ≈ an extra 50,000 tokens just to copy it from `gdrive.getDocument` into `salesforce.updateRecord`). - Tool results are large and mostly irrelevant (10,000-row spreadsheets, long channel histories) and you only need a filtered slice. - The workflow needs loops, conditionals, retries, or polling — chaining individual tool calls for these burns tokens and adds latency per round trip.
Details
- Skill name
mcp-code-execution- Repository
- Archive228/lab-skills
- Path
skills/mcp-code-execution/SKILL.md- License
- MIT
- Repo updated
- 12 August 2026
FAQ
What does the MCP Code Execution skill do?
Cut agent token consumption by calling MCP servers through generated code instead of direct tool invocations: present tools as typed wrapper files on a filesystem, discover them progressively, and keep intermediate data in the execution environment (Anthropic measured 150,000 → 2,000 tokens, a 98.7% saving). Trigger when an agent connects to many MCP servers/tools, when tool definitions eat a large share of the context window before work starts, when workflows pipe large intermediate results (transcripts, spreadsheets) between tools, or when sensitive data should not enter model context.
How do I install the MCP Code Execution skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add Archive228/lab-skills --skill mcp-code-execution. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is MCP Code Execution popular?
It lives in Archive228/lab-skills, which has 10 GitHub stars and 2 forks.
Related skills
Agent Design Fundamentals
10Archive228/lab-skills
Decision rules for whether to build an LLM agent and how to architect it, distilled from OpenAI's "A Practical Guide to Building Agents": build/no-build criteria, model selection, tool design, single-agent vs multi-agent orchestration (manager pattern vs decentralized handoffs), layered guardrails, and human-in-the-loop triggers. Use when designing, reviewing, or refactoring an agent system — before choosing an architecture, adding more agents, defining tools, or shipping an agent to production without guardrails.
Agent Evals
10Archive228/lab-skills
Build and maintain evaluation suites for AI agents: bootstrap 20-50 tasks from real failures, pick code-based vs model-based vs human graders by agent architecture (coding, conversational, research, computer-use), write unambiguous tasks with reference solutions, and keep suites alive via ownership and transcript reading. Use when creating evals from zero, adding graders or eval cases, debugging suspicious eval scores, or deciding pass@k vs pass^k metrics for an agent product.
Agent Failure Preflight
10Archive228/lab-skills
Pre-deployment failure-mode gate for agentic AI systems, distilled from Microsoft AI Red Team's Taxonomy of Failure Modes in Agentic AI Systems v2.0 (grounded in 12 months of red-team engagements). Run it before shipping or materially changing an agent — adding tools/MCP servers/plugins, enabling persistent memory, adding sub-agents or orchestration, enabling computer use, or expanding permissions — to verify concrete controls against memory poisoning, HitL bypass, goal hijacking, supply-chain compromise, session context contamination, capability disclosure, and multi-agent cascade failures.
Minimal Patch with Subagents
9kargnas/skills
Minimal patching workflow that debates fix options across parallel independent subagents and applies the smallest safe diff. Use only when you want risk-free code, and to code real minimal that only needs to fix the issue.
MCP 2026 Migration
10Archive228/lab-skills
Migrate MCP servers, gateways, and clients to the 2026-07-28 specification: stateless request-response core (no initialize handshake, no Mcp-Session-Id, version/capabilities in _meta), required Mcp-Method/Mcp-Name headers, Multi Round-Trip Requests replacing server-initiated elicitation/sampling/roots, cacheable list results (ttlMs/cacheScope), CIMD auth over deprecated DCR, the extensions framework (Tasks, Apps, Skills over MCP), and the 12-month deprecation offramp for Roots/Sampling/Logging and HTTP+SSE. Trigger when upgrading any MCP implementation from protocol 2025-11-25 or earlier, writ
Minimax H3 Prompt
5kuronzzhan-droid/minimax-h3-prompt-skill
按 MiniMax-H3 的两种有效格式撰写视频生成提示词(时间轴风格 / 官方结构化风格),覆盖 T2VA 文生视频、I2VA·FL2VA·L2VA 首尾帧、full-reference 参考生视频 R2V。只要用户想用本地 ComfyUI 的 H3 出视频、要求写或改 H3 提示词、提到 MiniMax H3 / ref2va / fl2va、给参考图或音色让角色说话唱歌、或抱怨 H3 出片"角色不像/台词乱语/声音不对/动作没跟上节拍",都应使用本技能——它带官方规范原文、两种风格的实战范例和本机显存实测约束。
Browse the most popular Claude skills, all ai, llms & agents skills, or write your own with the skills generator.