Skip to main content

MCP server for querying internal knowledge base

Project description

MCP Knowledge Query

这是一个 MCP (Model Context Protocol) 服务器,提供知识库检索工具。它允许 LLM 或者是其他 MCP 客户端查询配置的知识库。

功能

  • query_knowledge: 根据关键词检索知识库,支持配置 Top-K、分数阈值和查询扩展(Expand)。
  • add: 简单的加法工具(示例)。

安装

确保已安装 Python 3.10+ 和 uv (推荐) 或 pip

# 使用 uv 运行
uv run mcp-knowledge-query-kd

或者本地安装:

pip install -e .
mcp-knowledge-query-kd

配置

为了安全起见,本工具使用环境变量来管理敏感信息(AK/SK)。在使用前,请确保在运行环境中设置了以下环境变量:

必需的环境变量

  • HIAGENT_AK: 您的 Access Key
  • HIAGENT_SK: 您的 Secret Key
  • HIAGENT_WORKSPACE_ID: 您的工作空间 ID
  • HIAGENT_DATASET_IDS: 默认查询的知识库 ID 列表,用逗号分隔。如果不设置,将使用代码内置的默认 ID。

可选的环境变量

  • HIAGENT_HOST: API 服务地址,默认为 https://hiagent-api.x-peng.com

示例配置 (.env)

您可以参考 .env.example 文件配置您的环境。

如果您是通过 Claude Desktop 使用此 MCP Server,请在 Claude 的配置文件 (claude_desktop_config.json) 中添加环境变量:

{
  "mcpServers": {
    "knowledge-query": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mcp-knowledge-query-kd",
        "run",
        "mcp-knowledge-query-kd"
      ],
      "env": {
        "HIAGENT_AK": "your_actual_ak",
        "HIAGENT_SK": "your_actual_sk",
        "HIAGENT_WORKSPACE_ID": "your_workspace_id"
      }
    }
  }
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

mcp_knowledge_query_kd-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_knowledge_query_kd-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_knowledge_query_kd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b7f67eca157bed3762c16c8ee5d9e666ef93803a18eb26d710b433769382b27
MD5 c43519509f6fb7d257baedec88f195f6
BLAKE2b-256 e744f00b7de0a7812aa73631e455ef8103ffeb764831dce7121d6f9b1779c869

See more details on using hashes here.

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