-
Notifications
You must be signed in to change notification settings - Fork 0
feat(codegen): add Claude Agent SDK code generator #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add labeler workflow using actions/labeler@v5 - Configure rules for all 5 crates - Add type labels: docs, ci, deps, tests, benchmarks, examples - Add special labels: adr, security, breaking change, release, workspace
Add support for generating TypeScript tools compatible with Claude Agent SDK.
This new generator creates Zod schemas for type-safe tool definitions.
New features:
- New `claude_agent` module in mcp-codegen with generator, types, and zod conversion
- Handlebars templates for tool.ts, server.ts, and index.ts
- CLI `--generator claude-agent` flag for selecting output format
- JSON Schema to Zod type mapping with format hints (.email(), .url(), etc.)
Generated structure:
~/.claude/agent-sdk/{server-id}/
├── index.ts # Entry point with exports
├── server.ts # createSdkMcpServer() definition
└── tools/
└── {tool}.ts # Individual tools with Zod schemas
Usage:
mcp-execution-cli generate --from-config github --generator claude-agent
Closes #29
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## master #29 +/- ##
==========================================
+ Coverage 93.79% 94.08% +0.28%
==========================================
Files 14 17 +3
Lines 2723 3735 +1012
==========================================
+ Hits 2554 3514 +960
- Misses 169 221 +52
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Add 26 new tests to improve template engine test coverage: - Claude Agent SDK template rendering tests - Progressive loading template rendering tests - Error handling tests (missing fields, invalid syntax) - Edge case tests (unicode, special chars, empty arrays) - Custom template tests (loops, conditionals, override) - Strict mode and thread safety tests Test coverage increased from 5 to 31 tests.
d16aac5 to
6a7fe86
Compare
Performance improvements: - Replace Vec::insert(0) with direct assignment in integer handling - Add with_capacity() hints for String and Vec allocations - Inline format args for consistency Code quality improvements: - Consolidate IndexContext as type alias for ServerContext - Add From<ZodPropertyInfo> for PropertyInfo conversion - Make ZodPropertyInfo and extract_zod_properties pub(crate) - Add #[must_use] attribute to generate() method - Fix regex pattern escaping (escape forward slashes) Test improvements: - Add test for From trait implementation - Add test for regex pattern escaping - Fix numeric test value to avoid clippy::approx_constant
Update dependencies to latest versions: - criterion: 0.7 → 0.8 - rmcp: 0.9 → 0.10 - uuid: 1.11 → 1.19 All 502 tests pass with updated dependencies.
Code quality improvements based on architect/security review: - Replace .expect() with .ok_or_else() in common.rs:183 (prevents panic from user input, returns proper error) - Add # Errors sections to server.rs::run() - Add # Errors sections to formatters.rs functions (4 functions) - Remove #![allow(clippy::missing_errors_doc)] suppression - Update build_server_config docs (remove Panics, expand Errors) Security audit found only 1 production .expect() - now fixed. All 502 tests pass.
Replace TODO comment with proper developer guidance: - Add @remarks and @example JSDoc sections with implementation pattern - Change silent stub to throw Error with clear message - Remove misleading "MCP bridge" comment (bridge is user-implemented) The stub now fails fast if called without implementation, making it clear that developers need to provide their own logic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
adr
Architecture Decision Records (docs/adr/)
breaking change
Contains breaking API changes (requires major version bump)
build
Build configuration changes (build.rs, toolchain)
crate: mcp-cli
Changes to mcp-cli crate (command-line interface)
crate: mcp-codegen
Changes to mcp-codegen crate (TypeScript code generation)
release
Release preparation (changelog, version bumps)
security
Security-related changes (deny.toml, vulnerabilities)
type: ci
CI/CD changes (.github/, workflows, automation)
type: dependencies
Dependency updates (Cargo.toml, Cargo.lock)
type: documentation
Documentation changes (*.md, docs/, comments)
workspace
Workspace-wide changes affecting multiple crates
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
claude_agentmodule in mcp-codegen for generating Claude Agent SDK compatible TypeScript.email(),.url(), etc.)--generator claude-agentCLI flag for selecting output formatFeatures
New Generator Module
claude_agent/generator.rs- Main generator for Claude Agent SDK formatclaude_agent/types.rs- Context types for Handlebars templatesclaude_agent/zod.rs- JSON Schema → Zod type conversion with modifiersCLI Integration
# Generate Claude Agent SDK format mcp-execution-cli generate --from-config github --generator claude-agentGenerated Structure
Example Generated Tool
Test plan
Related
docs/adr/012-claude-agent-sdk-generator.mdCloses #29