Config Tools — Configuration Management via MCP
V3 MCP tool suite for managing claude-flow configuration files. Supports loading with scope-based resolution, saving with automatic backups, and validation with auto-fix capabilities. Includes path traversal protection.
Purpose
Provides a safe, validated interface for managing claude-flow configuration across global, project, and user scopes. Handles merging with defaults, creating backups before writes, and validating all configuration sections against known schemas.
Source Location
/tmp/ruflo/v3/mcp/tools/config-tools.ts
MCP Tools
config/load
Load configuration from a file, optionally merged with defaults.
Input: {
path?: string // Default: ./claude-flow.config.json
scope: "global" | "project" | "user" // Default: project
merge: boolean // Merge with defaults (default: true)
includeDefaults: boolean // Include default values in response (default: false)
}
Output: {
config: Configuration,
source: string,
scope: string,
loadedAt: string, // ISO 8601
defaults?: Configuration
}
config/save
Save configuration to a file with optional merge and backup.
Input: {
config: Record<string, unknown> // Configuration object
path?: string // Default: ./claude-flow.config.json
scope: "global" | "project" | "user" // Default: project
merge: boolean // Merge with existing (default: true)
createBackup: boolean // Backup existing file (default: true)
}
Output: {
saved: boolean,
path: string,
scope: string,
savedAt: string,
backupPath?: string // Path to backup file (timestamp-suffixed)
}
config/validate
Validate a configuration object against the schema with optional auto-fix.
Input: {
config: Record<string, unknown> // Configuration to validate
strict: boolean // Fail on unknown fields (default: true)
fixIssues: boolean // Auto-fix issues (default: false)
}
Output: {
valid: boolean,
issues: ValidationIssue[],
fixed?: boolean,
fixedConfig?: Configuration
}
Configuration Schema
The full configuration covers seven sections:
agents
{
maxConcurrent: number, // 1-1000, default: 15
defaultPriority: "low" | "normal" | "high" | "critical",
timeout: number, // >= 1000ms, default: 300000
retryAttempts: number // default: 3
}
swarm
{
topology: "hierarchical" | "mesh" | "adaptive" | "collective" | "hierarchical-mesh",
maxAgents: number, // 1-1000, default: 15
communicationProtocol: "direct" | "message-bus" | "pubsub",
consensusMechanism: "majority" | "unanimous" | "weighted" | "none"
}
memory
{
backend: "agentdb" | "sqlite" | "hybrid",
maxSize: number, // default: 1000000
cacheEnabled: boolean, // default: true
cacheTTL: number, // default: 300000
vectorDimensions: number // 1-4096, default: 1536
}
mcp
{
transport: "stdio" | "http" | "websocket" | "in-process",
host: string, // default: localhost
port: number, // default: 3000
enableMetrics: boolean, // default: true
enableCaching: boolean // default: true
}
performance
{
flashAttention: boolean, // default: true
gnnEnhanced: boolean, // default: true
quantization: boolean, // default: false
optimization: "speed" | "memory" | "balanced"
}
security
{
enableAuth: boolean, // default: false
strictMode: boolean, // default: true
validateInputs: boolean, // default: true
rateLimiting: boolean // default: true
}
logging
{
level: "debug" | "info" | "warn" | "error",
format: "json" | "text",
destination: "console" | "file" | "both"
}
Path Traversal Protection
The validateConfigPath() function prevents path traversal attacks:
- Normalizes path to resolve
..and. - Blocks absolute paths (starting with
/or\) - Rejects paths containing
.. - Only allows
.jsonand.config.*file extensions - Resolves to absolute path within CWD and verifies containment
Validation Rules
agents.maxConcurrent: Must be 1-1000 (severity: error)agents.timeout: Should be >= 1000ms (severity: warning)swarm.maxAgents: Must be 1-1000 (severity: error)memory.vectorDimensions: Must be 1-4096 (severity: error)
Each issue includes field path, description, severity (error/warning/info), and a suggestion string.
Default Configuration
The default config file is ./claude-flow.config.json. Defaults use:
- Hierarchical-mesh topology with 15 max agents
- Hybrid memory backend with 1536-dimension vectors
- stdio MCP transport on localhost:3000
- Flash attention and GNN enhancement enabled
- JSON logging to console at info level