-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_mcp.bat
More file actions
106 lines (89 loc) · 3.44 KB
/
Copy pathsetup_mcp.bat
File metadata and controls
106 lines (89 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@echo off
setlocal enabledelayedexpansion
echo.
echo ============================================
echo Claude Memory MCP Setup
echo ============================================
echo.
:: Get API key from user
set /p API_KEY="Enter your API Key (mem_xxx...): "
if "%API_KEY%"=="" (
echo ERROR: API key is required!
pause
exit /b 1
)
:: Get Server URL
echo.
echo Default server: http://15.2.2.251:8765
set /p SERVER_URL="Enter server URL (press Enter for default): "
if "%SERVER_URL%"=="" (
set SERVER_URL=http://15.2.2.251:8765
)
:: Auto-detect paths
set SCRIPT_DIR=%~dp0
:: Remove trailing backslash
if "%SCRIPT_DIR:~-1%"=="\" set SCRIPT_DIR=%SCRIPT_DIR:~0,-1%
set CLIENT_SCRIPT=%SCRIPT_DIR%\memory_server\server_mcp_client.py
:: Find python - prefer local venv
set PYTHON_CMD=python
if exist "%SCRIPT_DIR%\venv\Scripts\python.exe" (
set PYTHON_CMD=%SCRIPT_DIR%\venv\Scripts\python.exe
)
echo.
echo Detected:
echo Client : %CLIENT_SCRIPT%
echo Python : %PYTHON_CMD%
echo.
if not exist "%CLIENT_SCRIPT%" (
echo ERROR: Client script not found: %CLIENT_SCRIPT%
pause
exit /b 1
)
:: Write a temporary PowerShell script to avoid bat escaping issues
set PS_SCRIPT=%TEMP%\setup_mcp_temp.ps1
(
echo $clientScript = '%CLIENT_SCRIPT%'
echo $pythonCmd = '%PYTHON_CMD%'
echo $serverUrl = '%SERVER_URL%'
echo $apiKey = '%API_KEY%'
echo.
echo # --- VS Code global mcp.json ---
echo $mcpFile = "$env:APPDATA\Code\User\mcp.json"
echo if ^(Test-Path $mcpFile^) { $cfg = Get-Content $mcpFile -Raw ^| ConvertFrom-Json } else { $cfg = [pscustomobject]@{} }
echo if ^(-not $cfg.PSObject.Properties['servers']^) { $cfg ^| Add-Member -NotePropertyName 'servers' -NotePropertyValue ^([pscustomobject]@{}^) -Force }
echo $entry = [pscustomobject]@{ command=$pythonCmd; args=@^($clientScript^); env=[pscustomobject]@{ CLAUDE_MEMORY_URL=$serverUrl; CLAUDE_MEMORY_KEY=$apiKey }; type='stdio' }
echo $cfg.servers ^| Add-Member -NotePropertyName 'claude-memory' -NotePropertyValue $entry -Force
echo $cfg ^| ConvertTo-Json -Depth 10 ^| Set-Content $mcpFile -Encoding UTF8
echo Write-Host " OK $mcpFile"
) > "%PS_SCRIPT%"
echo [1/2] Configuring VS Code Copilot...
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS_SCRIPT%"
del "%PS_SCRIPT%"
echo [2/3] Configuring Claude Code CLI (user scope - all projects)...
claude mcp add --scope user --transport stdio claude-memory -e CLAUDE_MEMORY_URL=%SERVER_URL% -e CLAUDE_MEMORY_KEY=%API_KEY% -- "%PYTHON_CMD%" "%CLIENT_SCRIPT%"
echo [3/3] Installing slash commands...
set COMMANDS_SRC=%SCRIPT_DIR%\.claude\commands
set COMMANDS_DST=%USERPROFILE%\.claude\commands
if exist "%COMMANDS_SRC%" (
if not exist "%COMMANDS_DST%" mkdir "%COMMANDS_DST%"
xcopy /Y /Q "%COMMANDS_SRC%\*.md" "%COMMANDS_DST%\" >nul 2>&1
echo Installed 17 slash commands to %COMMANDS_DST%
) else (
echo WARNING: Commands folder not found at %COMMANDS_SRC%, skipping...
)
echo.
echo ============================================
echo Done! Next steps:
echo ============================================
echo 1. Restart VS Code ^(close ALL windows^)
echo 2. For Copilot Chat: type /mcp and reconnect "claude-memory"
echo 3. For Claude Code: type /mcp to verify ^(works in ALL projects^)
echo 4. Test: whoami^(^)
echo.
echo Available slash commands:
echo /brief /recall /remember /save /sessions
echo /continue /pickup /whoami /team /share
echo /rules /myrule /teamrule /sync /suggest
echo /inbox /find
echo.
pause