跳到正文
DEV Community· 杨洪付·· 2 小時前AI 評分44

hmharness:一個 CLI,兼具 MCP 客戶端與 MCP 伺服器身份

One CLI, Two Identities: MCP Client and MCP Server

AI 導讀

hmharness 以 MCP 客戶端連接 5800+ 社羣伺服器,並以 MCP 伺服器形式把 HarmonyOS 工具鏈提供給其他 MCP host 呼叫。預設只公開 harmony_* 領域工具,破壞性操作的拒絕規則則保留在伺服器端。終端 CLI、網頁工作台、瀏覽器擴充功能及 MCP/ACP 協議共用同一工具鏈與核准系統。

正文

MCP (Model Context Protocol) has become the de facto standard for AI tool interconnection — the community hosts 5800+ MCP servers you can plug into. Most tools pick one side: they either consume MCP servers or provide tools as one. hmharness — an open-source (MIT) agent framework for HarmonyOS/OpenHarmony development — took the uncommon "both directions" approach.

Identity 1: Client (borrowing the ecosystem)

hmharness connects to all 5800+ community MCP servers over both stdio and HTTP transports. When its agent works on a task, it can call any capability the ecosystem already has — query databases, read web pages, operate SaaS tools — without implementing each one itself. Stand on the ecosystem, don't rebuild it.

Identity 2: Server (exporting the toolchain)

hmh mcp-serve turns the entire HarmonyOS toolchain into native MCP tools that any MCP host can call. One line in Claude Code: claude mcp add hmharness -- npx -y @hmharness/cli mcp-serve — and the host immediately gets harmony_build, harmony_api_lookup, and the rest. No nested agent loops; tool calls are confirmed one by one by the host's own permission system.

Two boundary rules

Tool exposure has edges: by default only harmony_* domain tools are exposed — run_command and write_file are NOT, because the host already has its own general tools. No duplication, no overstepping.

Approval runs on two layers: the host permission system handles "asking the user"; destructive hard-walls (deny red lines) permanently live on the server side. Each layer owns its segment; neither oversteps.

Four entry channels, one system

Terminal CLI, web workbench, browser extension, MCP/ACP protocol — whichever way an agent enters, it gets the same toolchain and the same approval system.

The practical payoff

If you already write code with Claude Code or Codex, one command gives them the full HarmonyOS toolchain — build, sign, install, anti-hallucination API lookup — without switching tools. Your workflow stays; hmharness enters as a capability plugin.


hmharness wires project creation, checks, builds, signing, install, launch, log reading, and result verification into a local toolchain so AI does not just generate code — it proves results against the local machine. Independent community project, no affiliation with Huawei or OpenAtom.

GitHub: https://github.com/swsgbl/hmharness · Evidence: https://swsgbl.github.io/hmharness/evidence/aimcpopensourcedevtools

來源:DEV Community · dev.to