update app.py
This commit is contained in:
parent
f13b6e2ad9
commit
27cd9553a2
26
app.py
26
app.py
|
|
@ -1,7 +1,12 @@
|
|||
from fastmcp import FastMCP
|
||||
from spider.mail_qq import start as a1
|
||||
mcp = FastMCP("spider-server")
|
||||
import subprocess
|
||||
import asyncio
|
||||
import tempfile
|
||||
import os
|
||||
import logging
|
||||
|
||||
mcp = FastMCP("spider-server")
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
# 日志会输出到 stderr,不会污染 stdout
|
||||
logging.info("服务器启动")
|
||||
|
|
@ -16,20 +21,8 @@ def hello(name: str) -> str:
|
|||
"""Say hello to someone"""
|
||||
return f"Hello, {name}!"
|
||||
|
||||
# 运行服务器
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport="sse")
|
||||
# mcp.run(transport="stdio")
|
||||
|
||||
|
||||
from fastmcp import FastMCP
|
||||
import subprocess
|
||||
import asyncio
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
mcp = FastMCP("VNC Spider Manager")
|
||||
|
||||
@mcp.tool()
|
||||
async def run_spider_in_vnc(index: int, username: str = None) -> str:
|
||||
"""在 VNC 会话中运行爬虫
|
||||
|
|
@ -99,3 +92,10 @@ async def stop_vnc_server(index: int, username: str = None) -> str:
|
|||
)
|
||||
|
||||
return f"VNC 服务器已停止: {result.stdout}"
|
||||
|
||||
|
||||
# 运行服务器
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport="sse")
|
||||
# mcp.run(transport="stdio")
|
||||
|
||||
Loading…
Reference in New Issue