mcp-uvicorn

This commit is contained in:
2025-10-13 13:09:06 +08:00
parent f585d76cac
commit 41a6038e50
6 changed files with 213 additions and 2 deletions

19
mcp/test_tools.py Normal file
View File

@@ -0,0 +1,19 @@
# test_tools.py
from mcp.server.fastmcp import FastMCP
def create_test_mcp() -> FastMCP:
"""创建一个只包含最简单工具的 MCP 实例,用于测试连接。"""
test_mcp = FastMCP(
name="Test Tools",
instructions="用于测试服务器连接是否通畅。",
streamable_http_path="/"
)
@test_mcp.tool()
def ping() -> str:
"""一个简单的工具,用于确认服务器是否响应。"""
return "pong"
return test_mcp