One CLI, Two Identities: MCP Client and MCP Server
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