|
| 1 | +# Viking Knowledge Base MCP Server |
| 2 | + |
| 3 | +## 产品描述 |
| 4 | + |
| 5 | +Viking Knowledge Base MCP Server 是一个模型上下文协议(Model Context Protocol)服务器,为MCP客户端(如Claude Desktop)提供与火山引擎知识库KnowledgeBase服务交互的能力。知识库MCP Server支持获取用户账号下的所有知识库列表,并在指定的知识库中检索结果。同时支持您以url上传的方式将文档上传到您的知识库,也支持查看文档和知识库的状态信息。 |
| 6 | + |
| 7 | +## 分类 |
| 8 | +其他 |
| 9 | + |
| 10 | +## 功能 |
| 11 | + |
| 12 | +- 获取用户账号下的所有知识库列表 |
| 13 | +- 在指定的知识库中检索结果 |
| 14 | +- 以url上传的方式将文档上传到您的知识库 |
| 15 | +- 查看文档的处理状态 |
| 16 | +- 查看知识库的状态 |
| 17 | + |
| 18 | +## 使用指南 |
| 19 | + |
| 20 | +### 前置准备 |
| 21 | +- Python 3.10+ |
| 22 | +- UV |
| 23 | +- API credentials (AK/SK) |
| 24 | + |
| 25 | +### 安装 |
| 26 | +克隆仓库: |
| 27 | +```bash |
| 28 | +git clone git@github.com:volcengine/mcp-server.git |
| 29 | +``` |
| 30 | + |
| 31 | +### 使用方法 |
| 32 | +启动服务器: |
| 33 | + |
| 34 | +#### UV |
| 35 | +```bash |
| 36 | +cd mcp-server/server/mcp_server_knowledgebase |
| 37 | +uv run mcp-server-knowledgebase |
| 38 | + |
| 39 | +# 使用sse模式启动(默认为stdio) |
| 40 | +uv run mcp-server-knowledgebase -t sse |
| 41 | +``` |
| 42 | + |
| 43 | +使用客户端与服务器交互: |
| 44 | +``` |
| 45 | +Trae | Cursor | Claude Desktop | Cline | ... |
| 46 | +``` |
| 47 | + |
| 48 | +## 配置 |
| 49 | + |
| 50 | +### 环境变量 |
| 51 | + |
| 52 | +以下环境变量可用于配置MCP服务器: |
| 53 | + |
| 54 | +| 环境变量 | 描述 | 默认值 | |
| 55 | +|--------------------------|-----------------|-------| |
| 56 | +| `VOLCENGINE_ACCESS_KEY` | 火山引擎账号ACCESSKEY | - | |
| 57 | +| `VOLCENGINE_SECRET_KEY` | 火山引擎账号SECRETKEY | - | |
| 58 | +| `KNOWLEDGE_BASE_PROJECT` | 知识库所属项目 | - | |
| 59 | +| `KNOWLEDGE_BASE_REGION` | 知识库区域 | cn-north-1 | |
| 60 | +| `PORT` | MCP server监听端口 | `8000` | |
| 61 | + |
| 62 | + |
| 63 | +## 可用工具 |
| 64 | + |
| 65 | +Knowledge Base MCP Server 提供以下功能 |
| 66 | + |
| 67 | +- `add_doc`: [上传文档(目前仅支持url)](https://www.volcengine.com/docs/84313/1254624) |
| 68 | +- `get_doc`: [获取指定文档的状态](https://www.volcengine.com/docs/84313/1254615) |
| 69 | +- `get_collection`: [获取知识库的详细信息](https://www.volcengine.com/docs/84313/1254602) |
| 70 | +- `list_colletions`: [获取指定账户和Project下的知识库列表](https://www.volcengine.com/docs/84313/1254596) |
| 71 | +- `search_knowledge`: [在指定知识库中进行搜索](https://www.volcengine.com/docs/84313/1350012) |
| 72 | + |
| 73 | +#### add_doc |
| 74 | + |
| 75 | +```python |
| 76 | +add_doc( |
| 77 | + collection_name="collection_name", |
| 78 | + add_type="url", |
| 79 | + doc_id="_mcp_server_auto_gen_doc_id_xxxxxxx", |
| 80 | + doc_name="doc_xxxx", |
| 81 | + doc_type="pdf", |
| 82 | + url="http://xxxxx.pdf" |
| 83 | +) |
| 84 | +``` |
| 85 | + |
| 86 | +Parameters: |
| 87 | +- `collection_name` (必须): 要上传文档的知识库名称 |
| 88 | +- `add_type` (必须): 上传文档的添加类型, mcp server目前仅支持url |
| 89 | +- `doc_id` (必须): url上传方式需要指定doc_id |
| 90 | +- `doc_name` (必须): url 上传方式需要指定doc_name. |
| 91 | +- `doc_type` (必须): 要添加的文档的类型。对于结构化文档,支持 xlsx、csv 和 jsonl;对于非结构化文档,我们支持 txt、doc、docx、pdf、markdown、faq.xlsx 和 pptx |
| 92 | +- `url` (必须): 待添加文档的 URL |
| 93 | + |
| 94 | +#### get_doc |
| 95 | + |
| 96 | +```python |
| 97 | +get_doc( |
| 98 | + collection_name="collection_name", |
| 99 | + doc_id="_mcp_server_auto_gen_doc_id_xxxxxxx", |
| 100 | +) |
| 101 | +``` |
| 102 | + |
| 103 | +Parameters: |
| 104 | +- `collection_name` (必须): 要获取信息的文档所属的知识库 |
| 105 | +- `doc_id` (必须): 要获取信息的文档ID |
| 106 | + |
| 107 | +#### get_collection |
| 108 | + |
| 109 | +```python |
| 110 | +get_collection( |
| 111 | + collection_name="collection_name", |
| 112 | +) |
| 113 | +``` |
| 114 | + |
| 115 | +Parameters: |
| 116 | +- `collection_name` (必须): 要获取信息的知识库名称 |
| 117 | + |
| 118 | + |
| 119 | +#### list_collections |
| 120 | + |
| 121 | +```python |
| 122 | +list_collections() |
| 123 | +``` |
| 124 | + |
| 125 | +#### search_knowledge |
| 126 | + |
| 127 | +```python |
| 128 | +search_knowledge( |
| 129 | + query="How to reset my password?", |
| 130 | + limit=3, |
| 131 | + collection_name=None |
| 132 | +) |
| 133 | +``` |
| 134 | + |
| 135 | +Parameters: |
| 136 | +- `query` (必须): 搜索查询字符串 |
| 137 | +- `limit` (可选): 返回的最大结果数(默认值:3) |
| 138 | +- `collection_name` (可选): 要搜索的知识库名称。如果未提供,LLM将根据您账号列表下的知识库描述选择自动选择要搜索的知识库 |
| 139 | + |
| 140 | + |
| 141 | +### uvx 启动 |
| 142 | +```json |
| 143 | +{ |
| 144 | + "mcpServers": { |
| 145 | + "knowledgebase": { |
| 146 | + "command": "uvx", |
| 147 | + "args": [ |
| 148 | + "--from", |
| 149 | + "git+https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_knowledgebase", |
| 150 | + "mcp-server-knowledgebase", |
| 151 | + ], |
| 152 | + "env": { |
| 153 | + "VOLCENGINE_ACCESS_KEY": "your-access-key", |
| 154 | + "VOLCENGINE_SECRET_KEY": "your-secret-key", |
| 155 | + "KNOWLEDGE_BASE_PROJECT": "your-project-name", |
| 156 | + "KNOWLEDGE_BASE_REGION": "your-region" |
| 157 | + }, |
| 158 | + } |
| 159 | + } |
| 160 | +} |
| 161 | +``` |
| 162 | + |
| 163 | +## 证书 |
| 164 | +volcengine/mcp-server is licensed under the [MIT License](https://github.com/volcengine/mcp-server/blob/main/LICENSE). |
0 commit comments