| Crates.io | mcp-execution-codegen |
| lib.rs | mcp-execution-codegen |
| version | 0.6.4 |
| created_at | 2026-01-04 00:27:27.749435+00 |
| updated_at | 2026-01-04 01:01:42.310886+00 |
| description | TypeScript code generation with progressive loading for MCP tools |
| homepage | https://github.com/bug-ops/mcp-execution |
| repository | https://github.com/bug-ops/mcp-execution |
| max_upload_size | |
| id | 2021026 |
| size | 151,556 |
Progressive loading TypeScript code generation for MCP tools. Achieves 98% token savings by generating one file per tool.
[dependencies]
mcp-execution-codegen = "0.6"
Or with cargo-add:
cargo add mcp-execution-codegen
[!IMPORTANT] Requires Rust 1.89 or later.
use mcp_execution_codegen::progressive::ProgressiveGenerator;
use mcp_execution_introspector::Introspector;
use mcp_execution_core::{ServerId, ServerConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Introspect MCP server
let mut introspector = Introspector::new();
let server_id = ServerId::new("github");
let config = ServerConfig::builder()
.command("github-mcp-execution-server".to_string())
.build();
let info = introspector.discover_server(server_id, &config).await?;
// 2. Generate progressive loading files
let generator = ProgressiveGenerator::new()?;
let code = generator.generate(&info)?;
println!("Generated {} files", code.file_count());
Ok(())
}
[!TIP] Generated files include: one
.tsfile per tool,index.tsre-exports, and_runtime/mcp-bridge.tshelper.
| Approach | Tokens | Savings |
|---|---|---|
| Traditional (all tools) | ~30,000 | - |
| Progressive (1 tool) | ~500-1,500 | 98% |
Each tool file includes full TypeScript interfaces:
/**
* Creates a new issue in a GitHub repository
* @param params - Tool parameters
* @returns Tool execution result
*/
export async function createIssue(
params: CreateIssueParams
): Promise<CreateIssueResult> {
return await callMCPTool('github', 'create_issue', params);
}
export interface CreateIssueParams {
/** Repository in format "owner/repo" */
repo: string;
/** Issue title */
title: string;
/** Issue body (optional) */
body?: string;
}
JSON Schema types are converted to TypeScript:
| JSON Schema | TypeScript |
|---|---|
string |
string |
number |
number |
boolean |
boolean |
array |
T[] |
object |
{ [key: string]: T } |
[!NOTE] Optional parameters use
?suffix in TypeScript interfaces.
| Metric | Target | Achieved |
|---|---|---|
| 10 tools | <100ms | 0.19ms (526x faster) |
| 50 tools | <20ms | 0.97ms (20.6x faster) |
| VFS export | <10ms | 1.2ms (8.3x faster) |
This crate is part of the mcp-execution workspace:
mcp-execution-core - Foundation typesmcp-execution-introspector - MCP server analysismcp-execution-files - Virtual filesystem for outputMinimum Supported Rust Version: 1.89
MSRV increases are considered minor version bumps.
Licensed under either of Apache License 2.0 or MIT license at your option.