Issue: apktool reported as “not found” on Windows 11 / Claude Code even though it is installed and on PATH
Summary
On Windows 11, when running apktool-mcp-server from Claude Code (CLI) in stdio mode, MCP tools such as health_check() and decode_apk() fail with:
APKTool not found. Please ensure APKTool is installed and in PATH
This happens even though apktool is correctly installed, apktool.bat is on PATH, and apktool -version works in a normal cmd.exe session.
Environment
- OS: Windows 11 (build
10.0.26200.7840)
- Client: Claude Code v2.1.39 (stdio MCP)
apktool: 3.0.1
apktool.bat: E:\path\to\apktool\bin\apktool.bat
apktool.jar: E:\path\to\apktool\bin\apktool.jar
- Java: Available on PATH (detected at
C:\path\to\java.exe; JAVA_HOME not set)
uv: C:\Users\<user>\.cargo\bin\uv.exe
Steps to Reproduce
- Install
apktool on Windows as apktool.bat + apktool.jar, and add the directory to PATH.
- Confirm in a normal terminal:
where apktool
apktool -version
This works and prints 3.0.1.
- Start
apktool-mcp-server via Claude Code MCP (stdio).
- Call the following MCP tools:
health_check()
decode_apk(apk_path="C:\\path\\to\\sample.apk", force=true)
Actual Result
health_check() returns:
apktool_available: false
apktool_error: "APKTool not found. Please ensure APKTool is installed and in PATH"
decode_apk() fails with the same error.
Expected Result
health_check() should return apktool_available: true and report the installed apktool version.
decode_apk() should successfully decode the APK.
Evidence / Debug Output
Inside the MCP server process:
shutil.which("apktool") resolves to an apktool.BAT on disk
PATH includes the directory containing apktool.bat
PATHEXT includes .BAT
But running:
subprocess.run(["apktool", "--version"], ...)
can still raise:
FileNotFoundError(2, 'The system cannot find the file specified')
Notes / Root Cause
This appears to be a Windows-specific issue when apktool is installed as a .bat wrapper: the executable is discoverable on PATH, but direct subprocess.run(["apktool", ...]) can fail in this host environment (Claude Code + stdio MCP), leading to a false “apktool not found” error.
Suggested Fix
Make Windows execution more robust for .bat-based apktool installs. Two possible approaches:
Option A: Support an explicit APKTOOL_PATH environment variable
- Read a configurable command/path:
APKTOOL_CMD = os.environ.get("APKTOOL_PATH", "apktool")
- Use
APKTOOL_CMD instead of hardcoding "apktool" in all calls (health check, decode, build, etc.).
- On Windows, users can set:
APKTOOL_PATH=E:\path\to\apktool\bin\apktool.bat
Option B: Run apktool through cmd.exe on Windows
- Replace direct calls with:
["cmd.exe", "/c", "apktool", "--version"]
and similarly for decode/build commands.
Either option would prevent the false “apktool not found” error on Windows when apktool is distributed as a .bat wrapper.
Issue:
apktoolreported as “not found” on Windows 11 / Claude Code even though it is installed and onPATHSummary
On Windows 11, when running
apktool-mcp-serverfrom Claude Code (CLI) in stdio mode, MCP tools such ashealth_check()anddecode_apk()fail with:This happens even though
apktoolis correctly installed,apktool.batis onPATH, andapktool -versionworks in a normalcmd.exesession.Environment
10.0.26200.7840)apktool: 3.0.1apktool.bat:E:\path\to\apktool\bin\apktool.batapktool.jar:E:\path\to\apktool\bin\apktool.jarC:\path\to\java.exe;JAVA_HOMEnot set)uv:C:\Users\<user>\.cargo\bin\uv.exeSteps to Reproduce
apktoolon Windows asapktool.bat+apktool.jar, and add the directory toPATH.where apktool apktool -version3.0.1.apktool-mcp-servervia Claude Code MCP (stdio).health_check()decode_apk(apk_path="C:\\path\\to\\sample.apk", force=true)Actual Result
health_check()returns:apktool_available: falseapktool_error: "APKTool not found. Please ensure APKTool is installed and in PATH"decode_apk()fails with the same error.Expected Result
health_check()should returnapktool_available: trueand report the installedapktoolversion.decode_apk()should successfully decode the APK.Evidence / Debug Output
Inside the MCP server process:
shutil.which("apktool")resolves to anapktool.BATon diskPATHincludes the directory containingapktool.batPATHEXTincludes.BATBut running:
can still raise:
FileNotFoundError(2, 'The system cannot find the file specified')Notes / Root Cause
This appears to be a Windows-specific issue when
apktoolis installed as a.batwrapper: the executable is discoverable onPATH, but directsubprocess.run(["apktool", ...])can fail in this host environment (Claude Code + stdio MCP), leading to a false “apktool not found” error.Suggested Fix
Make Windows execution more robust for
.bat-basedapktoolinstalls. Two possible approaches:Option A: Support an explicit
APKTOOL_PATHenvironment variableAPKTOOL_CMDinstead of hardcoding"apktool"in all calls (health check, decode, build, etc.).APKTOOL_PATH=E:\path\to\apktool\bin\apktool.batOption B: Run
apktoolthroughcmd.exeon WindowsEither option would prevent the false “apktool not found” error on Windows when
apktoolis distributed as a.batwrapper.