diff --git a/app.py b/app.py index abae0d8..56a9ec2 100755 --- a/app.py +++ b/app.py @@ -10,7 +10,8 @@ logging.basicConfig(level=logging.INFO) logging.info("服务器启动") VNC_SERVER_HOST = "https://10.10.40.19:6080" -# @mcp.tool() +SHELL_DIR = "/home/dgs/vnc-server" +@mcp.tool() def mail_qq_spider(account: str) -> str: """qq邮箱爬虫,第一个参数是用户名""" return a1(account) @@ -25,7 +26,7 @@ async def start_vnc_server(display: int) -> str: try: # 调用外部 start_vnc_server.sh 脚本,传入 index 作为参数 process = await asyncio.create_subprocess_exec( - "/home/dgs/vnc-server/start_vnc_server.sh", + f"{SHELL_DIR}/start_vnc_server.sh", str(display), stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE @@ -55,7 +56,7 @@ async def start_spider(spider_code: str,display: str) -> str: try: # 调用外部 start_spider.sh 脚本,传入 spider_code 作为参数 process = await asyncio.create_subprocess_exec( - "/home/dgs/vnc-server/start_spider.sh", + f"{SHELL_DIR}/start_spider.sh", spider_code, display, stdout=asyncio.subprocess.PIPE, @@ -82,7 +83,7 @@ async def close_vnc_server(display: int) -> str: try: # 调用外部 close_vnc_server.sh 脚本,传入 display 作为参数 process = await asyncio.create_subprocess_exec( - "/home/dgs/vnc-server/close_vnc_server.sh", + f"{SHELL_DIR}/close_vnc_server.sh", str(display), stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE