@echo off
REM
REM Chatlog MCP Server - Windows Installation Script
REM This script installs and configures the Chatlog MCP Server on Windows
REM
setlocal enabledelayedexpansion
REM Colors for output (Windows 10+)
if not defined ANSI_COLORS (
set "RED=[91m"
set "GREEN=[92m"
set "YELLOW=[93m"
set "BLUE=[94m"
set "NC=[0m"
) else (
set "RED="
set "GREEN="
set "YELLOW="
set "BLUE="
set "NC="
)
REM Print banner
echo.
echo %BLUE%╔══════════════════════════════════════════════════════════════╗%NC%
echo %BLUE%║ ║%NC%
echo %BLUE%║ Chatlog MCP Server Installer (Windows) ║%NC%
echo %BLUE%║ ║%NC%
echo %BLUE%║ A Model Context Protocol server for chat log analysis ║%NC%
echo %BLUE%║ ║%NC%
echo %BLUE%╚══════════════════════════════════════════════════════════════╝%NC%
echo.
REM Check for help flag
if "%1"=="--help" goto :help
if "%1"=="-h" goto :help
REM Check Python
echo %BLUE%[INFO]%NC% Checking system requirements...
python --version >nul 2>&1
if errorlevel 1 (
echo %RED%[ERROR]%NC% Python is not installed. Please install Python 3.10 or higher.
echo Visit: https://www.python.org/downloads/
pause
exit /b 1
) else (
echo %GREEN%[SUCCESS]%NC% Python found
)
REM Check pip
pip --version >nul 2>&1
if errorlevel 1 (
echo %RED%[ERROR]%NC% pip is not installed. Please install pip.
pause
exit /b 1
) else (
echo %GREEN%[SUCCESS]%NC% pip found
)
REM Install package
echo %BLUE%[INFO]%NC% Installing Chatlog MCP Server...
REM Check if running from source
if exist "setup.py" (
echo %BLUE%[INFO]%NC% Installing from local source...
pip install -e .
) else (
echo %BLUE%[INFO]%NC% Installing from PyPI...
pip install chatlog-mcp-server
)
if errorlevel 1 (
echo %RED%[ERROR]%NC% Installation failed
pause
exit /b 1
) else (
echo %GREEN%[SUCCESS]%NC% Package installed successfully
)
REM Create configuration
echo %BLUE%[INFO]%NC% Creating MCP configuration...
REM Create config directory
set "CONFIG_DIR=%APPDATA%\Claude"
if not exist "%CONFIG_DIR%" (
mkdir "%CONFIG%"
echo %GREEN%[SUCCESS]%NC% Created config directory: %CONFIG_DIR%
)
REM Create or backup configuration
set "CONFIG_FILE=%CONFIG_DIR%\mcp-servers.json"
if exist "%CONFIG_FILE%" (
echo %YELLOW%[WARNING]%NC% Configuration file already exists at %CONFIG_FILE%
set /p "response=Do you want to backup and replace it? (y/n): "
if /i "!response!"=="y" (
copy "%CONFIG_FILE%" "%CONFIG_FILE%.backup.%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%" >nul
echo %GREEN%[SUCCESS]%NC% Backup created
) else (
echo %BLUE%[INFO]%NC% Keeping existing configuration
goto :verify
)
)
REM Create configuration
(
echo {
echo "mcpServers": {
echo "chatlog": {
echo "command": "chatlog-mcp",
echo "args": [],
echo "env": {
echo "PYTHONIOENCODING": "utf-8"
echo }
echo }
echo }
echo }
) > "%CONFIG_FILE%"
echo %GREEN%[SUCCESS]%NC% Configuration created at %CONFIG_FILE%
REM Verify installation
:verify
echo %BLUE%[INFO]%NC% Verifying installation...
REM Test if command is available
chatlog-mcp --version >nul 2>&1
if errorlevel 1 (
echo %YELLOW%[WARNING]%NC% chatlog-mcp command not found in PATH
echo %BLUE%[INFO]%NC% You may need to add it to your PATH or use: python -m chatlog_mcp.cli
) else (
echo %GREEN%[SUCCESS]%NC% chatlog-mcp command is available
)
REM Print next steps
echo.
echo %GREEN%╔══════════════════════════════════════════════════════════════╗%NC%
echo %GREEN%║ ║%NC%
echo %GREEN%║ Installation Complete! ║%NC%
echo %GREEN%║ ║%NC%
echo %GREEN%╚══════════════════════════════════════════════════════════════╝%NC%
echo.
echo Next steps:
echo.
echo %BLUE%1.%NC% Start Claude Code with MCP configuration:
echo claude --mcp-config %CONFIG_FILE%
echo.
echo %BLUE%2.%NC% Or set environment variable:
echo set CLAUDE_MCP_CONFIG=%CONFIG_FILE%
echo.
echo %BLUE%3.%NC% Verify the installation:
echo chatlog-mcp --version
echo.
echo %BLUE%4.%NC% Run the server:
echo chatlog-mcp
echo.
echo %YELLOW%Note:%NC Make sure your HTTP API server is running on the specified URL
echo (default: http://127.0.0.1:5030)
echo.
echo %BLUE%Documentation:%NC https://github.com/anthropics/chatlog-mcp-server
echo %BLUE%Support:%NC support@anthropic.com
echo.
echo %GREEN%[SUCCESS]%NC% Installation completed successfully!
pause
goto :eof
:help
echo Usage: %0 [OPTIONS]
echo.
echo Options:
echo --help, -h Show this help message
echo.
echo Examples:
echo %0 Install Chatlog MCP Server
echo %0 --help Show this help message
echo.
goto :eof
endlocal