mcp-meilisearch 1.4.23 → 1.4.26

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.
@@ -14,7 +14,11 @@ import { createErrorResponse } from "../../utils/error-handler.js";
14
14
  */
15
15
  export const registerVectorTools = (server) => {
16
16
  // Enable vector search experimental feature
17
- server.tool("enable-vector-search", "Enable the vector search experimental feature in Meilisearch", {}, { category: "meilisearch" }, async () => {
17
+ server.registerTool("enable-vector-search", {
18
+ description: "Enable the vector search experimental feature in Meilisearch",
19
+ inputSchema: {},
20
+ _meta: { category: "meilisearch" },
21
+ }, async () => {
18
22
  try {
19
23
  const response = await apiClient.post("/experimental-features", {
20
24
  vectorStore: true,
@@ -29,8 +33,11 @@ export const registerVectorTools = (server) => {
29
33
  return createErrorResponse(error);
30
34
  }
31
35
  });
32
- // Get experimental features status
33
- server.tool("get-experimental-features", "Get the status of experimental features in Meilisearch", {}, { category: "meilisearch" }, async () => {
36
+ server.registerTool("get-experimental-features", {
37
+ description: "Get the status of experimental features in Meilisearch",
38
+ inputSchema: {},
39
+ _meta: { category: "meilisearch" },
40
+ }, async () => {
34
41
  try {
35
42
  const response = await apiClient.get("/experimental-features");
36
43
  return {
@@ -43,17 +50,18 @@ export const registerVectorTools = (server) => {
43
50
  return createErrorResponse(error);
44
51
  }
45
52
  });
46
- // Update embedders configuration
47
- server.tool("update-embedders", "Configure embedders for vector search", {
48
- indexUid: z.string().describe("Unique identifier of the index"),
49
- embedders: z
50
- .string()
51
- .describe("JSON object containing embedder configurations"),
52
- }, { category: "meilisearch" }, async ({ indexUid, embedders }) => {
53
+ server.registerTool("update-embedders", {
54
+ description: "Configure embedders for vector search",
55
+ inputSchema: {
56
+ indexUid: z.string().describe("Unique identifier of the index"),
57
+ embedders: z
58
+ .string()
59
+ .describe("JSON object containing embedder configurations"),
60
+ },
61
+ _meta: { category: "meilisearch" },
62
+ }, async ({ indexUid, embedders }) => {
53
63
  try {
54
- // Parse the embedders string to ensure it's valid JSON
55
64
  const parsedEmbedders = JSON.parse(embedders);
56
- // Ensure embedders is an object
57
65
  if (typeof parsedEmbedders !== "object" ||
58
66
  parsedEmbedders === null ||
59
67
  Array.isArray(parsedEmbedders)) {
@@ -75,10 +83,13 @@ export const registerVectorTools = (server) => {
75
83
  return createErrorResponse(error);
76
84
  }
77
85
  });
78
- // Get embedders configuration
79
- server.tool("get-embedders", "Get the embedders configuration for an index", {
80
- indexUid: z.string().describe("Unique identifier of the index"),
81
- }, { category: "meilisearch" }, async ({ indexUid }) => {
86
+ server.registerTool("get-embedders", {
87
+ description: "Get the embedders configuration for an index",
88
+ inputSchema: {
89
+ indexUid: z.string().describe("Unique identifier of the index"),
90
+ },
91
+ _meta: { category: "meilisearch" },
92
+ }, async ({ indexUid }) => {
82
93
  try {
83
94
  const response = await apiClient.get(`/indexes/${indexUid}/settings/embedders`);
84
95
  return {
@@ -91,10 +102,13 @@ export const registerVectorTools = (server) => {
91
102
  return createErrorResponse(error);
92
103
  }
93
104
  });
94
- // Reset embedders configuration
95
- server.tool("reset-embedders", "Reset the embedders configuration for an index", {
96
- indexUid: z.string().describe("Unique identifier of the index"),
97
- }, { category: "meilisearch" }, async ({ indexUid }) => {
105
+ server.registerTool("reset-embedders", {
106
+ description: "Reset the embedders configuration for an index",
107
+ inputSchema: {
108
+ indexUid: z.string().describe("Unique identifier of the index"),
109
+ },
110
+ _meta: { category: "meilisearch" },
111
+ }, async ({ indexUid }) => {
98
112
  try {
99
113
  const response = await apiClient.delete(`/indexes/${indexUid}/settings/embedders`);
100
114
  return {
@@ -107,53 +121,55 @@ export const registerVectorTools = (server) => {
107
121
  return createErrorResponse(error);
108
122
  }
109
123
  });
110
- // Perform vector search
111
- server.tool("vector-search", "Perform a vector search in a Meilisearch index", {
112
- indexUid: z.string().describe("Unique identifier of the index"),
113
- vector: z
114
- .string()
115
- .describe("JSON array representing the vector to search for"),
116
- limit: z
117
- .number()
118
- .min(1)
119
- .max(1000)
120
- .optional()
121
- .describe("Maximum number of results to return (default: 20)"),
122
- offset: z
123
- .number()
124
- .min(0)
125
- .optional()
126
- .describe("Number of results to skip (default: 0)"),
127
- filter: z
128
- .string()
129
- .optional()
130
- .describe("Filter to apply (e.g., 'genre = horror AND year > 2020')"),
131
- embedder: z
132
- .string()
133
- .optional()
134
- .describe("Name of the embedder to use (if omitted, a 'vector' must be provided)"),
135
- attributes: z
136
- .array(z.string())
137
- .optional()
138
- .describe("Attributes to include in the vector search"),
139
- query: z
140
- .string()
141
- .optional()
142
- .describe("Text query to search for (if using 'embedder' instead of 'vector')"),
143
- hybrid: z
144
- .boolean()
145
- .optional()
146
- .describe("Whether to perform a hybrid search (combining vector and text search)"),
147
- hybridRatio: z
148
- .number()
149
- .min(0)
150
- .max(1)
151
- .optional()
152
- .describe("Ratio of vector vs text search in hybrid search (0-1, default: 0.5)"),
153
- }, { category: "meilisearch" }, async ({ indexUid, vector, limit, offset, filter, embedder, attributes, query, hybrid, hybridRatio, }) => {
124
+ server.registerTool("vector-search", {
125
+ description: "Perform a vector search in a Meilisearch index",
126
+ inputSchema: {
127
+ indexUid: z.string().describe("Unique identifier of the index"),
128
+ vector: z
129
+ .string()
130
+ .describe("JSON array representing the vector to search for"),
131
+ limit: z
132
+ .number()
133
+ .min(1)
134
+ .max(1000)
135
+ .optional()
136
+ .describe("Maximum number of results to return (default: 20)"),
137
+ offset: z
138
+ .number()
139
+ .min(0)
140
+ .optional()
141
+ .describe("Number of results to skip (default: 0)"),
142
+ filter: z
143
+ .string()
144
+ .optional()
145
+ .describe("Filter to apply (e.g., 'genre = horror AND year > 2020')"),
146
+ embedder: z
147
+ .string()
148
+ .optional()
149
+ .describe("Name of the embedder to use (if omitted, a 'vector' must be provided)"),
150
+ attributes: z
151
+ .array(z.string())
152
+ .optional()
153
+ .describe("Attributes to include in the vector search"),
154
+ query: z
155
+ .string()
156
+ .optional()
157
+ .describe("Text query to search for (if using 'embedder' instead of 'vector')"),
158
+ hybrid: z
159
+ .boolean()
160
+ .optional()
161
+ .describe("Whether to perform a hybrid search (combining vector and text search)"),
162
+ hybridRatio: z
163
+ .number()
164
+ .min(0)
165
+ .max(1)
166
+ .optional()
167
+ .describe("Ratio of vector vs text search in hybrid search (0-1, default: 0.5)"),
168
+ },
169
+ _meta: { category: "meilisearch" },
170
+ }, async ({ indexUid, vector, limit, offset, filter, embedder, attributes, query, hybrid, hybridRatio, }) => {
154
171
  try {
155
172
  const searchParams = {};
156
- // Add required vector parameter
157
173
  if (vector) {
158
174
  try {
159
175
  searchParams.vector = JSON.parse(vector);
@@ -167,14 +183,12 @@ export const registerVectorTools = (server) => {
167
183
  };
168
184
  }
169
185
  }
170
- // Add embedder parameters
171
186
  if (embedder) {
172
187
  searchParams.embedder = embedder;
173
188
  if (query !== undefined) {
174
189
  searchParams.q = query;
175
190
  }
176
191
  }
177
- // Ensure we have either vector or (embedder + query)
178
192
  if (!vector && (!embedder || query === undefined)) {
179
193
  return {
180
194
  isError: true,
@@ -186,7 +200,6 @@ export const registerVectorTools = (server) => {
186
200
  ],
187
201
  };
188
202
  }
189
- // Add optional parameters
190
203
  if (limit !== undefined)
191
204
  searchParams.limit = limit;
192
205
  if (offset !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"ai-handler.d.ts","sourceRoot":"","sources":["../../src/utils/ai-handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,UAAU,qBAAqB;IAC7B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAkBD,UAAU,cAAc;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAA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,CAAC;YA0Df,iBAAiB;YAiEjB,iBAAiB;YA+BjB,sBAAsB;YA+DtB,sBAAsB;IAiCpC,OAAO,CAAC,mBAAmB;CAyD5B"}
@@ -164,8 +164,9 @@ export class AIService {
164
164
  };
165
165
  }
166
166
  const message = response.choices[0].message;
167
- if (message.tool_calls?.length) {
168
- const toolCall = message.tool_calls[0]?.function;
167
+ const toolCalls = message.tool_calls;
168
+ if (toolCalls?.length) {
169
+ const toolCall = toolCalls[0]?.function;
169
170
  if (!toolCall) {
170
171
  return {
171
172
  error: "Invalid tool from OpenAI response; processType: 'tool'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-meilisearch",
3
- "version": "1.4.23",
3
+ "version": "1.4.26",
4
4
  "description": "Model Context Protocol (MCP) implementation for Meilisearch",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,15 +29,15 @@
29
29
  "prepublishOnly": "rm -rf dist && npm version patch && npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@huggingface/inference": "^4.0.6",
33
- "@modelcontextprotocol/sdk": "^1.13.0",
34
- "axios": "^1.12.2",
35
- "openai": "^5.5.1",
32
+ "@huggingface/inference": "^4.13.5",
33
+ "@modelcontextprotocol/sdk": "^1.25.2",
34
+ "axios": "^1.13.2",
35
+ "openai": "^6.15.0",
36
36
  "zod": "^3.25.67"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/node": "^24.0.3",
40
- "typescript": "^5.8.3"
39
+ "@types/node": "^25.0.3",
40
+ "typescript": "^5.9.3"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=20.12.2",