BO

bug-ops/mcp-execution

Developer tools
46 stars 4 forks Quality 58 Trend 32NOASSERTION

🚀 Generate executable TypeScript tools from MCP servers with 98% token savings. Progressive loading pattern for AI agents. Production-ready.

Overview

Transform any MCP server into executable, type-safe TypeScript tools using progressive loading pattern. Achieve by loading only what you need. Inspired by Anthropic's engineering blog post on Code Execution with MCP. Traditional MCP integration loads ALL tools from a server (~30,000 tokens), even when you only need one or two. This wastes context window space and slows down AI agents. Progressive loading generates one TypeScript file per tool (~500-1,500 tokens each). AI agents discover and load only what they need via simple ls and cat commands. The standalone mcp-execution-runtime npm package has been removed as of v0.9.0. If you were using it, switch to the TypeScript bridge generated by mcp-execution-cli generate, which is actively maintained and receives all security updates. Requires Rust 1.91 or later for building from source. Each tool file is self-contained with full TypeScript interfaces and JSDoc documentation. Use --from-config to load server settings from ~/.

README

MCP Code Execution

Transform any MCP server into executable, type-safe TypeScript tools using progressive loading pattern. Achieve 98% token savings by loading only what you need.

[!TIP] Inspired by Anthropic’s engineering blog post on Code Execution with MCP.

The Problem

Traditional MCP integration loads ALL tools from a server (~30,000 tokens), even when you only need one or two. This wastes context window space and slows down AI agents.

The Solution

Progressive loading generates one TypeScript file per tool (~500-1,500 tokens each). AI agents discover and load only what they need via simple ls and cat commands.

Result: 98% token savings + autonomous execution + type safety

Installation

From crates.io (recommended)

cargo install mcp-execution-cli

[!IMPORTANT] Requires Rust 1.91 or later for building from source.

Usage

Generate TypeScript Tools

# 1. Configure MCP server in ~/.claude/mcp.json
# 2. Generate tools
mcp-execution-cli generate --from-config github

# Output: ~/.claude/servers/github/
#   - createIssue.ts
#   - updateIssue.ts
#   - ... (one file per tool)

Progressive Loading

# List available tools
ls ~/.claude/servers/github/

# Load only what you need (98% token savings!)
cat ~/.claude/servers/github/createIssue.ts

# Execute autonomously
node ~/.claude/servers/github/createIssue.ts --repo="owner/repo" --title="Bug"

[!NOTE] Each tool file is self-contained with full TypeScript interfaces and JSDoc documentation.

Key Features

Feature Description
98% Token Savings Load 1 tool (~500 tokens) vs all tools (~30,000 tokens)
Autonomous Execution Generated files run directly via Node.js CLI
Type-Safe Full TypeScript interfaces from MCP JSON schemas
Lightning Fast 526x faster than target (0.19ms for 10 tools)
100% MCP Compatible Works with all MCP servers via rmcp SDK
Thoroughly Tested 657 tests with 100% pass rate

Workspace Crates

Crate Description
mcp-execution-core Foundation types, traits, and error handling
mcp-execution-introspector MCP server analysis using rmcp SDK
mcp-execution-codegen TypeScript code generation with progressive loading
mcp-execution-files Virtual filesystem for code organization
mcp-execution-skill SKILL.md generation for Claude Code
mcp-execution-server MCP server for progressive loading generation
mcp-execution-cli Command-line interface

Dependency Graph:

mcp-execution-cli → {mcp-execution-codegen, mcp-execution-introspector, mcp-execution-files, mcp-execution-core, mcp-execution-skill}
mcp-execution-server → {mcp-execution-codegen, mcp-execution-introspector, mcp-execution-files, mcp-execution-core, mcp-execution-skill}
mcp-execution-codegen → {mcp-execution-introspector, mcp-execution-core}
mcp-execution-files → mcp-execution-codegen
mcp-execution-introspector → {rmcp, mcp-execution-core}
mcp-execution-skill → mcp-execution-core

CLI Commands

See mcp-cli README for full reference.

# Generate TypeScript tools from config (recommended)
mcp-execution-cli generate --from-config github

# Preview what would be generated without writing to disk
mcp-execution-cli generate --from-config github --dry-run

# Introspect MCP server from config
mcp-execution-cli introspect --from-config github

# Introspect with detailed schemas
mcp-execution-cli introspect --from-config github --detailed

# Manual configuration (alternative)
mcp-execution-cli introspect docker --arg=run --arg=-i --env=TOKEN=xxx

# Shell completions
mcp-execution-cli completions bash

[!TIP] Use --from-config to load server settings from ~/.claude/mcp.json instead of manual arguments.

[!IMPORTANT] v0.9 breaking change: generate --http and introspect --http now require either --from-config, a positional command, or --http/--sse, not a combination. If you were combining a positional command with --http or --sse, use one or the other exclusively.

[!WARNING] v0.10 breaking change: _meta.json metadata schema version bumped from 1 to 2. Files generated before this release will no longer parse and must be regenerated. Run mcp-execution-cli generate --from-config to update your generated tool files.

[!WARNING] v0.10 breaking change: server IDs and tool names must now consist only of Unicode Identifier_Status=Allowed characters. A remote MCP server exposing a tool named with a space or @/+/(/&/``/etc. now fails introspection outright instead of being silently accepted — this closes a spoofing risk where a hostile server could publish a tool name that is visually near-identical to a legitimate one.

Performance

Metric Target Achieved
10 tools generation <100ms 0.19ms (526x faster)
50 tools generation <20ms 0.97ms (20.6x faster)
VFS export <10ms 1.2ms (8.3x faster)
Memory (1000 tools) <256MB ~2MB

Documentation

Development

cargo build --workspace        # Build
cargo nextest run --workspace  # Test
cargo clippy --workspace       # Lint
cargo +nightly fmt --workspace # Format

[!NOTE] All development follows Microsoft Rust Guidelines.

MSRV Policy

Minimum Supported Rust Version: 1.91

MSRV increases are considered minor version bumps.

License

Licensed under either of Apache License 2.0 or MIT license at your option.

View the full README on GitHub

Install

This server does not publish a one-line install command.

Open the repository installation guide New to MCP? Start with the mcpskill.org guide →