def METHOD_NAME(ext_id, install_dir):
    # Copy the host script
    host_path = os.path.join(install_dir, HOST_FILENAME)
    os.makedirs(install_dir, exist_ok=True)
    src = os.path.join(os.path.dirname(os.path.realpath(__file__)), "mpris.py")
    with open(src, "rb") as f:
        data = f.read()
    with open(host_path, "wb") as f:
        f.write(data)
    os.chmod(host_path, 0o744)
    # Create the manifest file
    xdg_paths = get_xdg_config_paths()
    manifest = dict(HOST_MANIFEST)
    manifest["path"] = host_path
    manifest["allowed_origins"].append("chrome-extension://%s/" % ext_id)
    for path in xdg_paths:
        if not os.path.exists(path):
            continue
        message_hosts = os.path.join(path, "NativeMessagingHosts")
        manifest_path = os.path.join(message_hosts, HOST_MANIFEST_FILENAME)
        os.makedirs(message_hosts, exist_ok=True)
        with open(manifest_path, "w") as f:
            json.dump(manifest, f, indent=2)
        os.chmod(manifest_path, 0o644)