Configuration Options
gm-mcp supports various configuration options to customize the project creation process.
Command Line Options
init Command Options
| Option | Short | Description | Default | Example |
|---|---|---|---|---|
--template | -t | Select project template | basic | --template advanced |
--yes | -y | Skip confirmation prompts | false | --yes |
Global Options
| Option | Short | Description | Example |
|---|---|---|---|
--help | -h | Display help information | --help |
--version | -V | Display version information | --version |
Environment Variables
| Variable Name | Description | Default Value | Example |
|---|---|---|---|
NPM_REGISTRY | npm registry URL | https://registry.npmjs.org/ | https://registry.npmmirror.com |
GM_MCP_CACHE_DIR | Cache directory | ~/.gm-mcp/cache | /tmp/gm-mcp-cache |
GM_MCP_DEFAULT_TEMPLATE | Default template | basic | advanced |
Configuration File
Create ~/.gm-mcp/config.json file:
json
{
"defaultTemplate": "basic",
"autoInstall": true,
"registry": "https://registry.npmmirror.com",
"cacheDir": "~/.gm-mcp/cache",
"templates": {
"custom": {
"path": "~/my-templates/custom",
"description": "My custom template"
}
}
}Configuration Options Description
| Option | Type | Description | Default Value |
|---|---|---|---|
defaultTemplate | string | Default template to use | basic |
autoInstall | boolean | Whether to automatically install dependencies | true |
registry | string | npm registry URL | https://registry.npmjs.org/ |
cacheDir | string | Cache directory path | ~/.gm-mcp/cache |
templates | object | Custom template configuration | {} |
Template Configuration
Built-in Templates
basic: Basic templateadvanced: Advanced templateminimal: Minimal template
Custom Templates
json
{
"templates": {
"my-template": {
"path": "/path/to/template",
"description": "My custom template",
"default": false
}
}
}Usage Examples
Using Environment Variables
bash
export GM_MCP_DEFAULT_TEMPLATE=advanced
export NPM_REGISTRY=https://registry.npmmirror.com
gm-mcp init my-projectUsing Configuration File
bash
# Create configuration file
mkdir -p ~/.gm-mcp
cat > ~/.gm-mcp/config.json << EOF
{
"defaultTemplate": "advanced",
"autoInstall": true,
"registry": "https://registry.npmmirror.com"
}
EOF
# Use configuration
gm-mcp init my-projectCommand Line Override
bash
# Use command line options to override configuration
gm-mcp init my-project --template minimal --yesPriority
Configuration priority from high to low:
- Command line options
- Environment variables
- Configuration file
- Default values
Verify Configuration
bash
# View current configuration
gm-mcp version
# Test configuration
gm-mcp init test-project --template basic --yesTroubleshooting
Configuration File Errors
If the configuration file format is incorrect, gm-mcp will use default configuration and display a warning.
Template Path Errors
If the custom template path does not exist, it will fall back to the default template.
Network Configuration
If the npm registry is inaccessible, it will try to use a backup registry.
Next Steps
- Command List - View all available commands
- Template Overview - Learn about all templates