Skip to main content

Configuration Guide

Note: This document replaces a symlink that previously pointed to ./llm-mcp/docs/guides/configuration.md which doesn't exist.

This document provides detailed information about configuring the Model Control Plane.

Configuration Fileโ€‹

The MCP can be configured using a JavaScript/JSON configuration file:

// mcp-config.js
module.exports = {
api: {
port: 3000,
host: 'localhost',
cors: {
enabled: true,
origins: ['https://example.com']
},
rateLimit: {
enabled: true,
maxRequests: 100,
windowMs: 60000 // 1 minute
}
},
providers: {
anthropic: {
apiKey: process.env.ANTHROPIC_API_KEY,
defaultModel: 'claude-3-sonnet',
timeout: 30000 // 30 seconds
},
openai: {
apiKey: process.env.OPENAI_API_KEY,
defaultModel: 'gpt-4',
timeout: 30000
}
},
cache: {
enabled: true,
type: 'redis', // or 'memory'
ttl: 3600, // seconds
redis: {
host: 'localhost',
port: 6379,
password: process.env.REDIS_PASSWORD
}
},
logging: {
level: 'info', // debug, info, warn, error
format: 'json', // json, text
destination: 'file', // file, console
file: {
path: '/var/log/mcp.log',
maxSize: '10m',
maxFiles: 5
}
},
security: {
authType: 'api_key', // api_key, jwt, oauth
jwtSecret: process.env.JWT_SECRET,
enableHttps: true,
corsEnabled: true
}
};

Environment Variablesโ€‹

Configuration can also be provided using environment variables:

# Server configuration
export MCP_PORT=3000
export MCP_HOST="0.0.0.0"

# Provider API keys
export MCP_ANTHROPIC_API_KEY="your_api_key"
export MCP_OPENAI_API_KEY="your_api_key"

# Cache configuration
export MCP_CACHE_ENABLED=true
export MCP_CACHE_TYPE="redis"
export MCP_CACHE_TTL=3600
export MCP_REDIS_HOST="localhost"
export MCP_REDIS_PORT=6379
export MCP_REDIS_PASSWORD="your_password"

# Logging
export MCP_LOG_LEVEL="info"
export MCP_LOG_FORMAT="json"
export MCP_LOG_DESTINATION="file"
export MCP_LOG_FILE_PATH="/var/log/mcp.log"

# Security
export MCP_AUTH_TYPE="api_key"
export MCP_JWT_SECRET="your_jwt_secret"
export MCP_ENABLE_HTTPS=true
export MCP_CORS_ENABLED=true

Command Line Optionsโ€‹

npx mcp-server --config ./mcp-config.js --port 3000 --log-level debug

Advanced Configurationโ€‹

For advanced configuration options such as model mapping, custom prompts, and provider-specific settings, refer to the Advanced Configuration Guide.