mcp-grocy 2.0.1 → 2.0.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/build/config/index.js +6 -1
- package/build/server/mcp-server.js +8 -6
- package/build/version.js +1 -1
- package/package.json +1 -1
package/build/config/index.js
CHANGED
|
@@ -177,9 +177,14 @@ export class ConfigManager {
|
|
|
177
177
|
parseToolConfiguration() {
|
|
178
178
|
const enabledTools = new Set();
|
|
179
179
|
const toolSubConfigs = new Map();
|
|
180
|
+
const toolAckTokens = new Map();
|
|
180
181
|
for (const [toolName, toolConfig] of Object.entries(this.config.yaml.tools)) {
|
|
181
182
|
if (toolConfig.enabled) {
|
|
182
183
|
enabledTools.add(toolName);
|
|
184
|
+
// Store ack_token separately if configured
|
|
185
|
+
if (toolConfig.ack_token && typeof toolConfig.ack_token === 'string') {
|
|
186
|
+
toolAckTokens.set(toolName, toolConfig.ack_token);
|
|
187
|
+
}
|
|
183
188
|
// Extract sub-configs (everything except standard fields)
|
|
184
189
|
const subConfigs = new Map();
|
|
185
190
|
for (const [key, value] of Object.entries(toolConfig)) {
|
|
@@ -192,7 +197,7 @@ export class ConfigManager {
|
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
199
|
}
|
|
195
|
-
return { enabledTools, toolSubConfigs };
|
|
200
|
+
return { enabledTools, toolSubConfigs, toolAckTokens };
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
203
|
// Export singleton instance
|
|
@@ -17,6 +17,7 @@ export class GrocyMcpServer {
|
|
|
17
17
|
server;
|
|
18
18
|
enabledTools = new Set();
|
|
19
19
|
toolSubConfigs = new Map();
|
|
20
|
+
toolAckTokens = new Map();
|
|
20
21
|
resourceHandler;
|
|
21
22
|
toolRegistry;
|
|
22
23
|
constructor(server, toolRegistry, resourceHandler) {
|
|
@@ -49,8 +50,9 @@ export class GrocyMcpServer {
|
|
|
49
50
|
return new GrocyMcpServer(server, toolRegistry, resourceHandler);
|
|
50
51
|
}
|
|
51
52
|
parseToolConfiguration() {
|
|
52
|
-
const { enabledTools, toolSubConfigs } = config.parseToolConfiguration();
|
|
53
|
+
const { enabledTools, toolSubConfigs, toolAckTokens } = config.parseToolConfiguration();
|
|
53
54
|
this.toolSubConfigs = toolSubConfigs;
|
|
55
|
+
this.toolAckTokens = toolAckTokens;
|
|
54
56
|
// Validate tool names
|
|
55
57
|
const validToolNames = new Set(this.toolRegistry.getToolNames());
|
|
56
58
|
if (enabledTools.size > 0) {
|
|
@@ -99,11 +101,11 @@ export class GrocyMcpServer {
|
|
|
99
101
|
try {
|
|
100
102
|
const subConfigs = this.toolSubConfigs.get(toolName);
|
|
101
103
|
const result = await handler(args, subConfigs);
|
|
102
|
-
// Automatically add ack_token to successful responses
|
|
103
|
-
if (!result.isError
|
|
104
|
-
const ackToken =
|
|
105
|
-
if (ackToken
|
|
106
|
-
result.content.
|
|
104
|
+
// Automatically add ack_token to successful responses (at the beginning)
|
|
105
|
+
if (!result.isError) {
|
|
106
|
+
const ackToken = this.toolAckTokens.get(toolName);
|
|
107
|
+
if (ackToken) {
|
|
108
|
+
result.content.unshift({
|
|
107
109
|
type: 'text',
|
|
108
110
|
text: `Acknowledgment token: ${ackToken}`
|
|
109
111
|
});
|
package/build/version.js
CHANGED