vendure-mcp-graphql 1.1.1 → 1.3.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.
Files changed (3) hide show
  1. package/README.md +32 -17
  2. package/dist/index.js +27 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # vendure-mcp-graphql
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/vendure-mcp-graphql.svg)](https://www.npmjs.com/package/vendure-mcp-graphql) [![npm downloads](https://img.shields.io/npm/dm/vendure-mcp-graphql.svg)](https://www.npmjs.com/package/vendure-mcp-graphql)
4
+
3
5
  MCP (Model Context Protocol) server for interacting with Vendure GraphQL APIs (Admin & Shop).
4
6
 
5
7
  ## Installation
@@ -20,7 +22,7 @@ Configure as an MCP server in your IDE (like Claude Desktop):
20
22
  "args": [],
21
23
  "env": {
22
24
  "VENDURE_URL": "http://localhost:3000/admin-api",
23
- "VENDURE_AUTH_TOKEN": "your-token-here"
25
+ "VENDURE_API_KEY": "your-key-here"
24
26
  }
25
27
  }
26
28
  }
@@ -30,28 +32,31 @@ Configure as an MCP server in your IDE (like Claude Desktop):
30
32
  ## Tools
31
33
 
32
34
  ### Admin API
33
- | Tool | Description |
34
- |------|-------------|
35
- | `admin_query` | Execute a GraphQL query on the Admin API |
36
- | `admin_mutation` | Execute a GraphQL mutation on the Admin API |
37
- | `admin_batch_mutation` | Execute a mutation in bulk for multiple IDs (concurrent) |
38
- | `get_admin_schema` | Fetch the full Admin API schema introspection |
39
- | `list_admin_operations` | List all available Admin API queries and mutations |
35
+
36
+ | Tool | Description |
37
+ | ----------------------- | -------------------------------------------------------- |
38
+ | `admin_query` | Execute a GraphQL query on the Admin API |
39
+ | `admin_mutation` | Execute a GraphQL mutation on the Admin API |
40
+ | `admin_batch_mutation` | Execute a mutation in bulk for multiple IDs (concurrent) |
41
+ | `get_admin_schema` | Fetch the full Admin API schema introspection |
42
+ | `list_admin_operations` | List all available Admin API queries and mutations |
40
43
 
41
44
  ### Shop API
42
- | Tool | Description |
43
- |------|-------------|
44
- | `shop_query` | Execute a GraphQL query on the Shop API |
45
- | `shop_mutation` | Execute a GraphQL mutation on the Shop API |
46
- | `shop_batch_mutation` | Execute a mutation in bulk for multiple IDs (concurrent) |
47
- | `get_shop_schema` | Fetch the full Shop API schema introspection |
48
- | `list_shop_operations` | List all available Shop API queries and mutations |
45
+
46
+ | Tool | Description |
47
+ | ---------------------- | -------------------------------------------------------- |
48
+ | `shop_query` | Execute a GraphQL query on the Shop API |
49
+ | `shop_mutation` | Execute a GraphQL mutation on the Shop API |
50
+ | `shop_batch_mutation` | Execute a mutation in bulk for multiple IDs (concurrent) |
51
+ | `get_shop_schema` | Fetch the full Shop API schema introspection |
52
+ | `list_shop_operations` | List all available Shop API queries and mutations |
49
53
 
50
54
  ### Batch Mutations
51
55
 
52
56
  The batch mutation tools allow you to run a single mutation across multiple IDs concurrently. Useful for bulk operations like deleting or updating many records at once.
53
57
 
54
58
  **Parameters:**
59
+
55
60
  - `mutation` (required) — GraphQL mutation string with an ID variable (e.g. `$id: ID!`)
56
61
  - `ids` (required) — Array of IDs to run the mutation for
57
62
  - `variableName` — Name of the ID variable in the mutation (default: `"id"`)
@@ -59,6 +64,7 @@ The batch mutation tools allow you to run a single mutation across multiple IDs
59
64
  - `concurrency` — Max concurrent mutations (default: `5`)
60
65
 
61
66
  **Example — bulk delete products:**
67
+
62
68
  ```json
63
69
  {
64
70
  "mutation": "mutation DeleteProduct($id: ID!) { deleteProduct(id: $id) { result } }",
@@ -68,14 +74,23 @@ The batch mutation tools allow you to run a single mutation across multiple IDs
68
74
  ```
69
75
 
70
76
  **Returns per-ID results:**
77
+
71
78
  ```json
72
79
  {
73
80
  "total": 3,
74
81
  "succeeded": 2,
75
82
  "failed": 1,
76
83
  "results": [
77
- { "id": "1", "success": true, "data": { "deleteProduct": { "result": "DELETED" } } },
78
- { "id": "2", "success": true, "data": { "deleteProduct": { "result": "DELETED" } } },
84
+ {
85
+ "id": "1",
86
+ "success": true,
87
+ "data": { "deleteProduct": { "result": "DELETED" } }
88
+ },
89
+ {
90
+ "id": "2",
91
+ "success": true,
92
+ "data": { "deleteProduct": { "result": "DELETED" } }
93
+ },
79
94
  { "id": "3", "success": false, "error": "Product not found" }
80
95
  ]
81
96
  }
package/dist/index.js CHANGED
@@ -23,6 +23,30 @@ if (existsSync(apiKeyPath)) {
23
23
  }
24
24
  }
25
25
  import { adminQuery, adminMutation, adminBatchMutation, getAdminSchema, getAdminOperations, shopQuery, shopMutation, shopBatchMutation, getShopSchema, getShopOperations, } from "./src/tools/index.js";
26
+ // Singleton pattern for shared resources
27
+ class SharedResources {
28
+ static instance = null;
29
+ static initializing = false;
30
+ constructor() { }
31
+ static async getInstance() {
32
+ if (this.instance)
33
+ return this.instance;
34
+ while (this.initializing) {
35
+ await new Promise((resolve) => setTimeout(resolve, 100));
36
+ }
37
+ if (this.instance)
38
+ return this.instance;
39
+ this.initializing = true;
40
+ try {
41
+ // Initialize any shared resources here if needed
42
+ this.instance = new SharedResources();
43
+ return this.instance;
44
+ }
45
+ finally {
46
+ this.initializing = false;
47
+ }
48
+ }
49
+ }
26
50
  const server = new Server({
27
51
  name: "vendure-mcp-graphql",
28
52
  version: "1.0.0",
@@ -285,9 +309,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
285
309
  });
286
310
  // Start the server
287
311
  async function main() {
312
+ // Initialize shared resources (singleton pattern)
313
+ await SharedResources.getInstance();
288
314
  const transport = new StdioServerTransport();
289
315
  await server.connect(transport);
290
316
  console.error("Vendure GraphQL MCP server running on stdio");
317
+ console.error("Memory optimization: GraphQL client shared via singleton");
291
318
  console.error(`API Key: ${process.env.VENDURE_API_KEY ? "Present" : "Missing"}`);
292
319
  console.error(`Admin URL: ${process.env.ADMIN_API_URL || "default"}`);
293
320
  console.error(`Shop URL: ${process.env.SHOP_API_URL || "default"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vendure-mcp-graphql",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "description": "MCP server for Vendure Admin and Shop GraphQL APIs",
5
5
  "type": "module",
6
6
  "bin": {