Skip to main content

WeKnora MCP Server

⚠️ 已弃用(Deprecated)

WeKnora 现已内置 MCP Server:在「设置 → 发布与集成 → MCP Server」中为空间创建端点即可,支持多个端点、按端点选择知识库范围和工具,客户端通过 Streamable HTTP 直接连接 /mcp/<endpoint_id>,无需再部署本目录的 Python 进程。本目录仅为兼容旧部署保留,后续版本将移除。

WeKnora now ships a built-in MCP server: create endpoints under "Settings → Publish & Integrations → MCP Server", each with its own token, knowledge-base scope and tool list, and connect clients to /mcp/<endpoint_id> over Streamable HTTP. This Python package is kept only for existing deployments and will be removed in a future release.

这是一个 Model Context Protocol (MCP) 服务器,提供对 WeKnora 知识管理 API 的访问。

快速开始

推荐直接参考 MCP配置说明,无需进行以下操作。

1. 安装依赖

pip install -r requirements.txt

2. 配置环境变量

# Linux/macOS
export WEKNORA_BASE_URL="http://localhost:8080/api/v1"
export WEKNORA_API_KEY="your_api_key_here"

# Windows PowerShell
$env:WEKNORA_BASE_URL="http://localhost:8080/api/v1"
$env:WEKNORA_API_KEY="your_api_key_here"

# Windows CMD
set WEKNORA_BASE_URL=http://localhost:8080/api/v1
set WEKNORA_API_KEY=your_api_key_here

3. 运行服务器

推荐方式 - 使用主入口点:

python main.py

其他运行方式:

# 使用原始启动脚本
python run_server.py

# 使用便捷脚本
python run.py

# 直接运行服务器模块
python weknora_mcp_server.py

# 作为 Python 模块运行
python -m weknora_mcp_server

4. 命令行选项

python main.py --help                 # 显示帮助信息
python main.py --check-only           # 仅检查环境配置
python main.py --verbose              # 启用详细日志
python main.py --version              # 显示版本信息

安装为 Python 包

从 PyPI 安装

pip install wiki-server-mcp
# 或使用 uvx 直接运行(无需预安装)
uvx --from wiki-server-mcp weknora-mcp-server

官方 PyPI 包名为 wiki-server-mcp(由本仓库 CI 通过 Trusted Publishing 发布)。 安装后命令行入口仍为 weknora-mcp-server / weknora-server。

开发模式安装

pip install -e .

安装后可以使用命令行工具:

weknora-mcp-server
# 或
weknora-server

生产模式安装

pip install .

构建分发包

# 使用 setuptools
python setup.py sdist bdist_wheel

# 使用现代构建工具
pip install build
python -m build

测试模组

运行测试脚本验证模组是否正常工作:

python test_module.py

功能特性

该 MCP 服务器提供以下工具:

空间管理

  • create_tenant - 创建新空间
  • list_tenants - 列出所有空间

知识库管理

  • create_knowledge_base - 创建知识库
  • list_knowledge_bases - 列出知识库
  • get_knowledge_base - 获取知识库详情
  • delete_knowledge_base - 删除知识库
  • hybrid_search - 混合搜索

知识管理

  • create_knowledge_from_file - 从本地文件创建知识
  • create_knowledge_from_url - 从 URL 创建知识
  • create_knowledge_from_text - 从文本创建知识
  • update_knowledge_from_text - 更新手工 Markdown 知识,可重新索引或保存为草稿
  • list_knowledge - 列出知识
  • get_knowledge - 获取知识详情
  • delete_knowledge - 删除知识

模型管理

  • create_model - 创建模型
  • list_models - 列出模型
  • get_model - 获取模型详情

会话管理

  • create_session - 创建聊天会话
  • get_session - 获取会话详情
  • list_sessions - 列出会话
  • delete_session - 删除会话

聊天功能

  • chat - 发送聊天消息

块管理

  • list_chunks - 列出知识块
  • delete_chunk - 删除知识块

故障排除

如果遇到导入错误,请确保:

  1. 已安装所有必需的依赖包
  2. Python 版本兼容(推荐 3.10+)
  3. 没有文件名冲突(避免使用 mcp.py 作为文件名)

调用效果

118d078426f42f3d4983c13386085d7f

Local upload directory boundary

All transports, including stdio, restrict local file uploads to the working directory by default. Set MCP_ALLOWED_UPLOAD_DIRS to a comma-separated list of trusted absolute directories when additional roots are needed. Starting in a filesystem root requires an explicit directory configuration. Paths and symbolic links resolving outside the selected roots are rejected.

Release files for wiki-server-mcp 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wiki-server-mcp 1.1.1
File Size Uploaded
wiki_server_mcp-1.1.1.tar.gz 163.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wiki-server-mcp 1.1.1
File Interpreter ABI Platform
wiki_server_mcp-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 190.6 kB

Release files / wiki_server_mcp-1.1.1.tar.gz

Download URL wiki_server_mcp-1.1.1.tar.gz
Size 163.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1857bfc4be5b698771b2bac164ee7ba1c119b76255076cf8dbbc59c0122c1444
BLAKE2b-256 checksum
How to use checksums
29d0489f1f3b52007100184aa3af8bd2b67d2dffab9e0175a71881d4f03dc887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / wiki_server_mcp-1.1.1-py3-none-any.whl

Download URL wiki_server_mcp-1.1.1-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ca47a80074a48e73e0bfe60eba3c1c9e0f9c34ad3026ab9206c9b5753b7cb7f
BLAKE2b-256 checksum
How to use checksums
98582106675d1cd1518c1d419e0f03077927e527bd3919887432cadf7084fed5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page