Skip to content

Configuration Options

gm-mcp supports various configuration options to customize the project creation process.

Command Line Options

init Command Options

OptionShortDescriptionDefaultExample
--template-tSelect project templatebasic--template advanced
--yes-ySkip confirmation promptsfalse--yes

Global Options

OptionShortDescriptionExample
--help-hDisplay help information--help
--version-VDisplay version information--version

Environment Variables

Variable NameDescriptionDefault ValueExample
NPM_REGISTRYnpm registry URLhttps://registry.npmjs.org/https://registry.npmmirror.com
GM_MCP_CACHE_DIRCache directory~/.gm-mcp/cache/tmp/gm-mcp-cache
GM_MCP_DEFAULT_TEMPLATEDefault templatebasicadvanced

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

OptionTypeDescriptionDefault Value
defaultTemplatestringDefault template to usebasic
autoInstallbooleanWhether to automatically install dependenciestrue
registrystringnpm registry URLhttps://registry.npmjs.org/
cacheDirstringCache directory path~/.gm-mcp/cache
templatesobjectCustom template configuration{}

Template Configuration

Built-in Templates

  • basic: Basic template
  • advanced: Advanced template
  • minimal: 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-project

Using 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-project

Command Line Override

bash
# Use command line options to override configuration
gm-mcp init my-project --template minimal --yes

Priority

Configuration priority from high to low:

  1. Command line options
  2. Environment variables
  3. Configuration file
  4. Default values

Verify Configuration

bash
# View current configuration
gm-mcp version

# Test configuration
gm-mcp init test-project --template basic --yes

Troubleshooting

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

Released under the MIT License