
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 服务器
开场白
这是一个用于操作 harmonyOS 设备的 MCP 服务器。
https://github.com/user-attachments/assets/7af7f5af-e8c6-4845-8d92-cd0ab30bfe17
快速启动
安装
-
克隆这个仓库
-
搭建环境。
用途
1.Claude桌面
您可以使用Claude Desktop来试用我们的工具。
2.Openai SDK
你也可以用openai-agents SDK来尝试MCP服务器。这里有个例子
3.朗链
你可以使用LangGraph,一个灵活的LLM代理框架来设计你的工作流程。这里有一个例子
在server.py中写入系统提示
使用 load_mcp_prompt 功能从 mcp 服务器获取提示。
本页由 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
- Clone this repo
git clone https://github.com/XixianLiang/HarmonyOS-mcp-server.git
cd HarmonyOS-mcp-server
- 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.
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →