mcp-meilisearch 1.3.1 → 1.3.2
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 +6 -8
- package/dist/client.d.ts +0 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +0 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,10 +11,9 @@ A Model Context Protocol (MCP) server implementation that provides a bridge betw
|
|
|
11
11
|
## Key Features
|
|
12
12
|
|
|
13
13
|
- **Multiple Transport Options**: Supports both STDIO and StreamableHTTP transports.
|
|
14
|
-
- **Real-time Communication**: Enables seamless interaction between clients and the server.
|
|
15
14
|
- **Meilisearch API Support**: Full access to Meilisearch functionalities.
|
|
16
15
|
- **Web Client Demo**: Updated interface showcasing search capabilities and features.
|
|
17
|
-
- **AI Inference**: Leverages LLMs from providers such as OpenAI, Hugging Face
|
|
16
|
+
- **AI Inference**: Leverages LLMs from providers such as OpenAI, Hugging Face or Anthropic to intelligently determine and utilize the most suitable tool for user queries.
|
|
18
17
|
|
|
19
18
|
## Getting Started
|
|
20
19
|
|
|
@@ -60,7 +59,8 @@ pnpm add mcp-meilisearch
|
|
|
60
59
|
|
|
61
60
|
#### AI Inference Options
|
|
62
61
|
|
|
63
|
-
- `
|
|
62
|
+
- `aiProviderName`: Name of the AI provider ("openai" | "anthropic" | "huggingface") (Default: "openai")
|
|
63
|
+
- `aiProviderApiKey`: AI provider API key for AI inference
|
|
64
64
|
- `llmModel`: AI model to use (Default: "gpt-3.5-turbo")
|
|
65
65
|
|
|
66
66
|
### Using the MCPClient
|
|
@@ -79,8 +79,6 @@ const result = await client.callTool("search-across-all-indexes", {
|
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
// Use AI inference to choose the most appropriate tool
|
|
82
|
-
// First enable AI inference
|
|
83
|
-
client.setUseAI(true);
|
|
84
82
|
|
|
85
83
|
const result = await client.callToolWithAI("Find articles about cucumber");
|
|
86
84
|
console.log(`Tool used: ${result.toolUsed}`);
|
|
@@ -90,7 +88,6 @@ console.log(`Results: ${JSON.stringify(result.data)}`);
|
|
|
90
88
|
|
|
91
89
|
#### AI Inference Client Methods
|
|
92
90
|
|
|
93
|
-
- `setUseAI(use: boolean)`: Enable or disable AI inference.
|
|
94
91
|
- `callToolWithAI(query: string, specificTools?: string[])`: Process a user query with AI inference, optionally limiting to specific tools.
|
|
95
92
|
|
|
96
93
|
### Starting the Server
|
|
@@ -103,8 +100,9 @@ import mcpMeilisearchServer from "mcp-meilisearch";
|
|
|
103
100
|
await mcpMeilisearchServer({
|
|
104
101
|
meilisearchHost: "http://localhost:7700",
|
|
105
102
|
meilisearchApiKey: "your_meilisearch_api_key",
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
aiProviderName: "openai",
|
|
104
|
+
aiProviderApiKey: "your_ai_provider_api_key", // Required for AI inference
|
|
105
|
+
llmModel: "gpt-4",
|
|
108
106
|
});
|
|
109
107
|
```
|
|
110
108
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
export declare class MCPClient {
|
|
2
|
-
/**
|
|
3
|
-
* Flag to enable/disable AI inference
|
|
4
|
-
* When enabled, user queries are processed by an AI to determine which tool to use
|
|
5
|
-
*/
|
|
6
|
-
useAI: boolean;
|
|
7
2
|
/**
|
|
8
3
|
* Indicates whether the client is connected to the MCP server
|
|
9
4
|
* Used to track the connection state and control async operations
|
|
@@ -23,11 +18,6 @@ export declare class MCPClient {
|
|
|
23
18
|
private transport;
|
|
24
19
|
private toolsUpdatedCallback;
|
|
25
20
|
constructor(serverName: string);
|
|
26
|
-
/**
|
|
27
|
-
* Set whether to use AI inference for tool selection
|
|
28
|
-
* @param use Whether to use AI inference
|
|
29
|
-
*/
|
|
30
|
-
setUseAI(use: boolean): void;
|
|
31
21
|
/**
|
|
32
22
|
* Registers a callback to be called when the list of available tools changes
|
|
33
23
|
* @param callback The function to call when tools are updated
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,qBAAa,SAAS;IACpB;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,qBAAa,SAAS;IACpB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAS;IAE7B;;;OAGG;IACH,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACjC,EAAE,CAAM;IAET,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,oBAAoB,CAEZ;gBAEJ,UAAU,EAAE,MAAM;IAI9B;;;OAGG;IACH,sBAAsB,CACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI;IAKzE;;;;;OAKG;IACG,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAOhE;;;;OAIG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAuBzC,SAAS;IAwBvB,OAAO,CAAC,kBAAkB;IAW1B;;;;;;OAMG;IACG,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IA2CF;;;;;OAKG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,MAAM,EAAE,GACvB,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAmCF,OAAO,CAAC,cAAc;IAKtB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAK/B"}
|
package/dist/client.js
CHANGED
|
@@ -2,11 +2,6 @@ import { TextContentSchema, LoggingMessageNotificationSchema, ToolListChangedNot
|
|
|
2
2
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
3
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
4
4
|
export class MCPClient {
|
|
5
|
-
/**
|
|
6
|
-
* Flag to enable/disable AI inference
|
|
7
|
-
* When enabled, user queries are processed by an AI to determine which tool to use
|
|
8
|
-
*/
|
|
9
|
-
useAI = false;
|
|
10
5
|
/**
|
|
11
6
|
* Indicates whether the client is connected to the MCP server
|
|
12
7
|
* Used to track the connection state and control async operations
|
|
@@ -24,13 +19,6 @@ export class MCPClient {
|
|
|
24
19
|
constructor(serverName) {
|
|
25
20
|
this.client = new Client({ name: serverName, version: "1.0.0" });
|
|
26
21
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Set whether to use AI inference for tool selection
|
|
29
|
-
* @param use Whether to use AI inference
|
|
30
|
-
*/
|
|
31
|
-
setUseAI(use) {
|
|
32
|
-
this.useAI = use;
|
|
33
|
-
}
|
|
34
22
|
/**
|
|
35
23
|
* Registers a callback to be called when the list of available tools changes
|
|
36
24
|
* @param callback The function to call when tools are updated
|