bimp-mcp 0.2.2 → 0.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 (2) hide show
  1. package/dist/index.js +66 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,9 +26,19 @@ const toolMap = new Map();
26
26
  for (const tool of generatedTools) {
27
27
  toolMap.set(tool.name, tool);
28
28
  }
29
+ // Build entity→actions index for bimp_api description
30
+ const entityActions = new Map();
31
+ for (const tool of generatedTools) {
32
+ const parts = tool.name.replace("bimp_", "").split("_");
33
+ const action = parts.pop();
34
+ const entity = parts.join("_");
35
+ if (!entityActions.has(entity))
36
+ entityActions.set(entity, []);
37
+ entityActions.get(entity).push(action);
38
+ }
29
39
  const utilityTools = createUtilityTools(client, toolMap);
30
40
  const nomenclaturesTools = createNomenclaturesTools(client);
31
- const server = new McpServer({ name: "bimp-mcp", version: "0.2.2" }, { capabilities: { logging: {} } });
41
+ const server = new McpServer({ name: "bimp-mcp", version: "0.3.0" }, { capabilities: { logging: {} } });
32
42
  // Register prompts via McpServer (uses Zod, type-safe)
33
43
  for (const [name, prompt] of Object.entries(PROMPT_TEXTS)) {
34
44
  server.registerPrompt(name, { description: prompt.description }, () => ({
@@ -69,14 +79,39 @@ server.registerTool("bimp_auth_switchCompany", {
69
79
  });
70
80
  // Use low-level server for dynamic tool registration (raw JSON Schema from OpenAPI)
71
81
  const lowLevelServer = server.server;
82
+ // Build entity catalog for bimp_api description
83
+ const entityCatalog = [...entityActions.entries()]
84
+ .sort()
85
+ .map(([entity, actions]) => `${entity}: ${actions.join(", ")}`)
86
+ .join("\n");
72
87
  lowLevelServer.setRequestHandler(ListToolsRequestSchema, async () => ({
73
88
  tools: [
74
- ...generatedTools.map((t) => ({
75
- name: t.name,
76
- description: t.description,
77
- inputSchema: t.inputSchema,
78
- })),
79
- // Auth tools are registered via McpServer, but we need them in the list too
89
+ // Meta tool — replaces 135 individual generated tools
90
+ {
91
+ name: "bimp_api",
92
+ description: "Call any BIMP ERP API endpoint. Combines all entity CRUD operations into one tool.\n\n" +
93
+ "Usage: provide tool_name in the format bimp_{entity}_{action} (e.g. bimp_specification_readList, bimp_nomenclature_create).\n\n" +
94
+ "Available entities and actions:\n" +
95
+ entityCatalog +
96
+ "\n\nCommon params: readList needs {pagination:{offset:0,count:100}}, read needs {uuid}, " +
97
+ "create/update/insert need entity-specific fields. " +
98
+ "Filter by date: {periodable:[\"2026-01-01T00:00:00.000Z\",\"2026-12-31T23:59:59.000Z\"]}",
99
+ inputSchema: {
100
+ type: "object",
101
+ properties: {
102
+ tool_name: {
103
+ type: "string",
104
+ description: "Tool name: bimp_{entity}_{action} (e.g. bimp_specification_readList, bimp_nomenclature_read, bimp_salesInvoice_create)",
105
+ },
106
+ params: {
107
+ type: "object",
108
+ description: "Parameters for the API call. For readList: {pagination:{offset:0,count:100}}. For read: {uuid:\"...\"}. For create/update: entity fields.",
109
+ },
110
+ },
111
+ required: ["tool_name"],
112
+ },
113
+ },
114
+ // Auth tools
80
115
  {
81
116
  name: "bimp_auth_listCompanies",
82
117
  description: "List all companies accessible to the current user",
@@ -96,11 +131,13 @@ lowLevelServer.setRequestHandler(ListToolsRequestSchema, async () => ({
96
131
  required: ["codeOrUuid"],
97
132
  },
98
133
  },
134
+ // Utility tools
99
135
  ...utilityTools.map((t) => ({
100
136
  name: t.name,
101
137
  description: t.description,
102
138
  inputSchema: t.inputSchema,
103
139
  })),
140
+ // Nomenclatures extended tools
104
141
  ...nomenclaturesTools.map((t) => ({
105
142
  name: t.name,
106
143
  description: t.description,
@@ -152,7 +189,28 @@ lowLevelServer.setRequestHandler(CallToolRequestSchema, async (request) => {
152
189
  ],
153
190
  };
154
191
  }
155
- // Generated API tools
192
+ // bimp_api meta-tool — routes to any generated tool
193
+ if (name === "bimp_api") {
194
+ const toolName = params.tool_name;
195
+ const callParams = (params.params ?? {});
196
+ const toolDef = toolMap.get(toolName);
197
+ if (!toolDef) {
198
+ return {
199
+ content: [{
200
+ type: "text",
201
+ text: `Unknown tool: ${toolName}. Available tools: ${[...toolMap.keys()].join(", ")}`,
202
+ }],
203
+ isError: true,
204
+ };
205
+ }
206
+ const result = await client.request(toolDef.metadata.method, toolDef.metadata.path, callParams);
207
+ return {
208
+ content: [
209
+ { type: "text", text: JSON.stringify(result, null, 2) },
210
+ ],
211
+ };
212
+ }
213
+ // Direct generated API tools (still supported for Claude Code / backward compat)
156
214
  const toolDef = toolMap.get(name);
157
215
  if (!toolDef) {
158
216
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimp-mcp",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server for BIMP ERP API — ~140 tools dynamically generated from OpenAPI spec, plus planning/accounting fields and bulk operations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",