#!/usr/bin/env python3
"""
简单测试MCP服务器的基本功能
"""
import asyncio
import sys
import json
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import Tool

# 创建一个简单的测试服务器
server = Server("test-server")

@server.list_tools()
async def list_tools() -> list[Tool]:
    return [
        Tool(
            name="test_tool",
            description="A test tool",
            inputSchema={
                "type": "object",
                "properties": {},
            }
        )
    ]

@server.call_tool()
async def call_tool(name: str, args: dict) -> list:
    return [{"type": "text", "text": "Test response"}]

async def main():
    options = server.create_initialization_options()
    async with stdio_server() as (read_stream, write_stream):
        await server.run(read_stream, write_stream, options, raise_exceptions=True)

if __name__ == "__main__":
    asyncio.run(main())