@infino-ai/mcp-server 0.10.0 → 0.11.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 +8 -5
- package/dist/index.js +93 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ else (the tools, the read-only default) is identical:
|
|
|
67
67
|
"command": "npx",
|
|
68
68
|
"args": ["-y", "@infino-ai/mcp-server"],
|
|
69
69
|
"env": {
|
|
70
|
-
"INFINO_MCP_URI": "https://api.platform.infino.
|
|
70
|
+
"INFINO_MCP_URI": "https://api.platform.infino.ws/my-database",
|
|
71
71
|
"INFINO_API_KEY": "inf_…"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -201,6 +201,7 @@ All configuration is via environment variables — there are no config files and
|
|
|
201
201
|
| `INFINO_MCP_EMBED_API_KEY` | No | — | API key for the `openai` provider. Sent as both `Authorization: Bearer` and `api-key`, so one value works for OpenAI and Azure OpenAI. Omit to call an unauthenticated or ambient-identity endpoint. |
|
|
202
202
|
| `INFINO_MCP_EMBED_MODEL` | No | `Xenova/all-MiniLM-L6-v2` (local) · `text-embedding-3-small` (openai) | The embedding model. For `local`, a Hugging Face feature-extraction model; for `openai`, the model/deployment name. **Must match the model that produced the table's stored vectors** — and therefore its vector-index dimension (e.g. `text-embedding-3-small` is 1536-dim; the default local model is 384-dim). |
|
|
203
203
|
| `INFINO_MCP_VALIDATE` | No | _off_ | When set (`1`/`true`/`yes`), probes the object store at startup so bad credentials or an unreachable bucket fail then instead of on the first search. |
|
|
204
|
+
| `INFINO_MCP_SNIPPET_CHARS` | No | _off_ (full text) | Deployment default for search snippets: cut the text column of every search hit to this many characters (then `…`). Set it when rows are whole documents rather than chunks, so an agent scanning many hits doesn't pull every document into its context. A per-call `snippetChars` overrides it; `0` means full text. Only the searched text column is cut. |
|
|
204
205
|
|
|
205
206
|
Cloud credentials are read from the standard provider environment variables — the server maps them to the store's config and introduces no credential vars of its own. Omit them entirely to use ambient cloud identity (an IAM instance role or Azure managed identity).
|
|
206
207
|
|
|
@@ -255,7 +256,7 @@ The model must match what produced the stored vectors — a mismatch yields mean
|
|
|
255
256
|
|
|
256
257
|
// Infino Cloud (hosted) — the database is the last path segment
|
|
257
258
|
"env": {
|
|
258
|
-
"INFINO_MCP_URI": "https://api.platform.infino.
|
|
259
|
+
"INFINO_MCP_URI": "https://api.platform.infino.ws/my-database",
|
|
259
260
|
"INFINO_API_KEY": "inf_…"
|
|
260
261
|
}
|
|
261
262
|
```
|
|
@@ -275,9 +276,9 @@ the data.
|
|
|
275
276
|
|
|
276
277
|
| Tool | Arguments | What it does |
|
|
277
278
|
| --- | --- | --- |
|
|
278
|
-
| `infino_semantic_search` | `table`, `query`, `k`, `column?`, `vectorColumn?`, `columns?`, `filter?` | Find passages by **meaning** — embeds the query with a local model (no key) and ranks by vector similarity. Handles paraphrase and synonyms. Optional `filter` (`{column, query, mode?}`) restricts the ranking to rows whose keyword column matches first (a pushdown pre-filter). Optional `columns` chooses which fields each hit returns (e.g. a path + line range to cite); defaults to the text column, with `_id` and `score` always included. |
|
|
279
|
-
| `infino_keyword_search` | `table`, `query`, `k`, `column?`, `columns?` | BM25 full-text search — for exact terms, identifiers, error codes, product names. |
|
|
280
|
-
| `infino_hybrid_search` | `table`, `query`, `k`, `column?`, `vectorColumn?`, `columns?` | **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. |
|
|
279
|
+
| `infino_semantic_search` | `table`, `query`, `k`, `column?`, `vectorColumn?`, `snippetChars?`, `columns?`, `filter?` | Find passages by **meaning** — embeds the query with a local model (no key) and ranks by vector similarity. Handles paraphrase and synonyms. `score` is a **distance** (lower is closer). Optional `filter` (`{column, query, mode?}`) restricts the ranking to rows whose keyword column matches first (a pushdown pre-filter). Optional `columns` chooses which fields each hit returns (e.g. a path + line range to cite); defaults to the text column, with `_id` and `score` always included. |
|
|
280
|
+
| `infino_keyword_search` | `table`, `query`, `k`, `column?`, `snippetChars?`, `columns?` | BM25 full-text search — for exact terms, identifiers, error codes, product names. `score` is a relevance (higher is better). |
|
|
281
|
+
| `infino_hybrid_search` | `table`, `query`, `k`, `column?`, `vectorColumn?`, `snippetChars?`, `columns?` | **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. `score` is the fused rank (higher is better). |
|
|
281
282
|
| `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. |
|
|
282
283
|
| `infino_exact_match` | `table`, `value`, `column?`, `limit?` | Unranked exact-equality filter over an indexed column (tag, status, id string). |
|
|
283
284
|
| `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`. |
|
|
@@ -288,6 +289,8 @@ the data.
|
|
|
288
289
|
| `infino_update_documents` | `table`, `predicate`, `documents` | Replace the rows matching a SQL predicate with new documents, 1:1 (missing vectors are embedded). Durable storage only. **Only when `INFINO_MCP_ENABLE_WRITES` is set.** |
|
|
289
290
|
| `infino_delete_documents` | `table`, `predicate` | Delete the rows matching a SQL predicate. Durable storage only. **Only when `INFINO_MCP_ENABLE_WRITES` is set.** |
|
|
290
291
|
|
|
292
|
+
Search hits carry the **full text column** by default, like other vector-store servers. When rows are whole documents rather than pre-chunked passages, set `INFINO_MCP_SNIPPET_CHARS` (for example `300`) so hits carry a snippet instead and an agent can scan many hits without pulling every document into its context; a per-call `snippetChars` overrides the deployment default, and `0` means full text. Only the searched text column is cut, never ids or other projected columns; read any single hit in full with `infino_sql`. Every search response also carries `score_kind`, stating whether its `score` is a distance (semantic: lower is closer) or a relevance (keyword and hybrid: higher is better).
|
|
293
|
+
|
|
291
294
|
The engine's search table functions (`bm25_search`, `vector_search`, `hybrid_search`, …) are not callable from `infino_sql` — retrieval goes through the dedicated search tools above, which embed and project for you. `infino_sql` is for filters, joins, and aggregates.
|
|
292
295
|
|
|
293
296
|
---
|
package/dist/index.js
CHANGED
|
@@ -197,11 +197,18 @@ function errText(err) {
|
|
|
197
197
|
}
|
|
198
198
|
return message;
|
|
199
199
|
}
|
|
200
|
-
// When the caller doesn't name a column,
|
|
201
|
-
//
|
|
200
|
+
// When the caller doesn't name a column, infer the searchable text column.
|
|
201
|
+
// FTS indexes require LargeUtf8, so a LargeUtf8 column is almost certainly
|
|
202
|
+
// the indexed one; plain Utf8 columns are typically ids and short labels.
|
|
203
|
+
// Prefer LargeUtf8, fall back to the first Utf8. (An explicit `column`
|
|
204
|
+
// always overrides.)
|
|
202
205
|
function inferTextColumn(table) {
|
|
203
|
-
const
|
|
204
|
-
|
|
206
|
+
const fields = table.schema().fields;
|
|
207
|
+
const large = fields.find((f) => String(f.type).toLowerCase().includes("largeutf8"));
|
|
208
|
+
if (large)
|
|
209
|
+
return large.name;
|
|
210
|
+
const any = fields.find((f) => String(f.type).toLowerCase().includes("utf8"));
|
|
211
|
+
return any?.name;
|
|
205
212
|
}
|
|
206
213
|
// The first list-typed column (the vector index lives on a FixedSizeList<float32>).
|
|
207
214
|
function inferVectorColumn(table) {
|
|
@@ -295,11 +302,60 @@ function searchProjection(columns, textCol) {
|
|
|
295
302
|
const base = columns && columns.length > 0 ? columns : textCol ? [textCol] : [];
|
|
296
303
|
return [...new Set([...base, "_id", "score"])];
|
|
297
304
|
}
|
|
305
|
+
// Search hits carry the full text column by default. A deployment whose rows
|
|
306
|
+
// are whole documents rather than chunks (a 4 KB transcript per row, say) can
|
|
307
|
+
// set INFINO_MCP_SNIPPET_CHARS so hits carry a snippet instead: an agent
|
|
308
|
+
// reading 50 hits needs enough text to judge relevance, not 50 documents in
|
|
309
|
+
// its context, and it can read any hit in full by id afterwards. The operator
|
|
310
|
+
// knows the row shape; the model finds out only after paying for it once. A
|
|
311
|
+
// per-call `snippetChars` overrides the deployment default either way (0 =
|
|
312
|
+
// full text). Only the searched text column is cut; ids, paths, other
|
|
313
|
+
// projected columns, and scores pass through as-is.
|
|
314
|
+
const SNIPPET_DEFAULT = (() => {
|
|
315
|
+
const raw = process.env.INFINO_MCP_SNIPPET_CHARS;
|
|
316
|
+
if (!raw)
|
|
317
|
+
return 0;
|
|
318
|
+
const n = Number(raw);
|
|
319
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
320
|
+
console.error(`INFINO_MCP_SNIPPET_CHARS must be a non-negative integer (got ${raw}); using full text`);
|
|
321
|
+
return 0;
|
|
322
|
+
}
|
|
323
|
+
return n;
|
|
324
|
+
})();
|
|
325
|
+
const snippetParam = z
|
|
326
|
+
.number()
|
|
327
|
+
.int()
|
|
328
|
+
.min(0)
|
|
329
|
+
.optional()
|
|
330
|
+
.describe("Cut the returned text column to this many characters; 0 returns the full text. " +
|
|
331
|
+
(SNIPPET_DEFAULT > 0
|
|
332
|
+
? `This deployment defaults to ${SNIPPET_DEFAULT}. `
|
|
333
|
+
: "Defaults to the full text. ") +
|
|
334
|
+
"Pass a small value when asking for many hits, so results stay compact; read a hit in full afterwards with infino_sql.");
|
|
335
|
+
function snippetize(rows, textCol, limit) {
|
|
336
|
+
if (limit <= 0 || !textCol)
|
|
337
|
+
return rows;
|
|
338
|
+
return rows.map((row) => {
|
|
339
|
+
const value = row[textCol];
|
|
340
|
+
return typeof value === "string" && value.length > limit
|
|
341
|
+
? { ...row, [textCol]: `${value.slice(0, limit)}…` }
|
|
342
|
+
: row;
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
// What a hit's `score` means differs per tool, and the direction flips: the
|
|
346
|
+
// engine reports vector kNN as a distance and BM25/RRF as relevance. Every
|
|
347
|
+
// search response says which, so a client never ranks or thresholds backwards.
|
|
348
|
+
const SCORE_KIND = {
|
|
349
|
+
semantic: "distance: lower is closer, 0 is an identical vector",
|
|
350
|
+
keyword: "bm25 relevance: higher is better",
|
|
351
|
+
hybrid: "reciprocal-rank fusion of keyword and semantic ranks: higher is better",
|
|
352
|
+
};
|
|
298
353
|
server.registerTool("infino_semantic_search", {
|
|
299
354
|
title: "Semantic (vector) search",
|
|
300
355
|
description: "Use when searching for a concept by meaning and the exact wording is unknown — this retrieves paraphrases and " +
|
|
301
356
|
"synonyms, not just literal matches. Embeds the query with a local model (no API key) and ranks a table's " +
|
|
302
|
-
"embedding column by vector similarity
|
|
357
|
+
"embedding column by vector similarity. Each hit carries a score that is a DISTANCE (lower is closer) and the " +
|
|
358
|
+
"text column (full, or a snippet — see snippetChars). Optional 'filter' restricts the ranking to rows " +
|
|
303
359
|
"whose keyword column matches a predicate first (a pushdown pre-filter, e.g. semantic search only within rows " +
|
|
304
360
|
"tagged 'billing'). For exact terms use infino_keyword_search; when the query has both literal terms and an " +
|
|
305
361
|
"intent use infino_hybrid_search.",
|
|
@@ -309,6 +365,7 @@ server.registerTool("infino_semantic_search", {
|
|
|
309
365
|
k: z.number().int().positive().max(100).default(10).describe("Maximum results."),
|
|
310
366
|
column: z.string().optional().describe("Text column to return with each hit; inferred if omitted."),
|
|
311
367
|
vectorColumn: z.string().optional().describe("Vector column to search; inferred if omitted."),
|
|
368
|
+
snippetChars: snippetParam,
|
|
312
369
|
columns: z
|
|
313
370
|
.array(z.string())
|
|
314
371
|
.optional()
|
|
@@ -325,7 +382,7 @@ server.registerTool("infino_semantic_search", {
|
|
|
325
382
|
.optional()
|
|
326
383
|
.describe("Pre-filter: rank the kNN only among rows whose FTS 'column' matches 'query' (a pushdown pre-filter, not a post-filter on the results)."),
|
|
327
384
|
},
|
|
328
|
-
}, async ({ table, query, k, column, vectorColumn, columns, filter }) => {
|
|
385
|
+
}, async ({ table, query, k, column, vectorColumn, snippetChars, columns, filter }) => {
|
|
329
386
|
try {
|
|
330
387
|
const handle = db.openTable(table);
|
|
331
388
|
const vecCol = vectorColumn ?? inferVectorColumn(handle);
|
|
@@ -335,7 +392,13 @@ server.registerTool("infino_semantic_search", {
|
|
|
335
392
|
const vector = await embed(query);
|
|
336
393
|
const projection = searchProjection(columns, textCol);
|
|
337
394
|
const { value: results, tookMs } = timed(() => handle.vectorSearch(vecCol, vector, k, { projection, filter }));
|
|
338
|
-
return ok({
|
|
395
|
+
return ok({
|
|
396
|
+
table,
|
|
397
|
+
query,
|
|
398
|
+
score_kind: SCORE_KIND.semantic,
|
|
399
|
+
results: snippetize(results, textCol, snippetChars ?? SNIPPET_DEFAULT),
|
|
400
|
+
took_ms: tookMs,
|
|
401
|
+
});
|
|
339
402
|
}
|
|
340
403
|
catch (err) {
|
|
341
404
|
return fail(`semantic_search failed: ${errText(err)}`);
|
|
@@ -345,7 +408,8 @@ server.registerTool("infino_keyword_search", {
|
|
|
345
408
|
title: "Keyword (BM25) search",
|
|
346
409
|
description: "Use when the query is literal terms — identifiers, error codes, product names, exact phrases — and you want " +
|
|
347
410
|
"results ranked by relevance. BM25 full-text search over a text column: ranks rows by how well the query's " +
|
|
348
|
-
"tokens (and their stems) match, each with a relevance score
|
|
411
|
+
"tokens (and their stems) match, each with a relevance score (higher is better) and the text column (full, or " +
|
|
412
|
+
"a snippet — see snippetChars). Matches exact tokens, not synonyms or paraphrases. " +
|
|
349
413
|
"Prefer this over SQL LIKE for known literal terms. For meaning-based search use infino_semantic_search; for " +
|
|
350
414
|
"both at once use infino_hybrid_search.",
|
|
351
415
|
inputSchema: {
|
|
@@ -356,12 +420,13 @@ server.registerTool("infino_keyword_search", {
|
|
|
356
420
|
.string()
|
|
357
421
|
.optional()
|
|
358
422
|
.describe("Text column to search; inferred from the table schema when omitted."),
|
|
423
|
+
snippetChars: snippetParam,
|
|
359
424
|
columns: z
|
|
360
425
|
.array(z.string())
|
|
361
426
|
.optional()
|
|
362
427
|
.describe("Columns to return with each hit (e.g. an id, path, or line range to cite). Defaults to the searched column; '_id' and 'score' are always included."),
|
|
363
428
|
},
|
|
364
|
-
}, async ({ table, query, k, column, columns }) => {
|
|
429
|
+
}, async ({ table, query, k, column, snippetChars, columns }) => {
|
|
365
430
|
try {
|
|
366
431
|
const handle = db.openTable(table);
|
|
367
432
|
const col = column ?? inferTextColumn(handle);
|
|
@@ -369,7 +434,14 @@ server.registerTool("infino_keyword_search", {
|
|
|
369
434
|
return fail(`keyword_search: no text column found in '${table}' — pass 'column' explicitly.`);
|
|
370
435
|
}
|
|
371
436
|
const { value: results, tookMs } = timed(() => handle.bm25Search(col, query, k, { projection: searchProjection(columns, col) }));
|
|
372
|
-
return ok({
|
|
437
|
+
return ok({
|
|
438
|
+
table,
|
|
439
|
+
column: col,
|
|
440
|
+
query,
|
|
441
|
+
score_kind: SCORE_KIND.keyword,
|
|
442
|
+
results: snippetize(results, col, snippetChars ?? SNIPPET_DEFAULT),
|
|
443
|
+
took_ms: tookMs,
|
|
444
|
+
});
|
|
373
445
|
}
|
|
374
446
|
catch (err) {
|
|
375
447
|
return fail(`keyword_search failed: ${errText(err)}`);
|
|
@@ -379,7 +451,8 @@ server.registerTool("infino_hybrid_search", {
|
|
|
379
451
|
title: "Hybrid (keyword + semantic) search",
|
|
380
452
|
description: "Use when a query carries both specific terms and an intent — you want exact-term precision without giving up " +
|
|
381
453
|
"paraphrase recall. Fuses BM25 over a text column with vector similarity over the embedding column in a single " +
|
|
382
|
-
"ranking pass, so rows matching the literal terms AND the meaning rank highest
|
|
454
|
+
"ranking pass, so rows matching the literal terms AND the meaning rank highest; the score is the fused rank " +
|
|
455
|
+
"(higher is better) and each hit carries the text column (full, or a snippet — see snippetChars). Embeds the query with a local " +
|
|
383
456
|
"model (no API key). Sits between infino_keyword_search (literal only) and infino_semantic_search (meaning only).",
|
|
384
457
|
inputSchema: {
|
|
385
458
|
table: z.string().describe("Table to search."),
|
|
@@ -387,12 +460,13 @@ server.registerTool("infino_hybrid_search", {
|
|
|
387
460
|
k: z.number().int().positive().max(100).default(10).describe("Maximum results."),
|
|
388
461
|
column: z.string().optional().describe("Text column for the keyword half; inferred if omitted."),
|
|
389
462
|
vectorColumn: z.string().optional().describe("Vector column for the semantic half; inferred if omitted."),
|
|
463
|
+
snippetChars: snippetParam,
|
|
390
464
|
columns: z
|
|
391
465
|
.array(z.string())
|
|
392
466
|
.optional()
|
|
393
467
|
.describe("Columns to return with each hit (e.g. an id, path, or line range to cite). Defaults to the text column; '_id' and 'score' are always included."),
|
|
394
468
|
},
|
|
395
|
-
}, async ({ table, query, k, column, vectorColumn, columns }) => {
|
|
469
|
+
}, async ({ table, query, k, column, vectorColumn, snippetChars, columns }) => {
|
|
396
470
|
try {
|
|
397
471
|
const handle = db.openTable(table);
|
|
398
472
|
const textCol = column ?? inferTextColumn(handle);
|
|
@@ -405,7 +479,13 @@ server.registerTool("infino_hybrid_search", {
|
|
|
405
479
|
const { value: results, tookMs } = timed(() => handle.hybridSearch(textCol, query, vecCol, vector, k, {
|
|
406
480
|
projection: searchProjection(columns, textCol),
|
|
407
481
|
}));
|
|
408
|
-
return ok({
|
|
482
|
+
return ok({
|
|
483
|
+
table,
|
|
484
|
+
query,
|
|
485
|
+
score_kind: SCORE_KIND.hybrid,
|
|
486
|
+
results: snippetize(results, textCol, snippetChars ?? SNIPPET_DEFAULT),
|
|
487
|
+
took_ms: tookMs,
|
|
488
|
+
});
|
|
409
489
|
}
|
|
410
490
|
catch (err) {
|
|
411
491
|
return fail(`hybrid_search failed: ${errText(err)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infino-ai/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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",
|