mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-10-31 11:54:57 +08:00
MCP Python SDK 2.0 removed the low-level Server decorator API (@app.list_tools() / @app.call_tool() / app.get_capabilities()), so the server crashed at startup with: AttributeError: 'Server' object has no attribute 'list_tools' The released PyPI package weknora-mcp==1.0.1 declared 'mcp>=1.0.0' with no upper bound, so uvx resolved to the latest 2.0.0 and the plugin's weknora MCP server could no longer connect. Fix: rewrite the server on top of the mcp 2.x high-level MCPServer API (formerly FastMCP), and cap the dependency at 'mcp>=2,<3'. - weknora_mcp_server.py: replace @app.list_tools()/@app.call_tool() with 28 @mcp.tool() function-signature tools (input schema auto-generated from type hints, descriptions from docstrings, plain return values serialized by the framework). Transports use run_stdio_async() / sse_app() / streamable_http_app(). WeKnoraClient business logic is unchanged. - deps: mcp>=2,<3 in pyproject.toml / requirements.txt / setup.py; commit uv.lock pinning mcp 2.0.0. - version bump to 1.1.0 (pyproject, setup, __init__, main --version, server_version). - check_imports.py: validate MCPServer / ToolError / mcp_types imports. - ci(.github/workflows/mcp-server.yml): publish on merge to main + manual dispatch, not only on tags; add PyPI version-dedup check so re-runs on an unchanged version stay green (absorbed from PR #2399). Verified: stdio initialize + tools/list returns all 28 tools; no list_tools AttributeError; tool dispatch + error wrapping confirmed. Co-authored-by: wizardchen <wizardchen@tencent.com>