mcp-meilisearch 1.0.18 → 1.0.20
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/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
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,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAM;IAEpD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,sBAAsB,CAEd;gBAEJ,UAAU,EAAE,MAAM;IAIvB,yBAAyB,CAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI;IAKnE,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,qBAAa,SAAS;IACpB,WAAW,EAAE,OAAO,CAAS;IAC7B,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAM;IAEpD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,sBAAsB,CAEd;gBAEJ,UAAU,EAAE,MAAM;IAIvB,yBAAyB,CAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI;IAKnE,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBjD,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBhC,OAAO,CAAC,kBAAkB;IAWpB,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;IAoCF,OAAO,CAAC,cAAc;IAKhB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAI/B"}
|
package/dist/client.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
|
2
2
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
3
3
|
import { TextContentSchema, LoggingMessageNotificationSchema, ToolListChangedNotificationSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
4
|
export class MCPClient {
|
|
5
|
+
isConnected = false;
|
|
5
6
|
tools = [];
|
|
6
7
|
client;
|
|
7
8
|
tries = 0;
|
|
@@ -21,10 +22,12 @@ export class MCPClient {
|
|
|
21
22
|
this.setUpTransport();
|
|
22
23
|
this.setUpNotifications();
|
|
23
24
|
await this.listTools();
|
|
25
|
+
this.isConnected = true;
|
|
24
26
|
}
|
|
25
27
|
catch (e) {
|
|
26
28
|
this.tries++;
|
|
27
29
|
if (this.tries > 5) {
|
|
30
|
+
this.isConnected = false;
|
|
28
31
|
throw e;
|
|
29
32
|
}
|
|
30
33
|
await new Promise((resolve) => setTimeout(resolve, this.tries * 1000));
|
|
@@ -93,11 +96,12 @@ export class MCPClient {
|
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
setUpTransport() {
|
|
96
|
-
if (this.transport
|
|
99
|
+
if (this.transport == null)
|
|
97
100
|
return;
|
|
98
101
|
this.transport.onerror = this.cleanup;
|
|
99
102
|
}
|
|
100
103
|
async cleanup() {
|
|
101
104
|
await this.client.close();
|
|
105
|
+
this.isConnected = false;
|
|
102
106
|
}
|
|
103
107
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import http from "node:http";
|
|
2
2
|
import { ServerOptions } from "./types/options.js";
|
|
3
3
|
/**
|
|
4
|
-
* Start a
|
|
4
|
+
* Start a MCP server
|
|
5
5
|
* @param options Configuration options for the MCP server
|
|
6
6
|
* @returns A promise that resolves to the HTTP server instance
|
|
7
7
|
*/
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { parse as parseUrl } from "node:url";
|
|
|
4
4
|
import { configHandler } from "./utils/config-handler.js";
|
|
5
5
|
import { createErrorResponse } from "./utils/error-handler.js";
|
|
6
6
|
/**
|
|
7
|
-
* Start a
|
|
7
|
+
* Start a MCP server
|
|
8
8
|
* @param options Configuration options for the MCP server
|
|
9
9
|
* @returns A promise that resolves to the HTTP server instance
|
|
10
10
|
*/
|
|
@@ -99,7 +99,7 @@ export async function mcpMeilisearchServer(options = {
|
|
|
99
99
|
process.on("SIGTERM", shutdownHandler);
|
|
100
100
|
return server;
|
|
101
101
|
}
|
|
102
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
102
|
+
if (import.meta.url === `file://${process.argv?.[1]}`) {
|
|
103
103
|
const args = process.argv.slice(2);
|
|
104
104
|
const options = {
|
|
105
105
|
meilisearchHost: "http://localhost:7700",
|