Skip to content

Commit c1a7c2b

Browse files
authored
Add README in Chinese (#102)
* 提交知识库和向量库的mcp tools * 知识库和向量库的mcp tools修改comment * 火山知识库增加add_doc和get_doc两个tools * 火山知识库增加add_doc和get_doc两个tools * 火山知识库增加add_doc和get_doc两个tools * 火山知识库和向量库增加中文版的README
1 parent cb1e7a5 commit c1a7c2b

3 files changed

Lines changed: 273 additions & 2 deletions

File tree

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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).

server/mcp_server_knowledgebase/src/mcp_server_knowledgebase/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def add_doc(
4242
collection_name: the name of the knowledge base collection to add document to.
4343
add_type: the type of the document to add. so far only support "url" now. so you must assign this parameter to "url".
4444
doc_id: you should generate a unique doc_id based on user's given url and timestamp, the doc_id can only use English letters, numbers, and underscores , and must start with an English letter. It cannot be empty.
45-
Length requirement: [1, 128], you can use a format like "_mcp_server_auto_gen_doc_id_xxxxxxx.
45+
Length requirement: [1, 128], you can use a format like "mcp_server_auto_gen_doc_id_xxxxxxx.
4646
doc_name: the name of the document to add. you can1 generate a unique doc_name based on user given url and timestamp. the length of doc_name must between 1 and 256. you can use a
47-
format like "_mcp_server_auto_gen_doc_name_xxxxxxx.
47+
format like "mcp_server_auto_gen_doc_name_xxxxxxx.
4848
doc_type: the type of the document to add. for structured document, we support xlsx, csv,jsonl, for unstructured document, wu support txt, doc, docx, pdf, markdown, faq.xlsx, pptx".
4949
you should judge the doc_type based on user's given url and judge if we support this doc type. if supported, assign this parameter.
5050
url: the url of the document to add. user should give a valid url, we will add the doc to the collection.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# VikingDB MCP Server
2+
3+
## 产品描述
4+
5+
VikingDB MCP Server 是一个模型上下文协议(Model Context Protocol)服务器,为MCP客户端(如Claude Desktop)提供与火山引擎向量库VikingDB服务交互的能力。可以允许您从您的向量库中查询结果。
6+
7+
## 分类
8+
其他
9+
10+
## 功能
11+
12+
- 在向量库中查询结果
13+
14+
## 使用指南
15+
16+
### 前置准备
17+
- Python 3.10+
18+
- UV
19+
- API credentials (AK/SK)
20+
21+
### 安装
22+
克隆仓库:
23+
```bash
24+
git clone git@github.com:volcengine/mcp-server.git
25+
```
26+
27+
### 使用方法
28+
启动服务器:
29+
30+
#### UV
31+
```bash
32+
cd mcp-server/server/mcp_server_vikingdb
33+
uv run mcp-server-vikingdb
34+
35+
# 使用sse模式启动(默认为stdio)
36+
uv run mcp-server-vikingdb -t sse
37+
```
38+
39+
使用客户端与服务器交互:
40+
```
41+
Trae | Cursor | Claude Desktop | Cline | ...
42+
```
43+
44+
## 配置
45+
46+
### 环境变量
47+
48+
以下环境变量可用于配置MCP服务器:
49+
50+
| 环境变量 | 描述 | 默认值 |
51+
|----------------------------|--------------------------|-------|
52+
| `VOLCENGINE_ACCESS_KEY` | 火山引擎账号ACCESSKEY | - |
53+
| `VOLCENGINE_SECRET_KEY` | 火山引擎账号SECRETKEY | - |
54+
| `VIKING_DB_COLLECTION_NAME`| 要查询的vikingdb的colletion名称 | - |
55+
| `VIKING_DB_INDEX_NAME` | 要查询的colletion的index名称 | - |
56+
| `VIKING_DB_REGION` | vikingdb区域,默认值 | cn-north-1 |
57+
| `PORT` | MCP server监听端口 | `8000` |
58+
59+
60+
## 可用工具
61+
62+
VikingDB MCP Server 仅提供查询结果的功能。
63+
64+
- `search_vikingdb`: [在指定collection和index中搜索结果](https://www.volcengine.com/docs/84313/1580544)
65+
66+
```python
67+
search_vikingdb(
68+
query="How to reset my password?",
69+
limit=3,
70+
collection_name=None,
71+
index_name=None,
72+
)
73+
```
74+
75+
Parameters:
76+
- `query` (必须): 查询字符串
77+
- `limit` (可选): 返回的结果条数 (default: 3)
78+
- `collection_name` (可选): 要搜索的vikingdb的colletion名称。如果未提供,则使用全局配置的colletion名称
79+
- `index_name` (可选):要搜索的集合的 vikingdb 索引名称。如果未提供,则使用全局配置的索引名称
80+
81+
82+
83+
### uvx 启动
84+
```json
85+
{
86+
"mcpServers": {
87+
"vikingdb": {
88+
"command": "uvx",
89+
"args": [
90+
"--from",
91+
"git+https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_vikingdb",
92+
"mcp-server-vikingdb",
93+
],
94+
"env": {
95+
"VOLCENGINE_ACCESS_KEY": "your-access-key",
96+
"VOLCENGINE_SECRET_KEY": "your-secret-key",
97+
"VIKING_DB_COLLECTION_NAME": "your-vikingdb-collection-name",
98+
"VIKING_DB_INDEX_NAME": "your-vikingdb-index-name",
99+
"VIKING_DB_REGION": "your-vikingdb-collection-region"
100+
},
101+
}
102+
}
103+
}
104+
```
105+
106+
## 证书
107+
volcengine/mcp-server is licensed under the [MIT License](https://github.com/volcengine/mcp-server/blob/main/LICENSE).

0 commit comments

Comments
 (0)