Skip to content

Commit bc33b1e

Browse files
authored
Merge pull request #16 from alex-feel/alex-feel-dev
Configure MCP server without requiring npm in PATH
2 parents d696722 + 30b40b6 commit bc33b1e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

scripts/windows/setup-python-environment.ps1

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,10 @@ Write-Host ""
204204
Write-Host "Step 6: Configuring Context7 MCP server..." -ForegroundColor Cyan
205205

206206
try {
207-
# Find the claude command location (npm global install path)
208-
$npmPath = (npm config get prefix 2>$null)
209-
if (!$npmPath) {
210-
# Fallback to default npm path
211-
$npmPath = Join-Path $env:APPDATA "npm"
212-
}
207+
# npm global packages are always installed in %APPDATA%\npm on Windows
208+
$npmPath = Join-Path $env:APPDATA "npm"
213209

210+
# Look for claude executable in the standard location
214211
$claudePath = Join-Path $npmPath "claude.ps1"
215212
$claudeCmd = Join-Path $npmPath "claude.cmd"
216213

@@ -223,8 +220,8 @@ try {
223220
}
224221

225222
if ($claudeExe) {
226-
# Run the MCP command with full path
227-
$mcpCommand = "& `"$claudeExe`" mcp add --transport http context7 https://mcp.context7.com/mcp"
223+
# Run the MCP command with full path, also updating PATH for the subprocess
224+
$mcpCommand = "`$env:Path = `"$npmPath;`$env:Path`"; & `"$claudeExe`" mcp add --transport http context7 https://mcp.context7.com/mcp 2>`$null"
228225

229226
$mcpProcess = Start-Process -FilePath "powershell.exe" -ArgumentList @(
230227
"-NoProfile",
@@ -239,7 +236,7 @@ try {
239236
Write-Info "To verify or add manually, run: claude mcp add --transport http context7 https://mcp.context7.com/mcp"
240237
}
241238
} else {
242-
Write-Warn "Could not locate claude command"
239+
Write-Warn "Could not locate claude command at expected location: $npmPath"
243240
Write-Info "To add manually after opening a new terminal, run: claude mcp add --transport http context7 https://mcp.context7.com/mcp"
244241
}
245242
} catch {

0 commit comments

Comments
 (0)