Skip to content

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

License

Notifications You must be signed in to change notification settings

bug-ops/mcp-execution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

93 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MCP Code Execution

CI codecov MSRV License

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

Pre-built binaries

Download from GitHub Releases:

# macOS (Apple Silicon)
curl -L https://github.com/bug-ops/mcp-execution/releases/latest/download/mcp-execution-cli-macos-arm64.tar.gz | tar xz

# macOS (Intel)
curl -L https://github.com/bug-ops/mcp-execution/releases/latest/download/mcp-execution-cli-macos-amd64.tar.gz | tar xz

# Linux (x86_64)
curl -L https://github.com/bug-ops/mcp-execution/releases/latest/download/mcp-execution-cli-linux-amd64.tar.gz | tar xz

From source

git clone https://github.com/bug-ops/mcp-execution
cd mcp-execution
cargo install --path crates/mcp-cli

Important

Requires Rust 1.89 or later.

Usage

Generate TypeScript Tools

# 1. Configure MCP server in ~/.config/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

Workspace Crates

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

Dependency Graph:

mcp-cli β†’ {mcp-codegen, mcp-introspector, mcp-files, mcp-core}
mcp-server β†’ {mcp-codegen, mcp-introspector, mcp-files, mcp-core}
mcp-codegen β†’ {mcp-files, mcp-core}
mcp-introspector β†’ {rmcp, mcp-core}
mcp-files β†’ mcp-core

CLI Commands

See mcp-cli README for full reference.

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

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

# View cache statistics
mcp-execution-cli stats

# Shell completions
mcp-execution-cli completions bash

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

MSRV increases are considered minor version bumps.

License

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

About

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

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •