claudepod 1.0.2 โ 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/config/claude/mcp.json +77 -0
- package/.devcontainer/config/claude/mcp.json.backup +77 -0
- package/.devcontainer/config/claude/mcp.json.template +118 -0
- package/.devcontainer/config/claude/output-styles/strict-development.md +158 -0
- package/.devcontainer/config/claude/settings.json +4 -173
- package/.devcontainer/config/claude/system-prompt.md +3 -0
- package/.devcontainer/config/searxng/ods_config.json +16 -0
- package/.devcontainer/config/searxng/searxng_env_template +71 -0
- package/.devcontainer/config/serena/serena_config.yml +72 -0
- package/.devcontainer/config/taskmaster/config.json +37 -0
- package/.devcontainer/devcontainer.json +5 -2
- package/.devcontainer/ods_config.json +21 -0
- package/.devcontainer/post-create.sh +832 -155
- package/.devcontainer/post-start.sh +368 -187
- package/.devcontainer/sanitize-system-prompt.sh +31 -0
- package/.devcontainer/scripts/config/claude-core.sh +210 -0
- package/.devcontainer/scripts/config/searxng.sh +252 -0
- package/.devcontainer/scripts/config/serena.sh +47 -0
- package/.devcontainer/scripts/config/taskmaster.sh +41 -0
- package/.devcontainer/scripts/generate-mcp-config.js +205 -0
- package/.devcontainer/scripts/install/claude-code.sh +112 -0
- package/.devcontainer/scripts/shell/zsh-config.sh +271 -0
- package/.devcontainer/scripts/utils.sh +44 -0
- package/.devcontainer/setup-zsh.sh +51 -202
- package/LICENSE.txt +674 -0
- package/README.md +172 -117
- package/package.json +17 -7
|
@@ -8,26 +8,8 @@ echo "๐ Starting ClaudePod MCP server setup..."
|
|
|
8
8
|
|
|
9
9
|
# Initial NVM setup will be handled in main() to avoid conflicts
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
local max_attempts=${1:-3}
|
|
14
|
-
local delay=${2:-5}
|
|
15
|
-
shift 2
|
|
16
|
-
local attempt=1
|
|
17
|
-
|
|
18
|
-
while [ $attempt -le $max_attempts ]; do
|
|
19
|
-
if "$@"; then
|
|
20
|
-
return 0
|
|
21
|
-
fi
|
|
22
|
-
echo "โ ๏ธ Command failed (attempt $attempt/$max_attempts): $*"
|
|
23
|
-
if [ $attempt -lt $max_attempts ]; then
|
|
24
|
-
echo " Retrying in ${delay}s..."
|
|
25
|
-
sleep $delay
|
|
26
|
-
fi
|
|
27
|
-
((attempt++))
|
|
28
|
-
done
|
|
29
|
-
return 1
|
|
30
|
-
}
|
|
11
|
+
# Source shared utility functions
|
|
12
|
+
source "/workspace/.devcontainer/scripts/utils.sh"
|
|
31
13
|
|
|
32
14
|
# Function to install uv via pipx
|
|
33
15
|
install_uv() {
|
|
@@ -82,177 +64,284 @@ install_uv() {
|
|
|
82
64
|
fi
|
|
83
65
|
}
|
|
84
66
|
|
|
85
|
-
# Function to
|
|
86
|
-
|
|
87
|
-
echo "
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if [ -
|
|
93
|
-
echo "
|
|
94
|
-
|
|
95
|
-
echo " Removing $server..."
|
|
96
|
-
claude mcp remove "$server" 2>/dev/null || true
|
|
97
|
-
fi
|
|
98
|
-
done
|
|
99
|
-
echo "โ
Cleanup complete"
|
|
100
|
-
else
|
|
101
|
-
echo "โ
No existing servers to clean up"
|
|
67
|
+
# Function to validate MCP configuration
|
|
68
|
+
validate_mcp_configuration() {
|
|
69
|
+
echo "๐ Validating MCP configuration..."
|
|
70
|
+
|
|
71
|
+
local mcp_config="/workspace/.devcontainer/config/claude/mcp.json"
|
|
72
|
+
|
|
73
|
+
# Check if file exists
|
|
74
|
+
if [ ! -f "$mcp_config" ]; then
|
|
75
|
+
echo "โ ๏ธ MCP configuration file not found at $mcp_config"
|
|
76
|
+
return 1
|
|
102
77
|
fi
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
# Function to install MCP servers
|
|
106
|
-
install_mcp_servers() {
|
|
107
|
-
echo "๐ฆ Installing core MCP servers..."
|
|
108
78
|
|
|
109
|
-
|
|
110
|
-
|
|
79
|
+
# Basic JSON validation
|
|
80
|
+
if ! node -e "JSON.parse(require('fs').readFileSync('$mcp_config', 'utf8'))" 2>/dev/null; then
|
|
81
|
+
echo "โ MCP configuration is not valid JSON"
|
|
82
|
+
# Restore from backup if available
|
|
83
|
+
if [ -f "${mcp_config}.backup" ]; then
|
|
84
|
+
echo "๐ฆ Restoring from backup..."
|
|
85
|
+
cp "${mcp_config}.backup" "$mcp_config"
|
|
86
|
+
fi
|
|
87
|
+
return 1
|
|
88
|
+
fi
|
|
111
89
|
|
|
112
|
-
#
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
((servers_failed++))
|
|
90
|
+
# Test if Claude can read the configuration (if Claude is available)
|
|
91
|
+
if command -v claude &> /dev/null; then
|
|
92
|
+
echo "๐งช Testing Claude MCP integration..."
|
|
93
|
+
if timeout 10 claude --mcp-config "$mcp_config" --print "test" &>/dev/null; then
|
|
94
|
+
echo "โ
Claude MCP configuration valid"
|
|
95
|
+
else
|
|
96
|
+
echo "โ ๏ธ Claude cannot load MCP configuration (authentication may be needed)"
|
|
97
|
+
fi
|
|
121
98
|
fi
|
|
122
99
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
100
|
+
echo "โ
MCP configuration validation completed"
|
|
101
|
+
return 0
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# Function to verify MCP configuration
|
|
105
|
+
verify_mcp_config() {
|
|
106
|
+
echo "๐ฆ Verifying MCP server configuration..."
|
|
107
|
+
|
|
108
|
+
# Check if MCP configuration file exists
|
|
109
|
+
local mcp_config="/workspace/.claude/mcp.json"
|
|
110
|
+
if [ ! -f "$mcp_config" ]; then
|
|
111
|
+
echo "โ ๏ธ MCP configuration file not found at $mcp_config"
|
|
112
|
+
echo " This should have been copied during post-create phase"
|
|
113
|
+
return 1
|
|
132
114
|
fi
|
|
133
115
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
116
|
+
echo "โ
MCP configuration file found"
|
|
117
|
+
|
|
118
|
+
# Verify Docker is available for GitHub MCP server
|
|
119
|
+
if [ -n "$GITHUB_PERSONAL_ACCESS_TOKEN" ] && command -v docker &> /dev/null; then
|
|
120
|
+
echo "๐ณ Pre-pulling GitHub MCP server Docker image..."
|
|
121
|
+
if docker pull ghcr.io/github/github-mcp-server:latest; then
|
|
122
|
+
echo "โ
GitHub MCP server image ready"
|
|
141
123
|
else
|
|
142
|
-
echo "โ ๏ธ
|
|
143
|
-
((servers_failed++))
|
|
124
|
+
echo "โ ๏ธ Failed to pull GitHub MCP server Docker image"
|
|
144
125
|
fi
|
|
145
|
-
else
|
|
146
|
-
echo ""
|
|
147
|
-
echo "โน๏ธ Skipping Tavily Search MCP server (no TAVILY_API_KEY set)"
|
|
148
126
|
fi
|
|
149
127
|
|
|
150
|
-
#
|
|
151
|
-
if [
|
|
152
|
-
echo ""
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
128
|
+
# Verify and setup SearXNG MCP server files when enabled (including container rebuilds)
|
|
129
|
+
if [ "${ENABLE_SEARXNG_ENHANCED_MCP:-true}" = "true" ]; then
|
|
130
|
+
echo "๐ Verifying SearXNG MCP server installation..."
|
|
131
|
+
local searxng_server="/usr/local/mcp-servers/searxng/mcp_server.py"
|
|
132
|
+
local searxng_config="/home/node/.claude/ods_config.json"
|
|
133
|
+
local config_template="/workspace/.devcontainer/config/searxng/ods_config.json"
|
|
134
|
+
|
|
135
|
+
if [ -f "$searxng_server" ]; then
|
|
136
|
+
echo "โ
SearXNG MCP server files found"
|
|
137
|
+
|
|
138
|
+
# Handle configuration during container rebuilds with existence check
|
|
139
|
+
if [ -f "$searxng_config" ]; then
|
|
140
|
+
echo "โ
SearXNG configuration file ready"
|
|
141
|
+
else
|
|
142
|
+
echo "๐ SearXNG configuration not found, copying from template..."
|
|
143
|
+
|
|
144
|
+
# Source searxng script to get setup functions
|
|
145
|
+
if [ -f "/workspace/.devcontainer/scripts/config/searxng.sh" ]; then
|
|
146
|
+
source "/workspace/.devcontainer/scripts/config/searxng.sh"
|
|
147
|
+
|
|
148
|
+
# Call configuration setup function
|
|
149
|
+
setup_searxng_config || {
|
|
150
|
+
echo "โ ๏ธ Failed to setup SearXNG configuration during container rebuild"
|
|
151
|
+
echo " You can manually copy with: cp $config_template $searxng_config"
|
|
152
|
+
}
|
|
153
|
+
else
|
|
154
|
+
echo "โ ๏ธ SearXNG setup script not found, performing basic copy..."
|
|
155
|
+
|
|
156
|
+
# Ensure Claude directory exists
|
|
157
|
+
mkdir -p "/home/node/.claude"
|
|
158
|
+
|
|
159
|
+
# Copy configuration file if template exists
|
|
160
|
+
if [ -f "$config_template" ]; then
|
|
161
|
+
cp "$config_template" "$searxng_config"
|
|
162
|
+
chown node:node "$searxng_config"
|
|
163
|
+
chmod 600 "$searxng_config"
|
|
164
|
+
echo "๐ SearXNG configuration copied from template"
|
|
165
|
+
else
|
|
166
|
+
echo "โ ๏ธ SearXNG configuration template not found at $config_template"
|
|
167
|
+
fi
|
|
168
|
+
fi
|
|
169
|
+
fi
|
|
157
170
|
else
|
|
158
|
-
echo "
|
|
159
|
-
|
|
171
|
+
echo "โ SearXNG MCP server not found at $searxng_server"
|
|
172
|
+
echo " Installation may have failed during post-create phase"
|
|
173
|
+
echo " Try running: bash /workspace/.devcontainer/scripts/config/searxng.sh"
|
|
160
174
|
fi
|
|
161
|
-
else
|
|
162
|
-
echo ""
|
|
163
|
-
echo "โน๏ธ Skipping Ref.Tools MCP server (no REF_TOOLS_API_KEY set)"
|
|
164
175
|
fi
|
|
165
176
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
return 0
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
# Function to validate environment variables and provide feedback
|
|
181
|
+
validate_environment_variables() {
|
|
182
|
+
echo "๐ Validating environment configuration..."
|
|
183
|
+
|
|
184
|
+
local missing_keys=()
|
|
185
|
+
local optional_keys=()
|
|
186
|
+
|
|
187
|
+
# Check optional API keys and track status
|
|
188
|
+
if [ "${ENABLE_TAVILY_MCP:-false}" = "true" ]; then
|
|
189
|
+
if [ -z "$TAVILY_API_KEY" ]; then
|
|
190
|
+
missing_keys+=("TAVILY_API_KEY")
|
|
191
|
+
fi
|
|
175
192
|
fi
|
|
176
193
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
echo "โ
Sequential Thinking MCP server installed"
|
|
182
|
-
((servers_installed++))
|
|
183
|
-
else
|
|
184
|
-
echo "โ ๏ธ Sequential Thinking MCP server installation failed"
|
|
185
|
-
((servers_failed++))
|
|
194
|
+
if [ "${ENABLE_REF_TOOLS_MCP:-false}" = "true" ]; then
|
|
195
|
+
if [ -z "$REF_TOOLS_API_KEY" ]; then
|
|
196
|
+
missing_keys+=("REF_TOOLS_API_KEY")
|
|
197
|
+
fi
|
|
186
198
|
fi
|
|
187
199
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
200
|
+
if [ "${ENABLE_GITHUB_MCP:-false}" = "true" ]; then
|
|
201
|
+
if [ -z "$GITHUB_PERSONAL_ACCESS_TOKEN" ]; then
|
|
202
|
+
missing_keys+=("GITHUB_PERSONAL_ACCESS_TOKEN")
|
|
203
|
+
fi
|
|
204
|
+
fi
|
|
205
|
+
|
|
206
|
+
# Report validation results
|
|
207
|
+
if [ ${#missing_keys[@]} -eq 0 ]; then
|
|
208
|
+
echo "โ
All required environment variables configured"
|
|
194
209
|
else
|
|
195
|
-
echo "โ ๏ธ
|
|
196
|
-
|
|
210
|
+
echo "โ ๏ธ Missing API keys for enabled services:"
|
|
211
|
+
for key in "${missing_keys[@]}"; do
|
|
212
|
+
echo " โข $key"
|
|
213
|
+
done
|
|
214
|
+
echo " ๐ Add missing keys to .devcontainer/.env or disable services"
|
|
197
215
|
fi
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
# Function to display startup status summary
|
|
219
|
+
display_startup_status() {
|
|
220
|
+
echo ""
|
|
221
|
+
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
222
|
+
echo "โ ๐ ClaudePod Status Summary โ"
|
|
223
|
+
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
198
224
|
|
|
199
|
-
#
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
225
|
+
# Core tools status
|
|
226
|
+
echo ""
|
|
227
|
+
echo "๐ ๏ธ Core Tools:"
|
|
228
|
+
local claude_version=$(claude --version 2>/dev/null || echo "Not available")
|
|
229
|
+
echo " Claude Code: $claude_version"
|
|
230
|
+
|
|
231
|
+
local ccusage_version=$(ccusage --version 2>/dev/null || echo "Not available")
|
|
232
|
+
echo " ccusage: $ccusage_version"
|
|
233
|
+
|
|
234
|
+
# Check Node.js with proper environment sourcing
|
|
235
|
+
local node_version="Not available"
|
|
236
|
+
if command -v node &>/dev/null; then
|
|
237
|
+
node_version=$(node --version 2>/dev/null || echo "Not available")
|
|
238
|
+
elif [ -s "/usr/local/share/nvm/nvm.sh" ]; then
|
|
239
|
+
# Try sourcing NVM if Node.js not found in PATH (permissions should now be fixed)
|
|
240
|
+
if source "/usr/local/share/nvm/nvm.sh"; then
|
|
241
|
+
if command -v node &>/dev/null; then
|
|
242
|
+
node_version=$(node --version 2>/dev/null || echo "Not available")
|
|
216
243
|
fi
|
|
217
244
|
else
|
|
218
|
-
|
|
219
|
-
((servers_failed++))
|
|
220
|
-
fi
|
|
221
|
-
else
|
|
222
|
-
echo ""
|
|
223
|
-
if [ -z "$GITHUB_PERSONAL_ACCESS_TOKEN" ]; then
|
|
224
|
-
echo "โน๏ธ Skipping GitHub MCP server (no GITHUB_PERSONAL_ACCESS_TOKEN set)"
|
|
225
|
-
elif ! command -v docker &> /dev/null; then
|
|
226
|
-
echo "โน๏ธ Skipping GitHub MCP server (Docker not available)"
|
|
245
|
+
node_version="NVM sourcing failed"
|
|
227
246
|
fi
|
|
228
247
|
fi
|
|
248
|
+
echo " Node.js: $node_version"
|
|
249
|
+
|
|
250
|
+
local uvx_status=$(command -v uvx &>/dev/null && echo "Available" || echo "Not available")
|
|
251
|
+
echo " uvx: $uvx_status"
|
|
229
252
|
|
|
253
|
+
# MCP servers status
|
|
254
|
+
echo ""
|
|
255
|
+
echo "๐ MCP Servers:"
|
|
256
|
+
local enabled_count=0
|
|
257
|
+
local disabled_count=0
|
|
258
|
+
|
|
259
|
+
# Core servers (enabled by default)
|
|
260
|
+
# for server in "serena:ENABLE_SERENA_MCP:semantic code analysis" \
|
|
261
|
+
# "deepwiki:ENABLE_DEEPWIKI_MCP:documentation search" \
|
|
262
|
+
# "taskmaster:ENABLE_TASKMASTER_MCP:project management" \
|
|
263
|
+
# "sequential-thinking:ENABLE_SEQUENTIAL_THINKING_MCP:structured analysis" \
|
|
264
|
+
# "ccusage:ENABLE_CCUSAGE_MCP:usage analytics"; do
|
|
265
|
+
# IFS=':' read -r name var desc <<< "$server"
|
|
266
|
+
# if [ "${!var:-true}" = "true" ]; then
|
|
267
|
+
# echo " โ
$name ($desc)"
|
|
268
|
+
# ((enabled_count++))
|
|
269
|
+
# else
|
|
270
|
+
# echo " โ $name (disabled)"
|
|
271
|
+
# ((disabled_count++))
|
|
272
|
+
# fi
|
|
273
|
+
# done
|
|
274
|
+
|
|
275
|
+
# Optional servers (require API keys)
|
|
276
|
+
# for server in "tavily:ENABLE_TAVILY_MCP:TAVILY_API_KEY:web search" \
|
|
277
|
+
# "ref-tools:ENABLE_REF_TOOLS_MCP:REF_TOOLS_API_KEY:reference docs" \
|
|
278
|
+
# "github:ENABLE_GITHUB_MCP:GITHUB_PERSONAL_ACCESS_TOKEN:repository integration"; do
|
|
279
|
+
# IFS=':' read -r name var key desc <<< "$server"
|
|
280
|
+
# if [ "${!var:-false}" = "true" ] && [ -n "${!key}" ]; then
|
|
281
|
+
# echo " โ
$name ($desc)"
|
|
282
|
+
# ((enabled_count++))
|
|
283
|
+
# elif [ "${!var:-false}" = "true" ]; then
|
|
284
|
+
# echo " โ ๏ธ $name (missing $key)"
|
|
285
|
+
# ((disabled_count++))
|
|
286
|
+
# else
|
|
287
|
+
# echo " โ $name (disabled)"
|
|
288
|
+
# ((disabled_count++))
|
|
289
|
+
# fi
|
|
290
|
+
# done
|
|
291
|
+
|
|
292
|
+
# Shell shortcuts
|
|
293
|
+
echo ""
|
|
294
|
+
echo "โจ๏ธ Shell Shortcuts:"
|
|
295
|
+
echo " gs (git status) gd (git diff) gc (git commit)"
|
|
296
|
+
echo " gp (git push) gl (git log) ll (list files)"
|
|
297
|
+
|
|
298
|
+
# Summary and next steps
|
|
299
|
+
echo ""
|
|
300
|
+
echo "๐ Summary: $enabled_count servers enabled, $disabled_count disabled"
|
|
301
|
+
echo ""
|
|
302
|
+
echo "๐ Ready to start:"
|
|
303
|
+
echo " claude # Start Claude Code with MCP servers"
|
|
304
|
+
echo " claude mcp list # Verify MCP server connectivity"
|
|
305
|
+
echo " ccusage # View usage analytics"
|
|
306
|
+
|
|
307
|
+
# Add SearXNG info if it exists
|
|
308
|
+
local searxng_local_dir="${SEARXNG_LOCAL_INSTALL_DIR:-/opt/searxng-local}"
|
|
309
|
+
if [ "${ENABLE_SEARXNG_LOCAL:-true}" = "true" ] && [ -d "$searxng_local_dir" ] && [ -f "$searxng_local_dir/docker-compose.yaml" ]; then
|
|
310
|
+
echo ""
|
|
311
|
+
echo "๐ Local SearXNG Instance:"
|
|
312
|
+
echo " http://localhost:8080 # SearXNG web interface"
|
|
313
|
+
echo " MCP server configured for zero rate limiting"
|
|
314
|
+
echo " Location: $searxng_local_dir (persistent volume)"
|
|
315
|
+
fi
|
|
230
316
|
echo ""
|
|
231
317
|
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
# Function to start local SearXNG containers if configured
|
|
321
|
+
start_local_searxng() {
|
|
322
|
+
# Check if SearXNG local instance is enabled
|
|
323
|
+
if [ "${ENABLE_SEARXNG_LOCAL:-true}" != "true" ]; then
|
|
324
|
+
echo " โน๏ธ SearXNG local instance is disabled (using public instances)"
|
|
325
|
+
return 0
|
|
326
|
+
fi
|
|
327
|
+
|
|
328
|
+
# Source the searxng configuration functions
|
|
329
|
+
source "/workspace/.devcontainer/scripts/config/searxng.sh"
|
|
236
330
|
|
|
237
|
-
#
|
|
238
|
-
|
|
331
|
+
# Use the new function to start the persistent local instance
|
|
332
|
+
start_searxng_local_instance
|
|
239
333
|
}
|
|
240
334
|
|
|
241
335
|
# Function to display completion message
|
|
242
336
|
display_completion_message() {
|
|
337
|
+
# Validate environment first
|
|
338
|
+
validate_environment_variables
|
|
339
|
+
|
|
243
340
|
echo ""
|
|
244
|
-
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
245
341
|
echo "โ
ClaudePod Phase 3 MCP setup complete!"
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
claude mcp list 2>/dev/null || echo " Run 'claude mcp list' to see installed servers"
|
|
250
|
-
echo ""
|
|
251
|
-
echo "๐ก Tips:"
|
|
252
|
-
echo " - Use 'claude' to start working with MCP servers"
|
|
253
|
-
echo " - Add API keys to enable additional servers"
|
|
254
|
-
echo " - Check 'claude mcp list' to verify installations"
|
|
255
|
-
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
342
|
+
|
|
343
|
+
# Display comprehensive startup status
|
|
344
|
+
display_startup_status
|
|
256
345
|
}
|
|
257
346
|
|
|
258
347
|
# Main execution
|
|
@@ -261,47 +350,97 @@ main() {
|
|
|
261
350
|
echo "๐ณ ClaudePod Post-Start Setup - Phase 3: MCP Servers"
|
|
262
351
|
echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
|
|
263
352
|
|
|
264
|
-
#
|
|
353
|
+
# Ensure .claude directory exists and preserve optimized settings
|
|
265
354
|
echo "๐ง Configuring Claude Code settings..."
|
|
266
355
|
mkdir -p /workspace/.claude
|
|
267
|
-
|
|
356
|
+
|
|
357
|
+
# Only create basic settings if optimized settings don't exist
|
|
358
|
+
if [ ! -f "/workspace/.claude/settings.json" ]; then
|
|
359
|
+
echo " Creating basic Claude settings..."
|
|
360
|
+
cat > /workspace/.claude/settings.json << 'EOF'
|
|
268
361
|
{
|
|
269
362
|
"includeCoAuthoredBy": false,
|
|
270
363
|
"model": "claude-sonnet-4-0",
|
|
271
364
|
"forceLoginMethod": "claudeai"
|
|
272
365
|
}
|
|
273
366
|
EOF
|
|
367
|
+
echo " โน๏ธ Basic settings created (optimized settings not found)"
|
|
368
|
+
else
|
|
369
|
+
# Check if settings contain the optimized permissions
|
|
370
|
+
if grep -q '"permissions"' "/workspace/.claude/settings.json" 2>/dev/null; then
|
|
371
|
+
local allowed_count=$(grep -o '"allow"' "/workspace/.claude/settings.json" | wc -l)
|
|
372
|
+
local denied_count=$(grep -o '"deny"' "/workspace/.claude/settings.json" | wc -l)
|
|
373
|
+
echo " โ
Preserving optimized Claude settings (permissions configured)"
|
|
374
|
+
else
|
|
375
|
+
echo " โ ๏ธ Existing settings found but no optimized permissions detected"
|
|
376
|
+
fi
|
|
377
|
+
fi
|
|
378
|
+
|
|
274
379
|
echo "โ
Claude Code settings configured"
|
|
275
380
|
|
|
276
|
-
#
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
381
|
+
# Ensure Serena configuration exists and preserve optimized settings
|
|
382
|
+
echo "๐ง Configuring Serena settings..."
|
|
383
|
+
mkdir -p /workspace/.serena
|
|
384
|
+
|
|
385
|
+
if [ ! -f "/workspace/.serena/serena_config.yml" ]; then
|
|
386
|
+
echo " โน๏ธ No existing Serena configuration found (will use defaults)"
|
|
387
|
+
else
|
|
388
|
+
echo " โ
Preserving existing Serena configuration"
|
|
283
389
|
fi
|
|
284
390
|
|
|
285
|
-
#
|
|
286
|
-
echo "๐ง
|
|
391
|
+
# Ensure TaskMaster configuration exists and preserve optimized settings
|
|
392
|
+
echo "๐ง Configuring TaskMaster settings..."
|
|
393
|
+
mkdir -p /workspace/.taskmaster
|
|
287
394
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
395
|
+
if [ ! -f "/workspace/.taskmaster/config.json" ]; then
|
|
396
|
+
echo " โน๏ธ No existing TaskMaster configuration found (will use defaults)"
|
|
397
|
+
else
|
|
398
|
+
# Check if settings contain the optimized model configuration
|
|
399
|
+
if grep -q '"claude-code"' "/workspace/.taskmaster/config.json" 2>/dev/null; then
|
|
400
|
+
echo " โ
Preserving optimized TaskMaster configuration (Claude Code integration)"
|
|
401
|
+
else
|
|
402
|
+
echo " โ ๏ธ Existing TaskMaster configuration found but no Claude Code integration detected"
|
|
403
|
+
fi
|
|
291
404
|
fi
|
|
292
405
|
|
|
293
|
-
|
|
294
|
-
if [ -f "/home/node/.npmrc" ]; then
|
|
295
|
-
mv "/home/node/.npmrc" "/home/node/.npmrc.bak"
|
|
296
|
-
fi
|
|
406
|
+
echo "โ
MCP configurations ready"
|
|
297
407
|
|
|
298
|
-
#
|
|
299
|
-
|
|
300
|
-
|
|
408
|
+
# Environment variables already loaded in post-create.sh
|
|
409
|
+
# Set environment for proper Node.js and Claude Code operation
|
|
410
|
+
echo "๐ง Configuring Node.js environment..."
|
|
301
411
|
|
|
302
|
-
#
|
|
303
|
-
|
|
304
|
-
|
|
412
|
+
# Source NVM to make Node.js and npm available (needed for MCP config generation)
|
|
413
|
+
export NVM_DIR="/usr/local/share/nvm"
|
|
414
|
+
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
|
415
|
+
echo "๐ง Sourcing NVM in post-start..."
|
|
416
|
+
. "$NVM_DIR/nvm.sh"
|
|
417
|
+
|
|
418
|
+
# Handle potential npm prefix conflicts with NVM
|
|
419
|
+
if command -v nvm &> /dev/null && command -v node &> /dev/null; then
|
|
420
|
+
echo "๐ง Checking NVM/npm prefix conflicts..."
|
|
421
|
+
# Only run nvm use if there's actually a prefix conflict, not just because Node.js exists
|
|
422
|
+
local current_prefix=$(npm config get prefix 2>/dev/null || echo "")
|
|
423
|
+
local expected_prefix="/home/node/.local"
|
|
424
|
+
|
|
425
|
+
if [ -n "$current_prefix" ] && [ "$current_prefix" != "$expected_prefix" ]; then
|
|
426
|
+
echo "๐ง Resolving npm prefix conflict by removing conflicting settings"
|
|
427
|
+
# Remove prefix settings that conflict with NVM instead of setting them
|
|
428
|
+
npm config delete prefix 2>/dev/null || true
|
|
429
|
+
npm config delete globalconfig 2>/dev/null || true
|
|
430
|
+
echo "โ
Removed conflicting npm prefix settings for NVM compatibility"
|
|
431
|
+
else
|
|
432
|
+
echo "โ
NVM/npm prefix already correct"
|
|
433
|
+
fi
|
|
434
|
+
fi
|
|
435
|
+
|
|
436
|
+
# Verify Node.js is now available
|
|
437
|
+
if command -v node &> /dev/null; then
|
|
438
|
+
echo "โ
Node.js available for MCP generation: $(node --version)"
|
|
439
|
+
else
|
|
440
|
+
echo "โ ๏ธ Node.js still not available after sourcing NVM"
|
|
441
|
+
fi
|
|
442
|
+
else
|
|
443
|
+
echo "โ ๏ธ NVM not found at $NVM_DIR/nvm.sh"
|
|
305
444
|
fi
|
|
306
445
|
|
|
307
446
|
# Set PATH and HOME for proper Claude Code operation
|
|
@@ -311,6 +450,46 @@ EOF
|
|
|
311
450
|
# Ensure proper ownership of .local directory
|
|
312
451
|
chown -R node:node /home/node/.local 2>/dev/null || true
|
|
313
452
|
|
|
453
|
+
# CRITICAL: Re-load environment variables from .devcontainer/.env
|
|
454
|
+
# Why this is needed AGAIN after post-create.sh:
|
|
455
|
+
# - Environment variables set in post-create.sh are only available during that shell session
|
|
456
|
+
# - Container restarts/rebuilds lose those environment variables since they're not persisted
|
|
457
|
+
# - MCP config generation happens during post-start phase and requires API keys from .env
|
|
458
|
+
# - Without this re-loading, MCP servers requiring API keys will be disabled due to missing env vars
|
|
459
|
+
if [ -f "/workspace/.devcontainer/.env" ]; then
|
|
460
|
+
echo "๐ Re-loading environment variables from .devcontainer/.env (required after container rebuild)"
|
|
461
|
+
set -a # Export all variables
|
|
462
|
+
source "/workspace/.devcontainer/.env"
|
|
463
|
+
set +a # Stop exporting
|
|
464
|
+
echo "โ
Environment variables reloaded for MCP server configuration"
|
|
465
|
+
else
|
|
466
|
+
echo "โ ๏ธ .devcontainer/.env file not found - MCP servers requiring API keys will be disabled"
|
|
467
|
+
fi
|
|
468
|
+
|
|
469
|
+
# Generate MCP configuration from template
|
|
470
|
+
echo "๐ง Generating MCP configuration from template..."
|
|
471
|
+
if [ -f "/workspace/.devcontainer/config/claude/mcp.json.template" ]; then
|
|
472
|
+
# Use Node.js to generate configuration with environment loaded
|
|
473
|
+
if command -v node &> /dev/null; then
|
|
474
|
+
# Ensure script is executable and run with explicit node
|
|
475
|
+
# Note: The script now uses dotenv to load environment variables directly
|
|
476
|
+
chmod +x /workspace/.devcontainer/scripts/generate-mcp-config.js
|
|
477
|
+
if node /workspace/.devcontainer/scripts/generate-mcp-config.js; then
|
|
478
|
+
echo "โ
MCP configuration generated successfully"
|
|
479
|
+
# Validate generated configuration
|
|
480
|
+
validate_mcp_configuration
|
|
481
|
+
else
|
|
482
|
+
echo "โ ๏ธ Failed to generate MCP configuration from template"
|
|
483
|
+
echo " Fallback: using existing mcp.json if available"
|
|
484
|
+
fi
|
|
485
|
+
else
|
|
486
|
+
echo "โ ๏ธ Node.js not available - cannot generate MCP configuration"
|
|
487
|
+
echo " Using existing mcp.json configuration"
|
|
488
|
+
fi
|
|
489
|
+
else
|
|
490
|
+
echo "โน๏ธ No MCP template found - using existing configuration"
|
|
491
|
+
fi
|
|
492
|
+
|
|
314
493
|
# Check if Claude is available with detailed debugging
|
|
315
494
|
echo "๐ Checking Claude Code availability..."
|
|
316
495
|
echo " PATH: $PATH"
|
|
@@ -347,24 +526,26 @@ EOF
|
|
|
347
526
|
echo " This is normal for first run - continuing with installation..."
|
|
348
527
|
fi
|
|
349
528
|
|
|
350
|
-
echo "โ
|
|
529
|
+
echo "โ
Node.js environment configured"
|
|
351
530
|
|
|
352
531
|
# Install uv (for future MCP servers that might need it)
|
|
353
532
|
install_uv || echo "โ ๏ธ Continuing without uv/uvx..."
|
|
354
533
|
|
|
355
|
-
#
|
|
356
|
-
|
|
534
|
+
# Start SearXNG containers if configured for local instance
|
|
535
|
+
echo "๐ Checking SearXNG container setup..."
|
|
536
|
+
start_local_searxng
|
|
357
537
|
|
|
358
|
-
#
|
|
359
|
-
if
|
|
538
|
+
# Verify MCP configuration instead of installing servers
|
|
539
|
+
if verify_mcp_config; then
|
|
360
540
|
display_completion_message
|
|
361
541
|
exit 0
|
|
362
542
|
else
|
|
363
|
-
echo "โ ๏ธ
|
|
364
|
-
echo "
|
|
543
|
+
echo "โ ๏ธ MCP configuration verification failed."
|
|
544
|
+
echo " MCP servers are configured via mcp.json file."
|
|
545
|
+
echo " Check that the file was copied correctly during post-create phase."
|
|
365
546
|
exit 0
|
|
366
547
|
fi
|
|
367
548
|
}
|
|
368
549
|
|
|
369
550
|
# Execute main function
|
|
370
|
-
main
|
|
551
|
+
main
|