Skip to main content

WeKnora MCP Server - Model Context Protocol server for WeKnora API

Project description

WeKnora MCP Server

这是一个 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 tencent-weknora-mcp
# 或使用 uvx 直接运行(无需预安装)
uvx --from tencent-weknora-mcp weknora-mcp-server

官方 PyPI 包名为 tencent-weknora-mcp(Tencent/WeKnora 维护,Trusted Publishing 发布)。 旧社区包 weknora-mcp 请不要再使用。 安装后命令行入口仍为 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_url - 从 URL 创建知识
  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tencent_weknora_mcp-1.1.1.tar.gz (137.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tencent_weknora_mcp-1.1.1-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file tencent_weknora_mcp-1.1.1.tar.gz.

File metadata

  • Download URL: tencent_weknora_mcp-1.1.1.tar.gz
  • Upload date:
  • Size: 137.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tencent_weknora_mcp-1.1.1.tar.gz
Algorithm Hash digest
SHA256 c8c4c7315c9946a1f5dd61013e8d6c8ea6670d75d281c07e3e41487d65f2435b
MD5 e89666bb9df17c489d5406350bf96602
BLAKE2b-256 df88e38592a4db076471f0a719b94a0a0b2e57f4747839f61364ea7813d5fb31

See more details on using hashes here.

Provenance

The following attestation bundles were made for tencent_weknora_mcp-1.1.1.tar.gz:

Publisher: mcp-server.yml on Tencent/WeKnora

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tencent_weknora_mcp-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tencent_weknora_mcp-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29653a5cea437d51b20f2f0aefb53f6044657324bdddf99f9e324d6b2ce2e1ef
MD5 5023503cacc352311abe0b705dff2c2f
BLAKE2b-256 07a9ac1ab67287b854cfa46bc5d640ac75f49c07fbd11064441338ce7b016956

See more details on using hashes here.

Provenance

The following attestation bundles were made for tencent_weknora_mcp-1.1.1-py3-none-any.whl:

Publisher: mcp-server.yml on Tencent/WeKnora

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page