@echo off
REM CrossFTP Commander MCP (stdio). Requires Java 17+ at runtime.
REM Usage: commander-mcp.bat --deployConfig C:\abs\path\to\crossftp-deploy.json [--configDir C:\abs\path\to\.crossftp]
REM mcp/* must precede crossftp.jar so Jackson annotations 2.20 win over
REM Jackson 2.6 classes packaged inside crossftp.jar (MCP SDK Jackson 3).
REM All classpath entries use the script directory; client cwd is not required.
setlocal
set DIR=%~dp0
set DIR=%DIR:~0,-1%

if "%JAVACMD%"=="" (
  if not "%JAVA_HOME%"=="" (
    set JAVACMD=%JAVA_HOME%\bin\java.exe
  ) else (
    set JAVACMD=java.exe
  )
)

set MCP_CP=%DIR%\mcp\*;%DIR%\crossftp.jar;%DIR%\crossftp-resources.jar;%DIR%\commons-logging.jar;%DIR%\jnlp.jar;%DIR%\looks-2.2.1.jar;%DIR%\bcprov-jdk15on-147.jar;%DIR%\guava-18.0.jar;%DIR%\jclouds-blobstore-LATEST.jar;%DIR%\jclouds-core-LATEST.jar;%DIR%\azureblob-LATEST.jar;%DIR%\openstack-swift-LATEST.jar;%DIR%\openstack-keystone-LATEST.jar;%DIR%\rackspace-cloudidentity-LATEST.jar

"%JAVACMD%" -cp "%MCP_CP%" crossftp.mcp.CommanderMcpMain %*
