
🚀 从MCP服务器生成可执行的TypeScript工具,令牌节省98%。AI代理的渐进加载模式。生产准备就绪。
概览
利用渐进加载模式将任何MCP服务器转换为可执行的类型安全TypeScript工具。只需加载你需要的内容即可实现。 灵感来自Anthropic关于MCP代码执行的工程博客文章。 传统的MCP集成会从服务器加载所有工具(~3万个令牌),即使你只需要一两个代币。这浪费了上下文窗口空间,也拖慢了AI代理的速度。 渐进加载每个工具生成一个TypeScript文件(每个约500-1500个令牌)。AI代理仅通过简单的ls和cat命令发现并加载所需文件。 自 v0.9.0 起,独立的 mcp-execution-runtime npm 包已被移除。如果你正在使用,请切换到 mcp-execution-cli generate 生成的 TypeScript 桥,该桥在积极维护中并接收所有安全更新。 需要Rust 1.91或更高版本才能从源代码构建。 每个工具文件都自包含完整的 TypeScript 接口和 JSDoc 文档。 使用 --from-config 从 ~/ 加载服务器设置。
概述(AI 翻译)
利用渐进加载模式将任何 MCP 服务器转换为可执行的类型安全 TypeScript 工具。通过只加载你需要的内容,实现 98% 的令牌节省。
[!提示] 灵感来自Anthropic关于MCP代码执行的工程博客文章。
问题
传统的MCP集成会从服务器加载所有工具(~3万个令牌),即使你只需要一两个代币。这浪费了上下文窗口空间,也拖慢了AI代理的速度。
解决方案
渐进加载每个工具生成一个TypeScript文件(每个约500-1500个令牌)。AI代理仅通过简单的ls和cat命令发现并加载所需文件。
结果:98%令牌节省 + 自主执行 + 类型安全
安装
来自 crates.io(推荐)
预建二进制
从GitHub下载 发布:
来源
作为图书馆
为你的项目添加单独的箱子:
或者在Cargo.toml中添加:
[!警告] 自 v0.9.0 起,独立的
mcp-execution-runtimenpm 包已被移除。如果你正在使用它,请切换到mcp-execution-cli generate生成的 TypeScript 桥,该桥在积极维护中并接收所有安全更新。
[!重要]
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 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
Add individual crates to your project:
cargo add mcp-execution-core # Foundation types
cargo add mcp-execution-introspector # MCP server analysis
cargo add mcp-execution-codegen # TypeScript generation
cargo add mcp-execution-files # Virtual filesystem
cargo add mcp-execution-skill # SKILL.md generation
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →