Skip to content

About

ZCode plugin: pass-through AppGallery metadata + icon proxy. Sister project of arkpilot.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

arkgallery

arkgallery is a ZCode plugin that exposes Huawei AppGallery (华为应用市场) metadata and an icon proxy as MCP tools for LLMs.

It is the sister project of taobaoaz/arkpilot (the HarmonyOS NEXT dev-loop plugin). arkpilot covers building, running, and automating HarmonyOS apps; arkgallery covers the data layer for AppGallery.

Design: pass-through, not download

This plugin does not bulk-download, persist, or republish AppGallery metadata or icons. Every call is a one-shot query that fetches the public AppGallery endpoint and returns the result. This is by design:

  • AppGallery's terms of service prohibit systematic retrieval of content. A pass-through proxy is on much safer ground than a bulk dataset.
  • HQ-ICON (the iTunes App Store icon viewer) does the same: the browser fetches artworkUrl512 directly from Apple's CDN, with no server-side mirror. We mirror that model for the AppGallery CDN.
  • The result is in-memory caches (5 min for metadata, 1 h LRU 100 entries for icon bytes) and the process exits with no on-disk artifact.

5 MCP tools, in 2 capability groups

Group Tools
Metadata (4) appstore_search, appstore_categories, appstore_list_by_category, appstore_detail
Icon proxy (1) ⭐ appstore_icon

The 4 metadata tools

These are functionally identical to the appstore_* tools that lived in arkpilot v0.2.0:

Tool Input Output
appstore_search { query: string, limit?: number, exact?: boolean } { ok, apps: AppInfo[], source, note?, fetchedAt }
appstore_categories {} { ok, categories: Category[], source, note?, fetchedAt } (15 known + web-template)
appstore_list_by_category { category: string, page?: number, pageSize?: number } { ok, apps, page, pageSize, totalPages?, source, note?, fetchedAt }
appstore_detail { appId?: string, url?: string } { ok, app: AppInfo | null, source, note?, fetchedAt }

AppInfo shape:

{
  name: string;
  pkg?: string;            // e.g. "com.tencent.mm"
  appId?: string;          // e.g. "C5683"
  dev?: string;            // developer name
  category?: string;
  icon?: string;           // canonical Huawei CDN URL — pass to appstore_icon
  url: string;             // detail page URL
}

The icon proxy: appstore_icon ⭐

The new tool. Pass an appId (or a detail url); the plugin resolves metadata, fetches the icon from Huawei's CDN, and returns the bytes as a base64 string.

Input:

{ appId?: string; url?: string; }   // one required

Output:

{
  ok: true,
  icon: {
    sourceUrl: "https://appimg-drcn.dbankcdn.com/.../weixin.png",
    mime: "image/png",
    bytesBase64: "iVBORw0KGgoAAAANSUhEUgAA...",  // base64 PNG bytes
    sizeBytes: 5432,
    width: 216,         // optional: parsed from PNG header
    height: 216,
  },
  source: "proxy" | "cache" | "partial",
  fetchedAt: "2026-06-22T..."
}

The icon is not written to disk. The bytes live only in a 1 h / 100-entry LRU in this process. MCP clients decode bytesBase64 to a Uint8Array and use it however they like.

Why base64, not a path? MCP's stdio transport returns text; a Uint8Array doesn't survive JSON-RPC serialization. base64 + client-side atob is the only safe option.

How a HarmonyOS NEXT app consumes it

import { http } from '@kit.NetworkKit';
import { image } from '@ohos.multimedia.image';
import { util } from '@ohos.util';

const init = { jsonrpc: "2.0", id: 1, method: "tools/call",
  params: { name: "appstore_icon", arguments: { appId: "C10001" } } };

// 1) post the JSON-RPC request to your MCP-over-HTTP bridge
const resp = await http.createHttp().request("https://your-bridge/mcp", {
  method: http.RequestMethod.POST,
  header: { "Content-Type": "application/json" },
  extraData: JSON.stringify(init),
});

// 2) unwrap
const r = JSON.parse(resp.result as string);
const content = JSON.parse(r.result.content[0].text);  // the IconResult
const bytes = new util.Base64Helper().decodeSync(content.icon.bytesBase64);

// 3) build a PixelMap
const buf = new ArrayBuffer(bytes.length);
new Uint8Array(buf).set(bytes);
const pixelMap = await image.createImageSource(buf).createPixelMapSync();

// 4) show in your <Image src=...>
Image(pixelMap).width(48).height(48)

Install

In ~/.zcode/cli/config.json:

{
  "plugins": {
    "enabledPlugins": { "arkgallery@local": true },
    "options": { "arkgallery@local": {} }
  }
}

Then load it:

zcode --plugin-dir /absolute/path/to/arkgallery

Often paired with arkpilot:

{
  "plugins": {
    "enabledPlugins": {
      "arkpilot@local": true,
      "arkgallery@local": true
    }
  }
}

Honest coverage

  • AppGallery has no public "list all apps" API and applies anti-scraping (browser fingerprinting, IP rate limits). These tools cover reachable apps (rankings + categories + search + detail) but do not guarantee 100% coverage.
  • Every metadata response carries a source field (online / cache / partial); icon responses carry source (proxy / cache / partial).
  • A note explains every non-online / non-proxy result — for example, when Playwright isn't installed and only the HTTP path is available, or when the icon CDN 403s.
  • Without playwright installed, some anti-scraped metadata responses return partial; the plugin still works in HTTP-only mode for popular apps.

ToS note

This plugin is a thin pass-through. Huawei AppGallery's terms of service apply to any user / consumer of these tools. The plugin:

  • Does not scrape in bulk.
  • Does not store, cache across processes, or republish metadata or icons.
  • Does not claim any ownership of the data; the AppInfo records are verbatim from the public API.

If you want to bulk-download AppGallery data, please contact Huawei for an enterprise data partnership instead of using this plugin.

Optional browser fallback

playwright is an optionalDependency. When installed, anti-scraped metadata responses fall back to a headless browser. Without it, tools work in HTTP-only mode (most searches still succeed for popular apps).

# Optional — for highest coverage
npm install
npm install playwright
npx playwright install chromium

Development

npm install
npm run build      # tsc + esbuild -> dist/mcp/server.js
npm run typecheck
npm test           # vitest run test (28 tests)

Project layout

arkgallery/
├── .github/workflows/dependabot.yml   # weekly npm updates
├── .zcode-plugin/plugin.json          # plugin manifest (name: "arkgallery")
├── .mcp.json                          # stdio MCP server declaration
├── package.json                       # @zcode/arkgallery-plugin
├── src/
│   ├── mcp/server.ts                  # 5 tools registered
│   ├── providers/appstore.ts          # pass-through metadata + icon proxy
│   ├── providers/appstore.types.ts    # types (no CheckResult; IconResult added)
│   └── lib/http.ts                    # httpJson, httpText, httpBinary
├── test/
│   ├── server.test.ts
│   ├── providers/appstore.test.ts
│   └── fixtures/appgallery/           # 4 JSON fixtures
├── skills/arkgallery/SKILL.md         # model workflow
├── commands/arkgallery.md             # slash command
└── README.md

License

MIT

About

ZCode plugin: pass-through AppGallery metadata + icon proxy. Sister project of arkpilot.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages