feat: add --model CLI parameter for model selection#19
feat: add --model CLI parameter for model selection#19chindris-mihai-alexandru wants to merge 2 commits intoCerebras:mainfrom
Conversation
Implements feature requested in issue Cerebras#6 Changes: - Add --model/-m CLI parameter to specify Cerebras model at runtime - Add --help/-h flag to display usage information and available models - Add AVAILABLE_MODELS constant with all supported Cerebras models - Add setModel() function to enable runtime model configuration - Update README with model selection documentation Available models: - llama3.1-8b (8B, ~2200 tokens/s) - llama-3.3-70b (70B, ~2100 tokens/s) - gpt-oss-120b (120B, ~3000 tokens/s) - qwen-3-32b (32B, ~2600 tokens/s) - qwen-3-235b-a22b-instruct-2507 (235B, ~1400 tokens/s, Preview) - zai-glm-4.6 (357B, ~1000 tokens/s, Preview, Default) Usage: cerebras-mcp --model llama-3.3-70b cerebras-mcp -m qwen-3-32b cerebras-mcp --help Resolves Cerebras#6
There was a problem hiding this comment.
Pull request overview
This PR adds CLI model selection functionality to the Cerebras Code MCP Server, allowing users to specify which Cerebras model to use via a --model flag. The implementation uses Node.js's built-in parseArgs for argument handling and includes comprehensive help documentation.
Key Changes:
- Added
--model/-mCLI parameter for runtime model selection with validation and fallback to default - Implemented
--help/-hflag displaying usage information and available models - Created
AVAILABLE_MODELSconstant with metadata for all 6 supported Cerebras models
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/index.js | Implements CLI argument parsing with parseArgs, model validation logic, and comprehensive help text |
| src/config/constants.js | Adds AVAILABLE_MODELS constant with model metadata and setModel() function for runtime configuration |
| README.md | Documents model selection feature, lists available models with specifications, and provides usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.error('Cerebras Code MCP Server starting...'); | ||
| console.error(`📝 Debug logs will be written to: ${LOG_FILE}`); |
There was a problem hiding this comment.
The server startup should display which model is currently being used, regardless of whether it was set via CLI flag or environment variable. Currently, the model is only shown when explicitly set via the --model flag. Add a log statement after line 95 to always show the active model, similar to how API key availability is logged.
| Options: | ||
| -c, --config Run interactive configuration wizard | ||
| -r, --remove Remove MCP server configuration | ||
| -m, --model <model-name> Specify which Cerebras model to use (default: ${config.cerebrasModel}) |
There was a problem hiding this comment.
The help message displays the default model by accessing config.cerebrasModel at template string evaluation time (line 54). However, if the CEREBRAS_MODEL environment variable is set, this will show the environment variable's value as the default, which could be confusing. Consider hardcoding the default as "zai-glm-4.6" in the help text, and separately mention that it can be overridden by the CEREBRAS_MODEL environment variable.
| -m, --model <model-name> Specify which Cerebras model to use (default: ${config.cerebrasModel}) | |
| -m, --model <model-name> Specify which Cerebras model to use (default: zai-glm-4.6) | |
| This default can be overridden via the CEREBRAS_MODEL environment variable. |
| - `llama-3.3-70b` - Llama 3.3 70B (70 billion parameters, ~2100 tokens/s) | ||
| - `gpt-oss-120b` - OpenAI GPT OSS (120 billion parameters, ~3000 tokens/s) | ||
| - `qwen-3-32b` - Qwen 3 32B (32 billion parameters, ~2600 tokens/s) | ||
| - `qwen-3-235b-a22b-instruct-2507` - Qwen 3 235B Instruct (235 billion, ~1400 tokens/s, Preview) |
There was a problem hiding this comment.
Inconsistent formatting in the model descriptions. Line 51 says "235 billion" while other entries say "235 billion parameters". Line 52 also says "357 billion parameters" while line 51 drops the "parameters" word. For consistency, either all entries should include "parameters" or all should omit it.
| - `qwen-3-235b-a22b-instruct-2507` - Qwen 3 235B Instruct (235 billion, ~1400 tokens/s, Preview) | |
| - `qwen-3-235b-a22b-instruct-2507` - Qwen 3 235B Instruct (235 billion parameters, ~1400 tokens/s, Preview) |
| */ | ||
|
|
||
| import { config, debugLog, LOG_FILE } from './config/constants.js'; | ||
| import { parseArgs } from 'node:util'; |
There was a problem hiding this comment.
The parseArgs function from node:util was stabilized in Node.js 18.3.0, but package.json specifies "node": ">=18.0.0". Users running Node.js 18.0.0-18.2.x will encounter errors because parseArgs is experimental in those versions and requires a flag to use. Consider either updating the minimum Node.js version to ">=18.3.0" in package.json, or using the util.parseArgs with the experimental flag check for older versions.
| cerebras-mcp -m qwen-3-32b # Use Qwen 3 32B (shorthand) | ||
| cerebras-mcp --config # Configure API keys | ||
|
|
||
| For more information, visit: https://github.com/Cerebras/cerebras-code-mcp |
There was a problem hiding this comment.
The GitHub repository URL in the help text does not match the actual repository URL specified in package.json. The help text references "https://github.com/Cerebras/cerebras-code-mcp" but package.json indicates the repository is at "https://github.com/kevint-cerebras/cerebras-mcp". Update the URL to match the correct repository location.
| For more information, visit: https://github.com/Cerebras/cerebras-code-mcp | |
| For more information, visit: https://github.com/kevint-cerebras/cerebras-mcp |
- Add startup log showing active model regardless of selection method - Hardcode default model (zai-glm-4.6) in help text for clarity - Fix parameter formatting: '235 billion' → '235 billion parameters' - Update Node.js requirement to >=18.3.0 for parseArgs support - Fix GitHub URL to match package.json repository
Copilot AI Review Feedback AddressedI've addressed all 5 comments in commit b6a21fc: Changes Made:
All changes maintain backward compatibility and improve code quality. |
Model List VerificationI've verified that the model list in this PR matches the current official Cerebras Inference API documentation (January 2026). Models Included (6 total)Production Models:
Preview Models:
SourceOfficial documentation: https://inference-docs.cerebras.ai/models Note on qwen-3-coder-480bThe |
|
Closing this stale PR to keep my open queue focused. If maintainers still want this change, I can reopen and refresh it. |
Summary
Adds the ability to select which Cerebras model to use via a
--modelCLI parameter, addressing the feature request in #6.Changes
New Features
--model <model-name>/-m <model-name>- Select which Cerebras model to use--help/-h- Display usage information and list of available modelsImplementation Details
AVAILABLE_MODELSconstant insrc/config/constants.jswith all 6 supported Cerebras modelssetModel()function to enable runtime model configurationparseArgs(node:util) for CLI argument parsing--modelflag providedDocumentation
--helpflagAvailable Models
llama3.1-8bllama-3.3-70bgpt-oss-120bqwen-3-32bqwen-3-235b-a22b-instruct-2507zai-glm-4.6Usage Examples
Testing
--helpdisplays correct informationCopilot AI Review
All 5 automated review comments have been addressed in commit b6a21fc:
Resolves
Closes #6
Notes
CEREBRAS_MODELenvironment variable still works and takes precedence if setzai-glm-4.6to maintain existing behavior