XH

xixianliang/harmonyos-mcp-server

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

35 stars 14 forks 品質 52 トレンド 0MIT

xixianliang/harmonyos-mcp-server は [https://github.com/xixianliang/harmonyos-mcp-server. からインポートされた MCP サーバーの候補です

概要

xixianliang/harmonyos-mcp-server は [https://github.com/xixianliang/harmonyos-mcp-server. からインポートされた MCP サーバーの候補です

概要(AI 翻訳)

HarmonyOS MCPサーバー

    

イントロ

これはMCPサーバーで、調和OSデバイスを操作します。

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

クイックスタート

インストール

  1. このレポをクローンする

  2. 包囲をセットアップして下さい。

使用法

###1.Claudeデスクトップ

Claude Desktopを使用して、ツールを試すことができます。

####2.Openai SDKを発行しました。 また、Openai-agents SDKを利用してmcpサーバを試すことができます。 ここでは例です。

###3.ランチェーン 柔軟なLLMエージェントフレームワークであるLangGraphを使用してワークフローを設計できます。 ここでは例です。

[server.pyでシステムプロンプトを書き込みます]

mcp サーバーからプロンプトを取得するには、[[load_mcp_prompt] 関数を使用します.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

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

1.Claude Desktop

You can use Claude Desktop to try our tool.

2.Openai SDK

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())

3.Langchain

You can use LangGraph, a flexible LLM agent framework to design your workflows. Here’s an example

"""
langgraph_mcp.py
"""

server_params = StdioServerParameters(
    command="/home/chad/.local/bin/uv",
    args=["--directory",
          ".",
          "run",
          "server.py"],
    
)

#This fucntion would use langgraph to build your own agent workflow
async def create_graph(session):
    llm = ChatOllama(model="qwen2.5:7b", temperature=0)
    #!!!load_mcp_tools is a langchain package function that integrates the mcp into langchain.
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →