fix(mcp-server): pin MCP Python SDK to v1.x

WeKnora MCP Server still uses v1 low-level Server decorators such as
@app.list_tools(). MCP SDK 2.0 removed those APIs, so fresh installs
could fail at startup with AttributeError. Cap the dependency at <2 and
require >=1.28 for Streamable HTTP transport support.
main
wizardchen 2026-07-29 15:40:09 +08:00 committed by lyingbug
parent 7d2a6311cb
commit 4f7a36c7e6
4 changed files with 16 additions and 4 deletions

View File

@ -5,6 +5,11 @@
格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
并且本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
## [Unreleased]
### 修复
- 将 `mcp` 依赖上限锁定为 `<2`,避免 `pip install` / `uv sync` 自动安装 MCP Python SDK 2.x 导致 `@app.list_tools()` 启动失败(`AttributeError: 'Server' object has no attribute 'list_tools'`)
## [1.0.1] - 2026-07-28
### 修复

View File

@ -30,8 +30,10 @@ classifiers = [
]
requires-python = ">=3.10"
dependencies = [
"mcp>=1.0.0",
"mcp>=1.28,<2",
"requests>=2.31.0",
"starlette>=0.27.0",
"uvicorn>=0.24.0",
]
[project.optional-dependencies]

View File

@ -1,4 +1,4 @@
mcp>=1.0.0
mcp>=1.28,<2
requests>=2.31.0
starlette>=0.27.0
uvicorn>=0.24.0
uvicorn>=0.24.0

View File

@ -23,7 +23,12 @@ def read_requirements():
line.strip() for line in f if line.strip() and not line.startswith("#")
]
except FileNotFoundError:
return ["mcp>=1.0.0", "requests>=2.31.0"]
return [
"mcp>=1.28,<2",
"requests>=2.31.0",
"starlette>=0.27.0",
"uvicorn>=0.24.0",
]
setup(