You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(knowledgebase): migrate to MCP 2026 and add Viking API Key authentication (#428)
* feat: migrate knowledgebase server to MCP 2026
* feat(knowledgebase): support Viking API key authentication
* feat(knowledgebase): expose document metadata in search results
* fix(knowledgebase): prefer API key authentication
* docs(knowledgebase): install from PyPI
The Streamable HTTP endpoint is `http://127.0.0.1:8000/mcp` by default.
70
+
Set `MCP_SERVER_HOST=0.0.0.0` when running behind a trusted gateway.
71
+
72
+
### MCP protocol compatibility
73
+
74
+
This server uses MCP Python SDK 2.x and speaks protocol revision `2026-07-28`.
75
+
Modern clients use the stateless per-request protocol and `server/discover`;
76
+
the same process also supports older handshake-based clients automatically.
77
+
Legacy HTTP+SSE is intentionally not exposed because it is deprecated by the
78
+
`2026-07-28` specification.
79
+
80
+
The HTTP endpoint does not turn the configured API key or VolcEngine AK/SK into
81
+
client authentication. Protect remote deployments with an authentication
82
+
gateway or MCP-compatible OAuth, and never expose the service credentials to
83
+
callers.
84
+
59
85
### Available Tools
60
86
61
87
#### add_doc
@@ -66,7 +92,7 @@ Add a document to a collection in your project.
66
92
add_doc(
67
93
collection_name="collection_name",
68
94
add_type="url",
69
-
doc_id="_mcp_server_auto_gen_doc_id_xxxxxxx",
95
+
doc_id="mcp_server_auto_gen_doc_id_xxxxxxx",
70
96
doc_name="doc_xxxx",
71
97
doc_type="pdf",
72
98
url="http://xxxxx.pdf"
@@ -76,8 +102,8 @@ add_doc(
76
102
Parameters:
77
103
-`collection_name` (required): the name of the collection you want to add document .
78
104
-`add_type` (required): the type of the document to add. so far only support "url" now.
79
-
-`doc_id` (required): 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. Length requirement: [1, 128], you can use a format like "_mcp_server_auto_gen_doc_id_xxxxxxx.
80
-
-`doc_name` (required): 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 format like "_mcp_server_auto_gen_doc_name_xxxxxxx.
105
+
-`doc_id` (required): 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. Length requirement: [1, 128], you can use a format like "mcp_server_auto_gen_doc_id_xxxxxxx".
106
+
-`doc_name` (required): the name of the document to add. You can generate a unique doc_name based on the user-provided URL and timestamp. The length of doc_name must be between 1 and 256; for example, "mcp_server_auto_gen_doc_name_xxxxxxx".
81
107
-`doc_type` (required): 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". 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.
82
108
-`url` (required): the url of the document to add. user should give a valid url, we will add the doc to the collection.
83
109
@@ -88,7 +114,7 @@ Get information about document by collection_name and doc_id .
88
114
```python
89
115
get_doc(
90
116
collection_name="collection_name",
91
-
doc_id="_mcp_server_auto_gen_doc_id_xxxxxxx",
117
+
doc_id="mcp_server_auto_gen_doc_id_xxxxxxx",
92
118
)
93
119
```
94
120
@@ -128,19 +154,24 @@ Search for knowledge in the configured collection based on a query.
128
154
search_knowledge(
129
155
query="How to reset my password?",
130
156
limit=3,
131
-
collection_name=None,
157
+
collection_name="collection_name",
132
158
doc_filter=None,
133
159
)
134
160
```
135
161
136
162
Parameters:
137
163
-`query` (required): The search query string
138
-
-`limit` (optional): Maximum number of results to return (default: 3)
139
-
-`collection_name` (optional): Knowledge base collection name to search. If not provided, llm will choose some collections to search based on the description of collection
164
+
-`limit` (optional): Maximum number of results to return, from 1 to 100 (default: 3)
165
+
-`collection_name` (required): Knowledge Base collection name to search
140
166
-`doc_filter` (optional): the filter is used to filter search results(default: None), which is structured as a JSON object with the following key components:
141
167
-`op` (string, required): specifies the query operator that defines the filtering logic. Valid values are 'must' and 'must_not', 'must' means results must satisfy the condition (inclusion filter),'must_not' means results must not satisfy the condition (exclusion filter).
142
168
-`field` (string, required): indicates the specific document field to apply the filter on (e.g., "doc_id").
143
169
-`conds` (array, required): contains the concrete values used for filtering. The data type of elements in the array depends on the field.
170
+
171
+
Each result contains the chunk `id` and `content`, plus the source document's
172
+
`doc_id` and `doc_name`. The metadata fields are `null` when Viking does not
173
+
provide them. A non-null `doc_id` can be passed directly to `get_doc`.
174
+
144
175
## MCP Integration
145
176
146
177
To add this server to your MCP configuration, add the following to your MCP settings file:
@@ -152,12 +183,11 @@ To add this server to your MCP configuration, add the following to your MCP sett
0 commit comments