mcp-meilisearch 1.1.0 → 1.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/server.d.ts +4 -5
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,aAGR,GACA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CA8GtB;AAkCD,eAAe,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
|
-
import { initServer } from "./server.js";
|
|
3
2
|
import { parse as parseUrl } from "node:url";
|
|
3
|
+
import { initServer } from "./server.js";
|
|
4
4
|
import { configHandler } from "./utils/config-handler.js";
|
|
5
5
|
import { createErrorResponse } from "./utils/error-handler.js";
|
|
6
6
|
/**
|
|
@@ -14,9 +14,9 @@ export async function mcpMeilisearchServer(options = {
|
|
|
14
14
|
}) {
|
|
15
15
|
configHandler.setMeilisearchHost(options.meilisearchHost);
|
|
16
16
|
configHandler.setMeilisearchApiKey(options.meilisearchApiKey);
|
|
17
|
-
let mcpServerInstance = null;
|
|
18
17
|
const httpPort = options.httpPort || 4995;
|
|
19
18
|
const transport = options.transport || "http";
|
|
19
|
+
let mcpServerInstance = null;
|
|
20
20
|
const mcpEndpoint = options.mcpEndpoint || "/mcp";
|
|
21
21
|
const server = createServer(async (req, res) => {
|
|
22
22
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
@@ -53,7 +53,13 @@ export async function mcpMeilisearchServer(options = {
|
|
|
53
53
|
req.on("end", async () => {
|
|
54
54
|
try {
|
|
55
55
|
const jsonBody = JSON.parse(body);
|
|
56
|
-
|
|
56
|
+
if (mcpServerInstance) {
|
|
57
|
+
await mcpServerInstance.handlePostRequest(req, res, jsonBody);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
res.statusCode = 503;
|
|
61
|
+
res.end(JSON.stringify(createErrorResponse("MCP server not initialized yet")));
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
catch {
|
|
59
65
|
res.statusCode = 400;
|
package/dist/server.d.ts
CHANGED
|
@@ -12,14 +12,13 @@ interface ServerConfig {
|
|
|
12
12
|
/**
|
|
13
13
|
* Return type for the initServer function
|
|
14
14
|
*/
|
|
15
|
-
interface
|
|
16
|
-
mcpServer
|
|
17
|
-
viteServer?: any;
|
|
15
|
+
interface ServerInstance {
|
|
16
|
+
mcpServer: MCPServer;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Implementation of an MCP server for Meilisearch
|
|
21
20
|
*/
|
|
22
|
-
declare class MCPServer {
|
|
21
|
+
export declare class MCPServer {
|
|
23
22
|
private readonly JSON_RPC;
|
|
24
23
|
private readonly SESSION_ID_HEADER_NAME;
|
|
25
24
|
private server;
|
|
@@ -95,6 +94,6 @@ declare class MCPServer {
|
|
|
95
94
|
* @returns A promise that resolves to the server instances
|
|
96
95
|
* @throws Error if the transport type is unsupported
|
|
97
96
|
*/
|
|
98
|
-
export declare const initServer: (transport: "stdio" | "http", config?: Partial<ServerConfig>) => Promise<
|
|
97
|
+
export declare const initServer: (transport: "stdio" | "http", config?: Partial<ServerConfig>) => Promise<ServerInstance>;
|
|
99
98
|
export {};
|
|
100
99
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAevD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE;;GAEG;AACH,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,UAAU,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAevD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE;;GAEG;AACH,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,UAAU,cAAc;IACtB,SAAS,EAAE,SAAS,CAAC;CACtB;AAiBD;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAoB;IAE3D,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,eAAe,CAA+B;IACtD,OAAO,CAAC,QAAQ,CAAuC;IAEvD;;;;OAIG;gBACS,MAAM,EAAE,SAAS,EAAE,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IAOjE;;;;OAIG;IACG,gBAAgB,CACpB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC;IA+BhB;;;;;OAKG;IACG,iBAAiB,CACrB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,IAAI,CAAC;IA+BhB;;OAEG;IACH,QAAQ,IAAI,IAAI;IAqBhB;;;;;OAKG;YACW,uBAAuB;IAwCrC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAWvC;;OAEG;YACW,gBAAgB;IAmB9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAO7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAUzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;OAEG;IACH,OAAO,CAAC,sBAAsB;CA0B/B;AAsED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,WAAW,OAAO,GAAG,MAAM,EAC3B,SAAS,OAAO,CAAC,YAAY,CAAC,KAC7B,OAAO,CAAC,cAAc,CAcxB,CAAC"}
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-meilisearch",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Model Context Protocol (MCP) implementation for Meilisearch",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsc && tsc --project tsconfig.types.json",
|
|
27
|
-
"server": "npm run build && node --env-file=.env dist",
|
|
28
27
|
"demo": "npm run build & npm run dev --workspace=demo",
|
|
28
|
+
"server": "npm run build && node --env-file=.env dist/index.js",
|
|
29
29
|
"prepublishOnly": "rm -rf dist && npm version minor && npm run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|