1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Progressive loading code generation for MCP tools.
//!
//! This crate generates TypeScript files for progressive loading pattern,
//! where each MCP tool is a separate file. This enables Claude Code to
//! discover and load tools on-demand, achieving 98% token savings.
//!
//! # Architecture
//!
//! The progressive loading pattern works as follows:
//!
//! 1. **Tool Discovery**: Claude Code lists files in `~/.claude/servers/{server-id}/`
//! 2. **Selective Loading**: Claude Code reads only the tools it needs
//! 3. **Execution**: Generated TypeScript code calls MCP tools via bridge
//!
//! # Example
//!
//! ```no_run
//! use mcp_execution_codegen::progressive::ProgressiveGenerator;
//! use mcp_execution_introspector::ServerInfo;
//!
//! # fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let generator = ProgressiveGenerator::new()?;
//! // generator.generate(&server_info)?;
//! # Ok(())
//! # }
//! ```
//!
//! # Generated Structure
//!
//! For a server with 3 tools, generates:
//! ```text
//! ~/.claude/servers/github/
//! ├── index.ts # Re-exports all tools
//! ├── createIssue.ts # Individual tool file
//! ├── updateIssue.ts # Individual tool file
//! └── _runtime/
//! └── mcp-bridge.ts # Runtime helper
//! ```
//!
//! # Token Savings
//!
//! - **Traditional**: Load all 30 tools upfront = 30,000 tokens
//! - **Progressive**: Load on-demand = ~2,000 tokens per tool
//! - **Savings**: 93-98%
// Core modules (always available)
// Re-export main types
pub use ;
pub use ProgressiveGenerator;
pub use TemplateEngine;