mcp-code-executionlisted
Install: claude install-skill laurigates/claude-plugins
# MCP Code Execution Pattern
Expert knowledge for designing agent systems that generate and execute code to interact with MCP servers, instead of calling tools directly.
For the typed-wrapper code, the six key-pattern examples, and the project
scaffolding steps, see [REFERENCE.md](REFERENCE.md).
## When to Use This Skill
| Use code execution when... | Use direct tool calls / `mcp-management` when... |
|----------------------------|--------------------------------------------------|
| Designing agents that fan out across 10+ MCP servers or 50+ tools | Installing or configuring one or two servers in `.mcp.json` |
| Intermediate results are large (>10K tokens) and would blow context | Results are small and all needed by the model |
| Workflows need loops, retries, or conditionals across tool calls | Linear sequences of 2–3 tool calls |
| PII must not reach the model context | Tool responses contain no sensitive data |
| Tasks benefit from state persistence across runs | Stateless, one-shot operations |
| You want agents to accumulate reusable skills | Fixed, predefined workflows |
## Core Architecture
### How It Works
Instead of loading all MCP tool definitions into context upfront, the agent:
1. **Discovers** available tools by navigating a typed file tree
2. **Generates** TypeScript/Python code that imports and calls typed wrapper functions
3. **Executes** the code in a sandboxed environment
4. **Returns** only filtered/summarized results to the model
This reduces tok