fix(mcp-server): adopt official PyPI package tencent-weknora-mcp [v1.1.1]
Rename the distribution to tencent-weknora-mcp, point metadata at Tencent/WeKnora, bump to 1.1.1 for the transport/session fixes, and tighten publish to main/tags only via Trusted Publishing.main
parent
1e12361cb8
commit
a76c6ef24e
|
|
@ -97,13 +97,15 @@ jobs:
|
|||
name: Publish to PyPI
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
# Publish on push to main, manual runs, and release tags — but never on PRs.
|
||||
if: github.event_name != 'pull_request'
|
||||
# Publish on push to main, manual runs (main/tags only), and release tags — never on PRs.
|
||||
if: >-
|
||||
github.event_name != 'pull_request' &&
|
||||
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/mcp-server-v'))
|
||||
permissions:
|
||||
id-token: write
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/project/weknora-mcp/
|
||||
url: https://pypi.org/project/tencent-weknora-mcp/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
|
@ -121,7 +123,7 @@ jobs:
|
|||
import json, sys, urllib.request
|
||||
v = sys.argv[1]
|
||||
try:
|
||||
d = json.load(urllib.request.urlopen("https://pypi.org/pypi/weknora-mcp/json"))
|
||||
d = json.load(urllib.request.urlopen("https://pypi.org/pypi/tencent-weknora-mcp/json"))
|
||||
print("true" if v in d.get("releases", {}) else "false")
|
||||
except Exception:
|
||||
# If PyPI is unreachable or the project is brand-new (404), treat as unpublished.
|
||||
|
|
@ -130,7 +132,7 @@ jobs:
|
|||
echo "already on PyPI: $exists"
|
||||
if [ "$exists" = "true" ]; then
|
||||
echo "should_publish=false" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::weknora-mcp $version is already on PyPI; skipping publish. Bump the version to release."
|
||||
echo "::warning::tencent-weknora-mcp $version is already on PyPI; skipping publish. Bump pyproject.toml (and synced version strings) to release new changes."
|
||||
else
|
||||
echo "should_publish=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -7,10 +7,23 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.1.1] - 2026-07-30
|
||||
|
||||
### 变更
|
||||
- 官方 PyPI 包名改为 **`tencent-weknora-mcp`**(由 Tencent/WeKnora 仓库 CI 通过 Trusted Publishing 发布)。
|
||||
原社区包 `weknora-mcp` 非官方维护,请迁移安装命令。
|
||||
- 项目 URL 指向 [Tencent/WeKnora](https://github.com/Tencent/WeKnora) 官方仓库(`mcp-server/` 目录)。
|
||||
|
||||
### 修复
|
||||
- HTTP 传输恢复 `stateless_http=True`,与迁移前 `StreamableHTTPSessionManager(stateless=True)` 行为一致。
|
||||
- SSE 传输恢复消息端点 `/sse/messages/`,与迁移前路由一致。
|
||||
- `WeKnoraClient` 使用线程本地 `requests.Session`,避免 MCP 2.x 在线程池中并发调用时出现 Session 竞态。
|
||||
- 文件上传(`create_knowledge_from_file`)尊重 `WEKNORA_VERIFY_SSL` 设置。
|
||||
|
||||
### 注意
|
||||
- 工具执行失败时,MCPServer 2.x 返回 `CallToolResult(isError=True)`(`ToolError`),
|
||||
不再像旧版低层 API 那样以成功响应的文本块返回 `"Error executing …"` 前缀。
|
||||
仅解析 `content[0].text` 的客户端通常无感;依赖 `isError` 标志的集成方行为会更符合 MCP 规范。
|
||||
|
||||
## [1.1.0] - 2026-07-30
|
||||
|
||||
|
|
@ -86,7 +99,7 @@
|
|||
|
||||
### 文件结构
|
||||
```
|
||||
WeKnoraMCP/
|
||||
WeKnora/mcp-server/
|
||||
├── __init__.py # 包初始化文件
|
||||
├── main.py # 主入口点 (推荐)
|
||||
├── run.py # 便捷启动脚本
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ python main.py --verbose
|
|||
}
|
||||
```
|
||||
|
||||
项目仓库: https://github.com/NannaOlympicBroadcast/WeKnoraMCP
|
||||
项目仓库: https://github.com/Tencent/WeKnora/tree/main/mcp-server
|
||||
|
||||
### 与其他 MCP 客户端集成
|
||||
参考各客户端的文档,配置服务器启动命令和环境变量。
|
||||
|
|
|
|||
|
|
@ -122,13 +122,14 @@ python main.py --check-only
|
|||
|
||||
### 项目结构
|
||||
```
|
||||
WeKnoraMCP/
|
||||
WeKnora/mcp-server/
|
||||
├── __init__.py # 包初始化文件
|
||||
├── main.py # 主入口点
|
||||
├── run_server.py # 原始启动脚本
|
||||
├── weknora_mcp_server.py # MCP 服务器实现
|
||||
├── requirements.txt # 依赖列表
|
||||
├── setup.py # 安装脚本
|
||||
├── pyproject.toml # 项目元数据(PyPI: tencent-weknora-mcp)
|
||||
├── MANIFEST.in # 包含文件清单
|
||||
├── LICENSE # 许可证
|
||||
├── README.md # 项目说明
|
||||
|
|
@ -204,4 +205,4 @@ sudo systemctl start weknora-mcp
|
|||
1. 查看日志输出
|
||||
2. 检查环境配置
|
||||
3. 参考故障排除部分
|
||||
4. 提交 Issue 到项目仓库: https://github.com/NannaOlympicBroadcast/WeKnoraMCP/issues
|
||||
4. 提交 Issue 到项目仓库: https://github.com/Tencent/WeKnora/issues
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
> 更推荐使用`uv`来运行基于python的MCP服务。
|
||||
>
|
||||
> 也可通过 PyPI 安装:`pip install weknora-mcp`(包名 `weknora-mcp`,非 `weknora-mcp-server`)。
|
||||
> 也可通过 PyPI 安装:`pip install tencent-weknora-mcp`,或使用 `uvx --from tencent-weknora-mcp weknora-mcp-server`(官方包名 `tencent-weknora-mcp`,由 [Tencent/WeKnora](https://github.com/Tencent/WeKnora) 维护)。
|
||||
|
||||
## 1. 安装 uv
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
## 📁 项目结构
|
||||
|
||||
```
|
||||
WeKnoraMCP/
|
||||
WeKnora/mcp-server/
|
||||
├── 📦 核心文件
|
||||
│ ├── __init__.py # 包初始化文件
|
||||
│ ├── weknora_mcp_server.py # MCP 服务器核心实现
|
||||
|
|
@ -272,6 +272,7 @@ python test_module.py # 运行测试
|
|||
---
|
||||
|
||||
**项目状态**: ✅ 完成并可投入使用
|
||||
**项目仓库**: https://github.com/NannaOlympicBroadcast/WeKnoraMCP
|
||||
**项目仓库**: https://github.com/Tencent/WeKnora/tree/main/mcp-server
|
||||
**PyPI 包名**: `tencent-weknora-mcp`
|
||||
**最后更新**: 2025年10月
|
||||
**版本**: 1.0.0
|
||||
|
|
@ -61,10 +61,13 @@ python main.py --version # 显示版本信息
|
|||
### 从 PyPI 安装
|
||||
|
||||
```bash
|
||||
pip install weknora-mcp
|
||||
pip install tencent-weknora-mcp
|
||||
# 或使用 uvx 直接运行(无需预安装)
|
||||
uvx --from tencent-weknora-mcp weknora-mcp-server
|
||||
```
|
||||
|
||||
> PyPI 包名为 **`weknora-mcp`**(请勿与第三方包 `weknora-mcp-server` 混淆)。
|
||||
> 官方 PyPI 包名为 **`tencent-weknora-mcp`**(Tencent/WeKnora 维护,Trusted Publishing 发布)。
|
||||
> 旧社区包 `weknora-mcp` 请不要再使用。
|
||||
> 安装后命令行入口仍为 `weknora-mcp-server` / `weknora-server`。
|
||||
|
||||
### 开发模式安装
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ WeKnora MCP Server Package
|
|||
A Model Context Protocol server that provides access to the WeKnora knowledge management API.
|
||||
"""
|
||||
|
||||
__version__ = "1.1.0"
|
||||
__version__ = "1.1.1"
|
||||
__author__ = "WeKnora Team"
|
||||
__description__ = "WeKnora MCP Server - Model Context Protocol server for WeKnora API"
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ def parse_arguments():
|
|||
parser.add_argument("--verbose", "-v", action="store_true", help="启用详细日志输出")
|
||||
|
||||
parser.add_argument(
|
||||
"--version", action="version", version="WeKnora MCP Server 1.1.0"
|
||||
"--version", action="version", version="WeKnora MCP Server 1.1.1"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
|
|||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "weknora-mcp"
|
||||
version = "1.1.0"
|
||||
name = "tencent-weknora-mcp"
|
||||
version = "1.1.1"
|
||||
description = "WeKnora MCP Server - Model Context Protocol server for WeKnora API"
|
||||
readme = "README.md"
|
||||
license = {text = "MIT"}
|
||||
|
|
@ -51,11 +51,11 @@ test = [
|
|||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/NannaOlympicBroadcast/WeKnoraMCP"
|
||||
Homepage = "https://github.com/Tencent/WeKnora"
|
||||
Documentation = "https://docs.weknora.com"
|
||||
Repository = "https://github.com/NannaOlympicBroadcast/WeKnoraMCP"
|
||||
"Bug Reports" = "https://github.com/NannaOlympicBroadcast/WeKnoraMCP/issues"
|
||||
Changelog = "https://github.com/NannaOlympicBroadcast/WeKnoraMCP/blob/main/CHANGELOG.md"
|
||||
Repository = "https://github.com/Tencent/WeKnora/tree/main/mcp-server"
|
||||
"Bug Reports" = "https://github.com/Tencent/WeKnora/issues"
|
||||
Changelog = "https://github.com/Tencent/WeKnora/blob/main/mcp-server/CHANGELOG.md"
|
||||
|
||||
[project.scripts]
|
||||
weknora-mcp-server = "main:sync_main"
|
||||
|
|
|
|||
|
|
@ -32,14 +32,14 @@ def read_requirements():
|
|||
|
||||
|
||||
setup(
|
||||
name="weknora-mcp",
|
||||
version="1.1.0",
|
||||
name="tencent-weknora-mcp",
|
||||
version="1.1.1",
|
||||
author="WeKnora Team",
|
||||
author_email="support@weknora.com",
|
||||
description="WeKnora MCP Server - Model Context Protocol server for WeKnora API",
|
||||
long_description=read_readme(),
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/NannaOlympicBroadcast/WeKnoraMCP",
|
||||
url="https://github.com/Tencent/WeKnora/tree/main/mcp-server",
|
||||
py_modules=["weknora_mcp_server", "upload_paths", "main", "run_server", "run", "test_module"],
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class ModuleIntegrationTest(unittest.TestCase):
|
|||
|
||||
def test_pyproject_metadata(self):
|
||||
text = (MCP_SERVER_DIR / "pyproject.toml").read_text(encoding="utf-8")
|
||||
self.assertIn("weknora-mcp", text)
|
||||
self.assertIn("tencent-weknora-mcp", text)
|
||||
self.assertIn("weknora-mcp-server", text)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1502,6 +1502,48 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/ec/bb/2799cc2ede3ed41131f8975621e7213dfc7ef4acbbaadfa440f32500c370/starlette-1.3.1-py3-none-any.whl", hash = "sha256:c7372aae11c3c3f26a42df7bd626cec2f47d03483d261d369516a615a53714c6", size = 73632, upload-time = "2026-06-12T09:23:10.017Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tencent-weknora-mcp"
|
||||
version = "1.1.1"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "mcp" },
|
||||
{ name = "requests" },
|
||||
{ name = "starlette" },
|
||||
{ name = "uvicorn" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
dev = [
|
||||
{ name = "black" },
|
||||
{ name = "flake8" },
|
||||
{ name = "mypy" },
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-asyncio" },
|
||||
]
|
||||
test = [
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-asyncio" },
|
||||
{ name = "pytest-cov" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "black", marker = "extra == 'dev'", specifier = ">=23.0" },
|
||||
{ name = "flake8", marker = "extra == 'dev'", specifier = ">=6.0" },
|
||||
{ name = "mcp", specifier = ">=2,<3" },
|
||||
{ name = "mypy", marker = "extra == 'dev'", specifier = ">=1.0" },
|
||||
{ name = "pytest", marker = "extra == 'dev'", specifier = ">=7.0" },
|
||||
{ name = "pytest", marker = "extra == 'test'", specifier = ">=7.0" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.21.0" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'test'", specifier = ">=0.21.0" },
|
||||
{ name = "pytest-cov", marker = "extra == 'test'", specifier = ">=4.0" },
|
||||
{ name = "requests", specifier = ">=2.31.0" },
|
||||
{ name = "starlette", specifier = ">=0.27.0" },
|
||||
{ name = "uvicorn", specifier = ">=0.24.0" },
|
||||
]
|
||||
provides-extras = ["dev", "test"]
|
||||
|
||||
[[package]]
|
||||
name = "tomli"
|
||||
version = "2.4.1"
|
||||
|
|
@ -1608,45 +1650,3 @@ sdist = { url = "https://files.pythonhosted.org/packages/a2/65/b7c6c443ccc58678c
|
|||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/45/ec/dbb7e5a6b91f86bfb9eb7d2988a2730907b6a729875b949c7f022e8b88fa/uvicorn-0.51.0-py3-none-any.whl", hash = "sha256:5d38af6cd620f2ae3849fb44fd4879e0890aa1febe8d47eb355fb45d93fe6a5b", size = 73219, upload-time = "2026-07-08T10:59:04.44Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "weknora-mcp"
|
||||
version = "1.1.0"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "mcp" },
|
||||
{ name = "requests" },
|
||||
{ name = "starlette" },
|
||||
{ name = "uvicorn" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
dev = [
|
||||
{ name = "black" },
|
||||
{ name = "flake8" },
|
||||
{ name = "mypy" },
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-asyncio" },
|
||||
]
|
||||
test = [
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-asyncio" },
|
||||
{ name = "pytest-cov" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "black", marker = "extra == 'dev'", specifier = ">=23.0" },
|
||||
{ name = "flake8", marker = "extra == 'dev'", specifier = ">=6.0" },
|
||||
{ name = "mcp", specifier = ">=2,<3" },
|
||||
{ name = "mypy", marker = "extra == 'dev'", specifier = ">=1.0" },
|
||||
{ name = "pytest", marker = "extra == 'dev'", specifier = ">=7.0" },
|
||||
{ name = "pytest", marker = "extra == 'test'", specifier = ">=7.0" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.21.0" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'test'", specifier = ">=0.21.0" },
|
||||
{ name = "pytest-cov", marker = "extra == 'test'", specifier = ">=4.0" },
|
||||
{ name = "requests", specifier = ">=2.31.0" },
|
||||
{ name = "starlette", specifier = ">=0.27.0" },
|
||||
{ name = "uvicorn", specifier = ">=0.24.0" },
|
||||
]
|
||||
provides-extras = ["dev", "test"]
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ class WeKnoraClient:
|
|||
headers=headers,
|
||||
files=files,
|
||||
data=data,
|
||||
verify=self.verify_ssl,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
|
@ -555,7 +556,7 @@ class WeKnoraClient:
|
|||
# Initialize MCP server instance (mcp 2.x high-level API).
|
||||
# MCPServer (formerly FastMCP) builds input schemas from function type hints
|
||||
# and serializes plain return values automatically.
|
||||
mcp = MCPServer("weknora-server", version="1.1.0")
|
||||
mcp = MCPServer("weknora-server", version="1.1.1")
|
||||
# Initialize WeKnora API client with configuration
|
||||
client = WeKnoraClient(WEKNORA_BASE_URL, WEKNORA_API_KEY)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue