@infino-ai/mcp-server 0.1.2 → 0.2.0
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/README.md +1 -0
- package/dist/index.js +34 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -231,6 +231,7 @@ Cloud credentials are read from the standard provider environment variables —
|
|
|
231
231
|
| `infino_hybrid_search` | `table`, `query`, `k`, `column?`, `vectorColumn?` | **Fused** keyword + semantic search in one ranking pass — BM25 over the text column combined with vector similarity, so rows matching the literal terms *and* the meaning rank highest. |
|
|
232
232
|
| `infino_token_match` | `table`, `query`, `column?`, `mode?`, `limit?` | Unranked keyword filter — the set of rows whose text column contains the token(s). Use when you need the matches, not a relevance order. |
|
|
233
233
|
| `infino_exact_match` | `table`, `value`, `column?`, `limit?` | Unranked exact-equality filter over an indexed column (tag, status, id string). |
|
|
234
|
+
| `infino_count` | `table`, `query`, `column?`, `mode?` | Count how many rows match a keyword query, without fetching them — a fast tally over the text column. For the matching rows use `infino_keyword_search` or `infino_token_match`. |
|
|
234
235
|
| `infino_sql` | `query` | SQL for counts, filters, joins, aggregates. Read-only (single `SELECT`/`WITH`) by default; accepts any single statement when `INFINO_MCP_ENABLE_WRITES` is set. |
|
|
235
236
|
| `infino_list_tables` | — | List the tables in the connected catalog. |
|
|
236
237
|
| `infino_describe_table` | `table` | Column names and types for a table. |
|
package/dist/index.js
CHANGED
|
@@ -101,12 +101,6 @@ const fail = (message) => ({
|
|
|
101
101
|
content: [{ type: "text", text: message }],
|
|
102
102
|
isError: true,
|
|
103
103
|
});
|
|
104
|
-
// SQL literal / identifier quoting. The hybrid_search tool builds SQL from
|
|
105
|
-
// caller-supplied table/column names and query text, so every interpolated
|
|
106
|
-
// value is escaped: string args become single-quoted literals, column names
|
|
107
|
-
// become double-quoted identifiers.
|
|
108
|
-
const sqlStr = (s) => `'${s.replace(/'/g, "''")}'`;
|
|
109
|
-
const sqlIdent = (s) => `"${s.replace(/"/g, '""')}"`;
|
|
110
104
|
// When the caller doesn't name a column, search the first UTF-8 text column in
|
|
111
105
|
// the table's schema. (A table can have several; an explicit `column` overrides.)
|
|
112
106
|
function inferTextColumn(table) {
|
|
@@ -304,14 +298,9 @@ server.registerTool("infino_hybrid_search", {
|
|
|
304
298
|
if (!vecCol)
|
|
305
299
|
return fail(`hybrid_search: no vector column in '${table}' — pass 'vectorColumn'.`);
|
|
306
300
|
const vector = await embed(query);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const cols = [sqlIdent(textCol), "_id", "score"].join(", ");
|
|
311
|
-
const sql = `SELECT ${cols} FROM hybrid_search(` +
|
|
312
|
-
`${sqlStr(table)}, ${sqlStr(textCol)}, ${sqlStr(query)}, ` +
|
|
313
|
-
`${sqlStr(vecCol)}, ${sqlStr(vector.join(","))}, ${k})`;
|
|
314
|
-
const results = db.querySql(sql);
|
|
301
|
+
const results = handle.hybridSearch(textCol, query, vecCol, vector, k, {
|
|
302
|
+
projection: [textCol, "_id", "score"],
|
|
303
|
+
});
|
|
315
304
|
return ok({ table, query, results });
|
|
316
305
|
}
|
|
317
306
|
catch (err) {
|
|
@@ -382,6 +371,37 @@ server.registerTool("infino_exact_match", {
|
|
|
382
371
|
return fail(`exact_match failed: ${err.message}`);
|
|
383
372
|
}
|
|
384
373
|
});
|
|
374
|
+
server.registerTool("infino_count", {
|
|
375
|
+
title: "Count keyword matches",
|
|
376
|
+
description: "Use when you only need HOW MANY rows match a keyword query, not the rows themselves — a fast tally over a text " +
|
|
377
|
+
"column, without fetching or ranking. Cheaper than infino_keyword_search when a number is all you need (e.g. " +
|
|
378
|
+
"'how many docs mention X'). For the matching rows use infino_keyword_search or infino_token_match.",
|
|
379
|
+
inputSchema: {
|
|
380
|
+
table: z.string().describe("Table to search."),
|
|
381
|
+
query: z.string().describe("Query terms, matched as literal tokens."),
|
|
382
|
+
column: z
|
|
383
|
+
.string()
|
|
384
|
+
.optional()
|
|
385
|
+
.describe("Text column to search; inferred from the table schema when omitted."),
|
|
386
|
+
mode: z
|
|
387
|
+
.enum(["or", "and"])
|
|
388
|
+
.optional()
|
|
389
|
+
.describe("Match any token ('or', the default) or every token ('and')."),
|
|
390
|
+
},
|
|
391
|
+
}, async ({ table, query, column, mode }) => {
|
|
392
|
+
try {
|
|
393
|
+
const handle = db.openTable(table);
|
|
394
|
+
const col = column ?? inferTextColumn(handle);
|
|
395
|
+
if (!col) {
|
|
396
|
+
return fail(`count: no text column found in '${table}' — pass 'column' explicitly.`);
|
|
397
|
+
}
|
|
398
|
+
const count = handle.count(col, query, { mode });
|
|
399
|
+
return ok({ table, column: col, query, count });
|
|
400
|
+
}
|
|
401
|
+
catch (err) {
|
|
402
|
+
return fail(`count failed: ${err.message}`);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
385
405
|
server.registerTool("infino_sql", {
|
|
386
406
|
title: "SQL over Infino",
|
|
387
407
|
description: "Use for structural or analytical questions — counts, GROUP BY, joins, aggregates, filtering by exact column " +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infino-ai/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "MCP server for Infino — keyword, vector, hybrid, and SQL retrieval over data on object storage, for AI agents.",
|
|
5
5
|
"mcpName": "io.github.infino-ai/mcp-server",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@huggingface/transformers": "^4.2.0",
|
|
52
|
+
"@infino-ai/infino": "^0.1.2",
|
|
52
53
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
53
|
-
"@infino-ai/infino": "^0.1.1",
|
|
54
54
|
"zod": "^3.23.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|