|
| 1 | +# mcp-server |
| 2 | + |
| 3 | +[](https://github.com/bug-ops/mcp-execution/actions) |
| 4 | +[](https://github.com/bug-ops/mcp-execution) |
| 5 | +[](LICENSE) |
| 6 | + |
| 7 | +MCP server for generating progressive loading TypeScript files. Achieves 98% token savings (30,000 → 500-1,500 tokens per tool) by leveraging Claude's natural language understanding for tool categorization. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- **5 MCP Tools**: Complete workflow from introspection to skill generation |
| 12 | +- **No LLM API Required**: Claude (the conversation LLM) handles categorization |
| 13 | +- **98% Token Savings**: Progressive loading pattern reduces context usage dramatically |
| 14 | +- **Type-Safe**: Full TypeScript types generated from MCP JSON schemas |
| 15 | +- **Session Management**: Automatic 30-minute session expiry with lazy cleanup |
| 16 | + |
| 17 | +## Installation |
| 18 | + |
| 19 | +This crate is part of the [mcp-execution](https://github.com/bug-ops/mcp-execution) workspace. |
| 20 | + |
| 21 | +```bash |
| 22 | +# Build from workspace root |
| 23 | +cargo build --release -p mcp-server |
| 24 | + |
| 25 | +# Binary will be at target/release/mcp-execution |
| 26 | +``` |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +### Running the Server |
| 31 | + |
| 32 | +```bash |
| 33 | +# Direct execution |
| 34 | +mcp-execution |
| 35 | + |
| 36 | +# Or via cargo |
| 37 | +cargo run -p mcp-server |
| 38 | +``` |
| 39 | + |
| 40 | +### Claude Code Configuration |
| 41 | + |
| 42 | +Add to `~/.config/claude/mcp.json`: |
| 43 | + |
| 44 | +```json |
| 45 | +{ |
| 46 | + "mcpServers": { |
| 47 | + "mcp-execution": { |
| 48 | + "command": "mcp-execution" |
| 49 | + } |
| 50 | + } |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +### Programmatic Usage |
| 55 | + |
| 56 | +```rust |
| 57 | +use mcp_server::GeneratorService; |
| 58 | +use rmcp::ServiceExt; |
| 59 | +use rmcp::transport::stdio; |
| 60 | + |
| 61 | +#[tokio::main] |
| 62 | +async fn main() -> anyhow::Result<()> { |
| 63 | + let service = GeneratorService::new().serve(stdio()).await?; |
| 64 | + service.waiting().await?; |
| 65 | + Ok(()) |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +## MCP Tools |
| 70 | + |
| 71 | +### `introspect_server` |
| 72 | + |
| 73 | +Connect to an MCP server and discover its tools. |
| 74 | + |
| 75 | +```json |
| 76 | +{ |
| 77 | + "server_id": "github", |
| 78 | + "command": "npx", |
| 79 | + "args": ["-y", "@anthropic/mcp-server-github"], |
| 80 | + "env": { "GITHUB_TOKEN": "..." } |
| 81 | +} |
| 82 | +``` |
| 83 | + |
| 84 | +Returns tool metadata for Claude to categorize and a `session_id` for the next step. |
| 85 | + |
| 86 | +### `save_categorized_tools` |
| 87 | + |
| 88 | +Generate TypeScript files using Claude's categorization. |
| 89 | + |
| 90 | +```json |
| 91 | +{ |
| 92 | + "session_id": "uuid-from-introspect", |
| 93 | + "categorized_tools": [ |
| 94 | + { |
| 95 | + "name": "create_issue", |
| 96 | + "category": "issues", |
| 97 | + "keywords": "create,issue,new,bug", |
| 98 | + "short_description": "Create a new issue" |
| 99 | + } |
| 100 | + ] |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +### `list_generated_servers` |
| 105 | + |
| 106 | +List all servers with generated progressive loading files. |
| 107 | + |
| 108 | +```json |
| 109 | +{ |
| 110 | + "base_dir": "~/.claude/servers" |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +### `generate_skill` |
| 115 | + |
| 116 | +Analyze generated files and return context for SKILL.md generation. |
| 117 | + |
| 118 | +```json |
| 119 | +{ |
| 120 | + "server_id": "github", |
| 121 | + "skill_name": "github-progressive", |
| 122 | + "use_case_hints": ["repository management", "issue tracking"] |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +### `save_skill` |
| 127 | + |
| 128 | +Save generated SKILL.md content to the filesystem. |
| 129 | + |
| 130 | +```json |
| 131 | +{ |
| 132 | + "server_id": "github", |
| 133 | + "content": "---\nname: github\ndescription: ...\n---\n...", |
| 134 | + "overwrite": false |
| 135 | +} |
| 136 | +``` |
| 137 | + |
| 138 | +## Workflow |
| 139 | + |
| 140 | +```mermaid |
| 141 | +flowchart LR |
| 142 | + subgraph Code Generation |
| 143 | + A[introspect_server] --> B[Claude analyzes\nand categorizes] |
| 144 | + B --> C[save_categorized_tools] |
| 145 | + C --> D[TypeScript files\ngenerated] |
| 146 | + end |
| 147 | +
|
| 148 | + subgraph Skill Generation |
| 149 | + D --> E[generate_skill] |
| 150 | + E --> F[save_skill] |
| 151 | + F --> G[SKILL.md] |
| 152 | + end |
| 153 | +``` |
| 154 | + |
| 155 | +## Architecture |
| 156 | + |
| 157 | +### Modules |
| 158 | + |
| 159 | +| Module | Description | |
| 160 | +|--------|-------------| |
| 161 | +| `service` | MCP server implementation with tool handlers | |
| 162 | +| `types` | Parameter and result types for all tools | |
| 163 | +| `state` | Session state management with LRU cache | |
| 164 | +| `skill` | SKILL.md generation context builder | |
| 165 | + |
| 166 | +### Dependencies |
| 167 | + |
| 168 | +- **rmcp** - Official Rust MCP SDK |
| 169 | +- **mcp-core** - Foundation types and traits |
| 170 | +- **mcp-codegen** - TypeScript code generation |
| 171 | +- **mcp-files** - Virtual filesystem for output |
| 172 | +- **mcp-introspector** - MCP server discovery |
| 173 | + |
| 174 | +## Related Crates |
| 175 | + |
| 176 | +This crate is part of the `mcp-execution` workspace: |
| 177 | + |
| 178 | +- [`mcp-core`](../mcp-core) - Foundation types, traits, and error handling |
| 179 | +- [`mcp-introspector`](../mcp-introspector) - MCP server analysis |
| 180 | +- [`mcp-codegen`](../mcp-codegen) - TypeScript code generation |
| 181 | +- [`mcp-files`](../mcp-files) - Virtual filesystem |
| 182 | +- [`mcp-cli`](../mcp-cli) - Command-line interface |
| 183 | + |
| 184 | +## MSRV Policy |
| 185 | + |
| 186 | +Minimum Supported Rust Version: **1.89** |
| 187 | + |
| 188 | +MSRV increases are considered minor version bumps. |
| 189 | + |
| 190 | +## License |
| 191 | + |
| 192 | +Licensed under either of: |
| 193 | + |
| 194 | +- Apache License, Version 2.0 ([LICENSE-APACHE](../../LICENSE.md) or <http://www.apache.org/licenses/LICENSE-2.0>) |
| 195 | +- MIT license ([LICENSE-MIT](../../LICENSE.md) or <http://opensource.org/licenses/MIT>) |
| 196 | + |
| 197 | +at your option. |
0 commit comments