fix: correct claude-flow init configuration placement (fixes #276)

- Move mcpServers from ~/.claude/settings.json to project-scoped .mcp.json
- Add enabledMcpjsonServers to settings.json for proper MCP authorization
- Move features and performance settings to claude-flow.config.json
- Update templates, help text, and gitignore for new file structure
- Fix Claude Code startup errors and enable MCP server functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
rUvandClaude committed 2025-07-15 14:44:42 +00:00
1 parent 8ff7ae9dd8
commit 4265b95f3e
5 files changed
+50 -75

No files matched your search

@@ -11,7 +11,8 @@ import { existsSync, readTextFile, writeTextFile } from '../../node-compat.js';
const CLAUDE_FLOW_GITIGNORE_ENTRIES = `
# Claude Flow generated files
.claude/settings.local.json
.claude/mcp.json
.mcp.json
claude-flow.config.json
.swarm/
.hive-mind/
memory/claude-flow-data.json
+3 -2
View File
@@ -58,9 +58,10 @@ export function showInitHelp() {
console.log(' claude-flow init --list-backups # Show available backups');
console.log();
console.log('What gets created:');
console.log(' • .claude/settings.json - Global configuration with hooks and features');
console.log(' • .claude/settings.json - Claude Code configuration with hooks');
console.log(' • .claude/settings.local.json - Pre-approved MCP permissions (no prompts!)');
console.log(' • .claude/mcp.json - MCP server configuration for easy setup');
console.log(' • .mcp.json - Project-scoped MCP server configuration');
console.log(' • claude-flow.config.json - Claude Flow features and performance settings');
console.log(' • .claude/commands/ directory with 20+ Claude Code slash commands');
console.log(' • CLAUDE.md with project instructions (v2.0.0 enhanced by default)');
console.log(' • memory/ directory for persistent context storage');
+36 -7
View File
@@ -988,7 +988,7 @@ async function enhancedClaudeFlowInit(flags, subArgs = []) {
try {
// Check existing files
const existingFiles = [];
const filesToCheck = ['CLAUDE.md', '.claude/settings.json'];
const filesToCheck = ['CLAUDE.md', '.claude/settings.json', '.mcp.json', 'claude-flow.config.json'];
for (const file of filesToCheck) {
if (existsSync(`${workingDir}/${file}`)) {
@@ -1047,7 +1047,7 @@ async function enhancedClaudeFlowInit(flags, subArgs = []) {
console.log('[DRY RUN] Would create .claude/settings.local.json with default MCP permissions');
}
// Create mcp.json for easy MCP server configuration
// Create .mcp.json at project root for MCP server configuration
const mcpConfig = {
"mcpServers": {
"claude-flow": {
@@ -1064,10 +1064,39 @@ async function enhancedClaudeFlowInit(flags, subArgs = []) {
};
if (!dryRun) {
await Deno.writeTextFile(`${claudeDir}/mcp.json`, JSON.stringify(mcpConfig, null, 2));
printSuccess('✓ Created .claude/mcp.json for MCP server configuration');
await Deno.writeTextFile(`${workingDir}/.mcp.json`, JSON.stringify(mcpConfig, null, 2));
printSuccess('✓ Created .mcp.json at project root for MCP server configuration');
} else {
console.log('[DRY RUN] Would create .claude/mcp.json for MCP server configuration');
console.log('[DRY RUN] Would create .mcp.json at project root for MCP server configuration');
}
// Create claude-flow.config.json for Claude Flow specific settings
const claudeFlowConfig = {
"features": {
"autoTopologySelection": true,
"parallelExecution": true,
"neuralTraining": true,
"bottleneckAnalysis": true,
"smartAutoSpawning": true,
"selfHealingWorkflows": true,
"crossSessionMemory": true,
"githubIntegration": true
},
"performance": {
"maxAgents": 10,
"defaultTopology": "hierarchical",
"executionStrategy": "parallel",
"tokenOptimization": true,
"cacheEnabled": true,
"telemetryLevel": "detailed"
}
};
if (!dryRun) {
await Deno.writeTextFile(`${workingDir}/claude-flow.config.json`, JSON.stringify(claudeFlowConfig, null, 2));
printSuccess('✓ Created claude-flow.config.json for Claude Flow settings');
} else {
console.log('[DRY RUN] Would create claude-flow.config.json for Claude Flow settings');
}
// Create command documentation
@@ -1214,7 +1243,7 @@ ${commands.map(cmd => `- [${cmd}](./${cmd}.md)`).join('\n')}
console.log('\n 📋 To add MCP servers manually:');
console.log(' claude mcp add claude-flow npx claude-flow@alpha mcp start');
console.log(' claude mcp add ruv-swarm npx ruv-swarm@latest mcp start');
console.log('\n 💡 Or copy .claude/mcp.json to your Claude Desktop config directory');
console.log('\n 💡 MCP servers are defined in .mcp.json (project scope)');
}
} else if (!dryRun && !isClaudeCodeInstalled()) {
console.log('\n⚠️ Claude Code CLI not detected!');
@@ -1223,7 +1252,7 @@ ${commands.map(cmd => `- [${cmd}](./${cmd}.md)`).join('\n')}
console.log('\n 📋 After installing, add MCP servers:');
console.log(' claude mcp add claude-flow npx claude-flow@alpha mcp start');
console.log(' claude mcp add ruv-swarm npx ruv-swarm@latest mcp start');
console.log('\n 💡 Or copy .claude/mcp.json to your Claude Desktop config directory');
console.log('\n 💡 MCP servers are defined in .mcp.json (project scope)');
}
// Final instructions
@@ -1259,6 +1259,10 @@ function createEnhancedSettingsJsonFallback() {
"Bash(eval *)"
]
},
enabledMcpjsonServers: [
"claude-flow",
"ruv-swarm"
],
hooks: {
PreToolUse: [
{
@@ -1311,36 +1315,6 @@ function createEnhancedSettingsJsonFallback() {
}
]
},
mcpServers: {
"claude-flow": {
command: "npx",
args: ["claude-flow", "mcp", "start"],
env: {
CLAUDE_FLOW_HOOKS_ENABLED: "true",
CLAUDE_FLOW_TELEMETRY_ENABLED: "true",
CLAUDE_FLOW_REMOTE_READY: "true",
CLAUDE_FLOW_GITHUB_INTEGRATION: "true"
}
}
},
includeCoAuthoredBy: true,
features: {
autoTopologySelection: true,
parallelExecution: true,
neuralTraining: true,
bottleneckAnalysis: true,
smartAutoSpawning: true,
selfHealingWorkflows: true,
crossSessionMemory: true,
githubIntegration: true
},
performance: {
maxAgents: 10,
defaultTopology: "hierarchical",
executionStrategy: "parallel",
tokenOptimization: true,
cacheEnabled: true,
telemetryLevel: "detailed"
}
includeCoAuthoredBy: true
}, null, 2);
}
@@ -85,39 +85,9 @@
}
]
},
"mcpServers": {
"claude-flow": {
"command": "npx",
"args": [
"claude-flow",
"mcp",
"start"
],
"env": {
"CLAUDE_FLOW_HOOKS_ENABLED": "true",
"CLAUDE_FLOW_TELEMETRY_ENABLED": "true",
"CLAUDE_FLOW_REMOTE_READY": "true",
"CLAUDE_FLOW_GITHUB_INTEGRATION": "true"
}
}
},
"includeCoAuthoredBy": true,
"features": {
"autoTopologySelection": true,
"parallelExecution": true,
"neuralTraining": true,
"bottleneckAnalysis": true,
"smartAutoSpawning": true,
"selfHealingWorkflows": true,
"crossSessionMemory": true,
"githubIntegration": true
},
"performance": {
"maxAgents": 10,
"defaultTopology": "hierarchical",
"executionStrategy": "parallel",
"tokenOptimization": true,
"cacheEnabled": true,
"telemetryLevel": "detailed"
}
"enabledMcpjsonServers": [
"claude-flow",
"ruv-swarm"
]
}