MCP ExplorerExplorer

Harmonyos Mcp Server

@XixianLiangon 9 months ago
15 MIT
FreeCommunity
AI Systems
MCP server for manipulating HarmonyOS next devices.

Overview

What is Harmonyos Mcp Server

HarmonyOS-mcp-server is a Management Control Protocol (MCP) server designed for manipulating devices running HarmonyOS, enabling developers to interact with and control these devices programmatically.

Use cases

Use cases for HarmonyOS-mcp-server include launching applications on HarmonyOS devices, managing device settings, automating tasks, and integrating HarmonyOS devices into larger automation frameworks.

How to use

To use HarmonyOS-mcp-server, clone the repository from GitHub, set up the environment using Python 3.13, and utilize either Claude Desktop or the openai-agents SDK to interact with the server and execute commands on HarmonyOS devices.

Key features

Key features of HarmonyOS-mcp-server include support for asynchronous operations, integration with openai-agents SDK, and the ability to manipulate various HarmonyOS device functionalities through a command interface.

Where to use

HarmonyOS-mcp-server can be used in various fields such as mobile application development, device management, automation testing, and IoT applications where HarmonyOS devices are involved.

Content

HarmonyOS MCP Server

   

image

Intro

This is a MCP server for manipulating harmonyOS Device.

https://github.com/user-attachments/assets/7af7f5af-e8c6-4845-8d92-cd0ab30bfe17

Quick Start

Installation

  1. Clone this repo
git clone https://github.com/XixianLiang/HarmonyOS-mcp-server.git
cd HarmonyOS-mcp-server
  1. Setup the envirnment.
uv python install 3.13
uv sync

Usage

You can use Claude Desktop to try our tool.

You can also use openai-agents SDK to try the mcp server. Here’s an example

"""
Example: Use Openai-agents SDK to call HarmonyOS-mcp-server
"""
import asyncio
import os

from agents import Agent, Runner, gen_trace_id, trace
from agents.mcp import MCPServerStdio, MCPServer

async def run(mcp_server: MCPServer):
    agent = Agent(
        name="Assistant",
        instructions="Use the tools to manipulate the HarmonyOS device and finish the task.",
        mcp_servers=[mcp_server],
    )

    message = "Launch the app `settings` on the phone"
    print(f"Running: {message}")
    result = await Runner.run(starting_agent=agent, input=message)
    print(result.final_output)


async def main():

    # Use async context manager to initialize the server
    async with MCPServerStdio(
        params={
            "command": "<...>/bin/uv",
            "args": [
                "--directory",
                "<...>/harmonyos-mcp-server",
                "run",
                "server.py"
            ]
        }
    ) as server:
        trace_id = gen_trace_id()
        with trace(workflow_name="MCP HarmonyOS", trace_id=trace_id):
            print(f"View trace: https://platform.openai.com/traces/trace?trace_id={trace_id}\n")
            await run(server)


if __name__ == "__main__":
    asyncio.run(main())

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers