28 lines
761 B
Go
28 lines
761 B
Go
package device
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
)
|
|
|
|
// MCPEnvironment points bundled Android tools at the same server as the UI.
|
|
func MCPEnvironment() (map[string]string, error) {
|
|
adb, err := resolveAdb()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
platform := "darwin"
|
|
if runtime.GOOS == "windows" {
|
|
platform = "win32"
|
|
}
|
|
sdk := filepath.Dir(filepath.Dir(adb))
|
|
return map[string]string{
|
|
"ANDROID_HOME": sdk, "ANDROID_SDK_ROOT": sdk,
|
|
"ANDROID_ADB_SERVER_PORT": adbServerPort, "ADB_SERVER_SOCKET": "tcp:localhost:" + adbServerPort,
|
|
"PATH": filepath.Dir(adb) + string(os.PathListSeparator) + os.Getenv("PATH"),
|
|
"platform": platform,
|
|
"MOBILEMCP_LEGACY_ROBOT": "1", "MOBILEMCP_DISABLE_TELEMETRY": "1",
|
|
}, nil
|
|
}
|