mcp-code-execution

Execute Serena MCP tools as TypeScript code to reduce token consumption.

Updated Nov 8, 2025
One-click install
npx skills add https://github.com/Suntory-N-Water/mcp-code-execution --skill mcp-code-execution-suntory-n-water
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-code-execution
Source: https://github.com/Suntory-N-Water/mcp-code-execution/tree/main/.
Command: npx skills add https://github.com/Suntory-N-Water/mcp-code-execution --skill mcp-code-execution-suntory-n-water

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill dramatically reduces the token cost of executing Serena MCP tools by running them as TypeScript code. It ensures you only load the necessary tools into memory, process data locally within your script, and report only the final results to Claude, saving time and avoiding context bloat.

Core Features & Use Cases

  • On-demand tool loading: Import only the Serena MCP tools you actually need, when you need them.
  • Token-efficient workflows: Process large datasets entirely in-code and return a concise result, minimizing LLM context.
  • Modular, multi-tool workflows: Seamlessly compose tasks like listing files, inspecting symbols, and refactoring, while keeping intermediate data private to your script.
  • Use Case: You have 1000+ source files. Use this Skill to analyze and transform them with Serena MCP, while the final summary is sent to the LLM for decision-making.

Quick Start

From your project, place the MCP code execution script in the Skill’s context and run it to perform deterministic steps. Then call the script via bun run, for example: bun run src/your-script.ts

Frequently Asked Questions about mcp-code-execution

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce token usage when running MCP tools on large codebases?

Run Serena MCP tools as TypeScript code instead of through the model. Load only the tools you need, process data locally in your script, and return only final results to Claude, cutting token consumption significantly on large datasets and batch operations.

Can I execute MCP tools directly in code without sending intermediate data to the model?

Yes. This Skill lets you import Serena MCP tool wrappers on-demand, execute them as TypeScript, filter and transform data locally, and report only summarized results back. Intermediate processing stays private to your script.

What's the best way to analyze 1000+ files with MCP while keeping costs down?

Use this Skill to compose multi-tool workflows—listing files, inspecting symbols, refactoring—entirely in TypeScript code. Process all files locally, aggregate findings, then send only the final summary to the LLM for decision-making.

How do I set up and run an MCP code execution script?

Place the MCP script in your project context, then execute it via `bun run src/your-script.ts`. The script manages the MCP client lifecycle, loads tools on demand, and runs deterministic steps without requiring model inference on intermediate steps.

Does this approach work for privacy-preserving data flows across projects?

Yes. By executing MCP tools as code and processing data locally before reporting results, sensitive intermediate data never reaches the model, making it suitable for cross-project analyses where privacy matters.

What are the limits of running MCP tools as code instead of through the model?

This approach works best for deterministic, batch-oriented tasks with clear input-output boundaries. Complex reasoning or dynamic decision-making mid-workflow may still benefit from model interaction; use this Skill when you can define processing logic upfront.