@2kw/ai-mcp-server 8.0.0-dev.4 → 8.0.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/files.js +9 -8
- package/dist/tools/knowledge.js +7 -2
- package/package.json +1 -1
package/dist/tools/files.js
CHANGED
|
@@ -6,22 +6,23 @@ import { getMimeType } from "../mime.js";
|
|
|
6
6
|
const FilePurpose = z.enum(["agent_input", "knowledge"]);
|
|
7
7
|
export function register(server, client) {
|
|
8
8
|
// ── list_files ────────────────────────────────────────────────────────────
|
|
9
|
-
server.tool("2kw_list_files", "List the organization's files
|
|
9
|
+
server.tool("2kw_list_files", "List the organization's files, newest first by default, optionally narrowed by purpose. When more files exist, pass the returned last id as after.", {
|
|
10
10
|
purpose: FilePurpose.optional().describe("Narrow the list to one purpose"),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
limit: z.number().optional().default(20).describe("How many files to list (1-100)"),
|
|
12
|
+
after: z.string().optional().describe("List the files after this file id (the previous list's last id)"),
|
|
13
|
+
order: z.enum(["asc", "desc"]).optional().default("desc").describe("asc = oldest first, desc = newest first"),
|
|
14
|
+
}, async ({ purpose, limit, after, order }) => {
|
|
14
15
|
try {
|
|
15
16
|
const { data } = await client.GET("/v1/files", {
|
|
16
|
-
params: { query: { purpose,
|
|
17
|
+
params: { query: { purpose, limit, after, order } },
|
|
17
18
|
});
|
|
18
|
-
const
|
|
19
|
-
const
|
|
19
|
+
const lines = (data?.data ?? []).map((f) => `- ${f.filename} (id: ${f.id}, purpose: ${f.purpose}, bytes: ${f.bytes})`);
|
|
20
|
+
const more = data?.has_more ? `\nMore files: pass after=${data.last_id}` : "";
|
|
20
21
|
return {
|
|
21
22
|
content: [
|
|
22
23
|
{
|
|
23
24
|
type: "text",
|
|
24
|
-
text: `Files
|
|
25
|
+
text: `Files:\n${lines.join("\n") || "(none)"}${more}`,
|
|
25
26
|
},
|
|
26
27
|
],
|
|
27
28
|
};
|
package/dist/tools/knowledge.js
CHANGED
|
@@ -58,7 +58,7 @@ const knowledgeBaseFields = {
|
|
|
58
58
|
parentChunkSize: z.number().int().min(100).max(8000).optional().describe("Parent chunk size for hierarchical chunking (100-8000), must exceed chunkSize"),
|
|
59
59
|
hybridSearchEnabled: z.boolean().optional().describe("Enable hybrid dense + lexical search"),
|
|
60
60
|
rerankerProviderId: z.string().optional().describe("Provider id used for reranking. builtin is refused: there is no built-in reranker."),
|
|
61
|
-
textSearchLanguage: z.enum(TEXT_SEARCH_LANGUAGES).optional().describe("Text-search language for the lexical leg (default simple on create). On update,
|
|
61
|
+
textSearchLanguage: z.enum(TEXT_SEARCH_LANGUAGES).optional().describe("Text-search language for the lexical leg (default simple on create). On update, a language other than the active and the pending one starts a reindex in the background; omitting it, or sending the active or pending language back, leaves both untouched."),
|
|
62
62
|
};
|
|
63
63
|
function buildKnowledgeBaseBody(params) {
|
|
64
64
|
const body = {
|
|
@@ -77,6 +77,7 @@ function buildKnowledgeBaseBody(params) {
|
|
|
77
77
|
"hybridSearchEnabled",
|
|
78
78
|
"rerankerProviderId",
|
|
79
79
|
"textSearchLanguage",
|
|
80
|
+
"cancelTextSearchReindex",
|
|
80
81
|
]) {
|
|
81
82
|
if (params[key] !== undefined)
|
|
82
83
|
body[key] = params[key];
|
|
@@ -161,7 +162,11 @@ export function register(server, client) {
|
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
164
|
// ── update_knowledge_base ────────────────────────────────────────────────
|
|
164
|
-
server.tool("2kw_update_knowledge_base", "Apply the request's fields to a knowledge base and snapshot the result as the next configuration version. name, slug, embeddingProviderId, embeddingModel and embeddingDim are required on every update; embeddingDim cannot actually change — it must match the existing value or the update is rejected.", {
|
|
165
|
+
server.tool("2kw_update_knowledge_base", "Apply the request's fields to a knowledge base and snapshot the result as the next configuration version. name, slug, embeddingProviderId, embeddingModel and embeddingDim are required on every update; embeddingDim cannot actually change — it must match the existing value or the update is rejected.", {
|
|
166
|
+
knowledgeBaseId: z.string().describe("The knowledge base ID"),
|
|
167
|
+
...knowledgeBaseFields,
|
|
168
|
+
cancelTextSearchReindex: z.boolean().optional().describe("true abandons the text-search reindex in progress and keeps the active language. Applied before textSearchLanguage."),
|
|
169
|
+
}, async ({ knowledgeBaseId, ...params }) => {
|
|
165
170
|
try {
|
|
166
171
|
const { data } = await client.PATCH("/v1/knowledge-bases/{id}", {
|
|
167
172
|
params: { path: { id: knowledgeBaseId } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2kw/ai-mcp-server",
|
|
3
|
-
"version": "8.0.0-dev.
|
|
3
|
+
"version": "8.0.0-dev.5",
|
|
4
4
|
"description": "MCP server for 2kw.ai — EU-hosted AI platform: OpenAI-compatible LLM gateway, schema-driven document extraction, transcription, agents with a knowledge base, and cost observability. 199 tools for Claude Code, Cursor, and Windsurf.",
|
|
5
5
|
"mcpName": "ai.2kw/mcp-server",
|
|
6
6
|
"keywords": [
|