@identikey/coding-mcp 2.0.2 → 2.0.4
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/README.md +23 -0
- package/build/core/ToolRegistry.d.ts +2 -2
- package/build/core/ToolRegistry.d.ts.map +1 -1
- package/build/core/ToolRegistry.js +47 -44
- package/build/infra/eventBus.d.ts +14 -14
- package/build/infra/eventBus.d.ts.map +1 -1
- package/build/infra/eventBus.js +11 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
## How Users Run It
|
|
4
|
+
folks can use it in their MCP config like:
|
|
5
|
+
|
|
6
|
+
**Cursor Settings → MCP → Add Server:**
|
|
7
|
+
- **Command**: `npx`
|
|
8
|
+
- **Args**: `-y`, `@identikey/coding-mcp`
|
|
9
|
+
|
|
10
|
+
Or in `.cursor/mcp.json`:
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"coding-mcp": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": ["-y", "@identikey/coding-mcp"]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The server spawns as a child process, Cursor talks JSON-RPC over stdin/stdout, and all your tool logs go to stderr where they belong. Clean af.
|
|
23
|
+
|
|
1
24
|
# 🤖 Cursor Tools MCP Server
|
|
2
25
|
|
|
3
26
|
An MCP (Model Context Protocol) server providing powerful tools with expert personas for intelligent assistance:
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Tool Registry - Central hub for managing MCP tool commands
|
|
3
3
|
* Implements the Command pattern with EventBus integration
|
|
4
4
|
*/
|
|
5
|
-
import { ToolCommand, ToolRegistration, ToolHealthStatus } from
|
|
6
|
-
import { type EventBus } from
|
|
5
|
+
import { ToolCommand, ToolRegistration, ToolHealthStatus } from "./ToolCommand.js";
|
|
6
|
+
import { type EventBus } from "../infra/eventBus.js";
|
|
7
7
|
export declare class ToolRegistry {
|
|
8
8
|
private tools;
|
|
9
9
|
private healthCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolRegistry.d.ts","sourceRoot":"","sources":["../../src/core/ToolRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,WAAW,EACX,gBAAgB,EAKhB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE/D,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;gBAExB,gBAAgB,CAAC,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"ToolRegistry.d.ts","sourceRoot":"","sources":["../../src/core/ToolRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,WAAW,EACX,gBAAgB,EAKhB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE/D,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;gBAExB,gBAAgB,CAAC,EAAE,QAAQ;IAWvC;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,GAAE,MAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqE5E;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA0DjE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAK1C;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAI3D;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,IAAI,IAAI,WAAW,EAAE;IAMrB;;OAEG;IACH,iBAAiB,IAAI,gBAAgB,EAAE;IAIvC;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;IAIxB;;OAEG;IACH,QAAQ,IAAI;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC;IAuBD;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IAiBnD;;OAEG;IACG,WAAW,CACf,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,OAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC;IA6C5B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAqBjE;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;OAEG;YACW,cAAc;IAM5B;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,QAAQ,GAAG,YAAY;CAGzD;AAGD,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Tool Registry - Central hub for managing MCP tool commands
|
|
3
3
|
* Implements the Command pattern with EventBus integration
|
|
4
4
|
*/
|
|
5
|
-
import { ToolLifecycle, ToolNotFoundError, DuplicateToolError, ToolError } from
|
|
6
|
-
import { eventBus } from
|
|
5
|
+
import { ToolLifecycle, ToolNotFoundError, DuplicateToolError, ToolError, } from "./ToolCommand.js";
|
|
6
|
+
import { eventBus } from "../infra/eventBus.js";
|
|
7
7
|
export class ToolRegistry {
|
|
8
8
|
tools = new Map();
|
|
9
9
|
healthCache = new Map();
|
|
@@ -11,12 +11,12 @@ export class ToolRegistry {
|
|
|
11
11
|
constructor(eventBusInstance) {
|
|
12
12
|
this.eventBus = eventBusInstance || eventBus;
|
|
13
13
|
// Listen for system events
|
|
14
|
-
this.eventBus.on(
|
|
14
|
+
this.eventBus.on("system:shutdown", this.handleShutdown.bind(this), "ToolRegistry");
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Register a new tool command
|
|
18
18
|
*/
|
|
19
|
-
async register(tool, source =
|
|
19
|
+
async register(tool, source = "unknown") {
|
|
20
20
|
if (this.tools.has(tool.name)) {
|
|
21
21
|
throw new DuplicateToolError(tool.name);
|
|
22
22
|
}
|
|
@@ -25,13 +25,13 @@ export class ToolRegistry {
|
|
|
25
25
|
tool,
|
|
26
26
|
registeredAt: Date.now(),
|
|
27
27
|
source,
|
|
28
|
-
enabled: true
|
|
28
|
+
enabled: true,
|
|
29
29
|
};
|
|
30
30
|
// Emit lifecycle event
|
|
31
|
-
this.eventBus.emit(
|
|
31
|
+
this.eventBus.emit("tool:lifecycle", {
|
|
32
32
|
name: tool.name,
|
|
33
33
|
state: ToolLifecycle.LOADING,
|
|
34
|
-
metadata: { source, version: tool.version }
|
|
34
|
+
metadata: { source, version: tool.version },
|
|
35
35
|
});
|
|
36
36
|
try {
|
|
37
37
|
// Call onLoad hook if present
|
|
@@ -41,30 +41,32 @@ export class ToolRegistry {
|
|
|
41
41
|
// Register the tool
|
|
42
42
|
this.tools.set(tool.name, registration);
|
|
43
43
|
// Update lifecycle state
|
|
44
|
-
this.eventBus.emit(
|
|
44
|
+
this.eventBus.emit("tool:lifecycle", {
|
|
45
45
|
name: tool.name,
|
|
46
|
-
state: ToolLifecycle.READY
|
|
46
|
+
state: ToolLifecycle.READY,
|
|
47
47
|
});
|
|
48
48
|
// Emit registration event
|
|
49
|
-
this.eventBus.emit(
|
|
49
|
+
this.eventBus.emit("tool:registered", {
|
|
50
50
|
name: tool.name,
|
|
51
51
|
version: tool.version,
|
|
52
|
-
source
|
|
52
|
+
source,
|
|
53
53
|
});
|
|
54
|
-
console.
|
|
54
|
+
console.error(`✅ Tool '${tool.name}' registered from ${source}`);
|
|
55
55
|
}
|
|
56
56
|
catch (error) {
|
|
57
57
|
// Handle registration failure
|
|
58
|
-
this.eventBus.emit(
|
|
58
|
+
this.eventBus.emit("tool:lifecycle", {
|
|
59
59
|
name: tool.name,
|
|
60
60
|
state: ToolLifecycle.ERROR,
|
|
61
|
-
metadata: {
|
|
61
|
+
metadata: {
|
|
62
|
+
error: error instanceof Error ? error.message : String(error),
|
|
63
|
+
},
|
|
62
64
|
});
|
|
63
|
-
this.eventBus.emit(
|
|
65
|
+
this.eventBus.emit("tool:error", {
|
|
64
66
|
name: tool.name,
|
|
65
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
67
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
66
68
|
});
|
|
67
|
-
throw new ToolError(`Failed to register tool '${tool.name}': ${error instanceof Error ? error.message : String(error)}`,
|
|
69
|
+
throw new ToolError(`Failed to register tool '${tool.name}': ${error instanceof Error ? error.message : String(error)}`, "EXECUTION_ERROR", tool.name, error instanceof Error ? error : undefined);
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
@@ -76,10 +78,10 @@ export class ToolRegistry {
|
|
|
76
78
|
return false;
|
|
77
79
|
}
|
|
78
80
|
// Emit lifecycle event
|
|
79
|
-
this.eventBus.emit(
|
|
81
|
+
this.eventBus.emit("tool:lifecycle", {
|
|
80
82
|
name,
|
|
81
83
|
state: ToolLifecycle.UNLOADING,
|
|
82
|
-
metadata: { reason }
|
|
84
|
+
metadata: { reason },
|
|
83
85
|
});
|
|
84
86
|
try {
|
|
85
87
|
// Call onUnload hook if present
|
|
@@ -90,23 +92,23 @@ export class ToolRegistry {
|
|
|
90
92
|
this.tools.delete(name);
|
|
91
93
|
this.healthCache.delete(name);
|
|
92
94
|
// Update lifecycle state
|
|
93
|
-
this.eventBus.emit(
|
|
95
|
+
this.eventBus.emit("tool:lifecycle", {
|
|
94
96
|
name,
|
|
95
|
-
state: ToolLifecycle.DISPOSED
|
|
97
|
+
state: ToolLifecycle.DISPOSED,
|
|
96
98
|
});
|
|
97
99
|
// Emit unregistration event
|
|
98
|
-
this.eventBus.emit(
|
|
100
|
+
this.eventBus.emit("tool:unregistered", {
|
|
99
101
|
name,
|
|
100
|
-
reason
|
|
102
|
+
reason,
|
|
101
103
|
});
|
|
102
|
-
console.
|
|
104
|
+
console.error(`❌ Tool '${name}' unregistered${reason ? `: ${reason}` : ""}`);
|
|
103
105
|
return true;
|
|
104
106
|
}
|
|
105
107
|
catch (error) {
|
|
106
108
|
// Handle unload failure
|
|
107
|
-
this.eventBus.emit(
|
|
109
|
+
this.eventBus.emit("tool:error", {
|
|
108
110
|
name,
|
|
109
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
111
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
110
112
|
});
|
|
111
113
|
// Force removal even if unload fails
|
|
112
114
|
this.tools.delete(name);
|
|
@@ -139,8 +141,8 @@ export class ToolRegistry {
|
|
|
139
141
|
*/
|
|
140
142
|
list() {
|
|
141
143
|
return Array.from(this.tools.values())
|
|
142
|
-
.filter(reg => reg.enabled)
|
|
143
|
-
.map(reg => reg.tool);
|
|
144
|
+
.filter((reg) => reg.enabled)
|
|
145
|
+
.map((reg) => reg.tool);
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
146
148
|
* List all tool registrations (including disabled)
|
|
@@ -161,19 +163,19 @@ export class ToolRegistry {
|
|
|
161
163
|
const registrations = Array.from(this.tools.values());
|
|
162
164
|
const categories = {};
|
|
163
165
|
const sources = {};
|
|
164
|
-
registrations.forEach(reg => {
|
|
166
|
+
registrations.forEach((reg) => {
|
|
165
167
|
// Count categories
|
|
166
|
-
const category = reg.tool.metadata?.category ||
|
|
168
|
+
const category = reg.tool.metadata?.category || "uncategorized";
|
|
167
169
|
categories[category] = (categories[category] || 0) + 1;
|
|
168
170
|
// Count sources
|
|
169
171
|
sources[reg.source] = (sources[reg.source] || 0) + 1;
|
|
170
172
|
});
|
|
171
173
|
return {
|
|
172
174
|
totalTools: registrations.length,
|
|
173
|
-
enabledTools: registrations.filter(r => r.enabled).length,
|
|
174
|
-
disabledTools: registrations.filter(r => !r.enabled).length,
|
|
175
|
+
enabledTools: registrations.filter((r) => r.enabled).length,
|
|
176
|
+
disabledTools: registrations.filter((r) => !r.enabled).length,
|
|
175
177
|
categories,
|
|
176
|
-
sources
|
|
178
|
+
sources,
|
|
177
179
|
};
|
|
178
180
|
}
|
|
179
181
|
/**
|
|
@@ -185,10 +187,10 @@ export class ToolRegistry {
|
|
|
185
187
|
return false;
|
|
186
188
|
}
|
|
187
189
|
registration.enabled = enabled;
|
|
188
|
-
this.eventBus.emit(
|
|
190
|
+
this.eventBus.emit("tool:lifecycle", {
|
|
189
191
|
name,
|
|
190
192
|
state: enabled ? ToolLifecycle.READY : ToolLifecycle.DISPOSED,
|
|
191
|
-
metadata: { enabled }
|
|
193
|
+
metadata: { enabled },
|
|
192
194
|
});
|
|
193
195
|
return true;
|
|
194
196
|
}
|
|
@@ -203,13 +205,14 @@ export class ToolRegistry {
|
|
|
203
205
|
// Check cache first
|
|
204
206
|
if (useCache) {
|
|
205
207
|
const cached = this.healthCache.get(name);
|
|
206
|
-
if (cached &&
|
|
208
|
+
if (cached && Date.now() - cached.lastChecked < 30000) {
|
|
209
|
+
// 30 second cache
|
|
207
210
|
return cached;
|
|
208
211
|
}
|
|
209
212
|
}
|
|
210
213
|
let healthStatus = {
|
|
211
214
|
healthy: true,
|
|
212
|
-
lastChecked: Date.now()
|
|
215
|
+
lastChecked: Date.now(),
|
|
213
216
|
};
|
|
214
217
|
try {
|
|
215
218
|
// Use tool's health check if available
|
|
@@ -221,15 +224,15 @@ export class ToolRegistry {
|
|
|
221
224
|
healthStatus = {
|
|
222
225
|
healthy: false,
|
|
223
226
|
message: error instanceof Error ? error.message : String(error),
|
|
224
|
-
lastChecked: Date.now()
|
|
227
|
+
lastChecked: Date.now(),
|
|
225
228
|
};
|
|
226
229
|
}
|
|
227
230
|
// Cache result
|
|
228
231
|
this.healthCache.set(name, healthStatus);
|
|
229
232
|
// Emit health event
|
|
230
|
-
this.eventBus.emit(
|
|
233
|
+
this.eventBus.emit("tool:health", {
|
|
231
234
|
name,
|
|
232
|
-
status: healthStatus
|
|
235
|
+
status: healthStatus,
|
|
233
236
|
});
|
|
234
237
|
return healthStatus;
|
|
235
238
|
}
|
|
@@ -247,7 +250,7 @@ export class ToolRegistry {
|
|
|
247
250
|
results[name] = {
|
|
248
251
|
healthy: false,
|
|
249
252
|
message: error instanceof Error ? error.message : String(error),
|
|
250
|
-
lastChecked: Date.now()
|
|
253
|
+
lastChecked: Date.now(),
|
|
251
254
|
};
|
|
252
255
|
}
|
|
253
256
|
}));
|
|
@@ -258,15 +261,15 @@ export class ToolRegistry {
|
|
|
258
261
|
*/
|
|
259
262
|
async clear() {
|
|
260
263
|
const names = Array.from(this.tools.keys());
|
|
261
|
-
await Promise.allSettled(names.map(name => this.unregister(name,
|
|
264
|
+
await Promise.allSettled(names.map((name) => this.unregister(name, "registry cleared")));
|
|
262
265
|
}
|
|
263
266
|
/**
|
|
264
267
|
* Handle system shutdown
|
|
265
268
|
*/
|
|
266
269
|
async handleShutdown() {
|
|
267
|
-
console.
|
|
270
|
+
console.error("🔄 ToolRegistry: Shutting down, unregistering all tools...");
|
|
268
271
|
await this.clear();
|
|
269
|
-
console.
|
|
272
|
+
console.error("✅ ToolRegistry: Shutdown complete");
|
|
270
273
|
}
|
|
271
274
|
/**
|
|
272
275
|
* Create a new registry instance (for testing)
|
|
@@ -48,37 +48,37 @@ declare class EventBus {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
export interface ToolEventMap {
|
|
51
|
-
|
|
51
|
+
"tool:registered": {
|
|
52
52
|
name: string;
|
|
53
53
|
version?: string;
|
|
54
54
|
source: string;
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
"tool:unregistered": {
|
|
57
57
|
name: string;
|
|
58
58
|
reason?: string;
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
"tool:execute:start": {
|
|
61
61
|
name: string;
|
|
62
62
|
requestId?: string;
|
|
63
63
|
args: any;
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
"tool:execute:end": {
|
|
66
66
|
name: string;
|
|
67
67
|
requestId?: string;
|
|
68
68
|
success: boolean;
|
|
69
69
|
executionTime: number;
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
"tool:error": {
|
|
72
72
|
name: string;
|
|
73
73
|
error: Error;
|
|
74
74
|
requestId?: string;
|
|
75
75
|
};
|
|
76
|
-
|
|
76
|
+
"tool:lifecycle": {
|
|
77
77
|
name: string;
|
|
78
|
-
state:
|
|
78
|
+
state: "loading" | "ready" | "error" | "unloading" | "disposed";
|
|
79
79
|
metadata?: any;
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
"tool:health": {
|
|
82
82
|
name: string;
|
|
83
83
|
status: {
|
|
84
84
|
healthy: boolean;
|
|
@@ -86,26 +86,26 @@ export interface ToolEventMap {
|
|
|
86
86
|
lastChecked: number;
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
|
-
|
|
89
|
+
"registry:initialized": {
|
|
90
90
|
toolCount: number;
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
"registry:discovery:start": {
|
|
93
93
|
source: string;
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
"registry:discovery:complete": {
|
|
96
96
|
source: string;
|
|
97
97
|
discovered: number;
|
|
98
98
|
errors: number;
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
"system:startup": {
|
|
101
101
|
timestamp: number;
|
|
102
102
|
version: string;
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
"system:shutdown": {
|
|
105
105
|
timestamp: number;
|
|
106
106
|
reason?: string;
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
"system:error": {
|
|
109
109
|
error: Error;
|
|
110
110
|
context?: string;
|
|
111
111
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../src/infra/eventBus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,YAAY,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAS/C,cAAM,QAAQ;IACZ,OAAO,CAAC,SAAS,CAA+C;IAChE,OAAO,CAAC,kBAAkB,CAAK;IAE/B;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,QAAQ,EACzB,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAClC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,IAAI;IA2Bb;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../src/infra/eventBus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,YAAY,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAS/C,cAAM,QAAQ;IACZ,OAAO,CAAC,SAAS,CAA+C;IAChE,OAAO,CAAC,kBAAkB,CAAK;IAE/B;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,QAAQ,EACzB,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,YAAY,CAAC,QAAQ,CAAC,C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K,EAAE,KAAK,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAS,SAAQ,YAAY;KAAG;CAC3C;AAMD,eAAO,MAAM,QAAQ,UAAiB,CAAC;AAyBvC,YAAY,EAAE,QAAQ,EAAE,CAAC;AACzB,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,CAAC"}
|
package/build/infra/eventBus.js
CHANGED
|
@@ -15,7 +15,7 @@ class EventBus {
|
|
|
15
15
|
const listenerSource = {
|
|
16
16
|
handler,
|
|
17
17
|
source,
|
|
18
|
-
createdAt: Date.now()
|
|
18
|
+
createdAt: Date.now(),
|
|
19
19
|
};
|
|
20
20
|
const handlers = this.listeners.get(event);
|
|
21
21
|
handlers.add(listenerSource);
|
|
@@ -37,12 +37,12 @@ class EventBus {
|
|
|
37
37
|
emit(event, data) {
|
|
38
38
|
const handlers = this.listeners.get(event);
|
|
39
39
|
if (handlers) {
|
|
40
|
-
handlers.forEach(listenerSource => {
|
|
40
|
+
handlers.forEach((listenerSource) => {
|
|
41
41
|
try {
|
|
42
42
|
listenerSource.handler(data);
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
|
-
console.error(`Error in event handler for ${String(event)} (source: ${listenerSource.source ||
|
|
45
|
+
console.error(`Error in event handler for ${String(event)} (source: ${listenerSource.source || "unknown"}):`, error);
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -96,13 +96,13 @@ class EventBus {
|
|
|
96
96
|
const OLD_THRESHOLD = 5 * 60 * 1000; // 5 minutes
|
|
97
97
|
this.listeners.forEach((handlers, event) => {
|
|
98
98
|
eventCounts[event] = handlers.size;
|
|
99
|
-
handlers.forEach(listener => {
|
|
99
|
+
handlers.forEach((listener) => {
|
|
100
100
|
const age = now - listener.createdAt;
|
|
101
101
|
if (age > OLD_THRESHOLD) {
|
|
102
102
|
oldListeners.push({
|
|
103
103
|
event,
|
|
104
104
|
source: listener.source,
|
|
105
|
-
age: Math.round(age / 1000) // in seconds
|
|
105
|
+
age: Math.round(age / 1000), // in seconds
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
});
|
|
@@ -110,7 +110,7 @@ class EventBus {
|
|
|
110
110
|
return {
|
|
111
111
|
totalListeners: this.totalListenerCount,
|
|
112
112
|
eventCounts,
|
|
113
|
-
oldListeners
|
|
113
|
+
oldListeners,
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -121,17 +121,18 @@ export const eventBus = new EventBus();
|
|
|
121
121
|
// =============================================================================
|
|
122
122
|
// DEVELOPMENT HELPERS
|
|
123
123
|
// =============================================================================
|
|
124
|
-
if (process.env.NODE_ENV ===
|
|
124
|
+
if (process.env.NODE_ENV === "development") {
|
|
125
125
|
// Log all tool events in development
|
|
126
126
|
const originalEmit = eventBus.emit.bind(eventBus);
|
|
127
127
|
eventBus.emit = function (event, data) {
|
|
128
|
-
if (String(event).startsWith(
|
|
129
|
-
|
|
128
|
+
if (String(event).startsWith("tool:") ||
|
|
129
|
+
String(event).startsWith("registry:")) {
|
|
130
|
+
console.error(`[MCP EventBus] ${String(event)}:`, data);
|
|
130
131
|
}
|
|
131
132
|
return originalEmit(event, data);
|
|
132
133
|
};
|
|
133
134
|
// Add to global for debugging
|
|
134
|
-
if (typeof globalThis !==
|
|
135
|
+
if (typeof globalThis !== "undefined") {
|
|
135
136
|
globalThis.__mcpEventBus = eventBus;
|
|
136
137
|
}
|
|
137
138
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@identikey/coding-mcp",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.4",
|
|
5
5
|
"description": "MCP Server with expert AI personas for code architecture, reviews, screenshots, and research",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./build/index.js",
|