Skip to content

fix(generate-cli): use camelCase for Commander.js option names#28

Merged
steipete merged 1 commit intosteipete:mainfrom
rawwerks:fix/camelcase-option-names
Dec 29, 2025
Merged

fix(generate-cli): use camelCase for Commander.js option names#28
steipete merged 1 commit intosteipete:mainfrom
rawwerks:fix/camelcase-option-names

Conversation

@rawwerks
Copy link
Copy Markdown
Contributor

Problem

Generated CLIs fail to recognize option values when the MCP server uses snake_case property names in its schema.

For example, when a tool has a property relative_path, the generated CLI creates:

  • Flag: --relative-path
  • Access: cmdOpts.relative_path

But Commander.js converts --relative-path to relativePath (camelCase), so the option value is never read.

Solution

Convert the CLI option name to camelCase when generating the cmdOpts property access, matching Commander.js's behavior.

Testing

Tested with an MCP server that uses snake_case properties - options now work correctly.

Commander.js converts kebab-case flag names (e.g., --relative-path) to
camelCase property names (e.g., relativePath) when accessing cmdOpts.

The generated CLI template was using the original property names from the
schema (often snake_case), causing option values to not be recognized.

This converts the CLI option name to camelCase when generating cmdOpts
property access.
@steipete
Copy link
Copy Markdown
Owner

Thanks! Taking over.

@steipete steipete merged commit cd36e8f into steipete:main Dec 29, 2025
4 checks passed
@steipete
Copy link
Copy Markdown
Owner

Thanks for the fix, @rawwerks! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants