@jclvsh/iris 0.5.1 → 0.5.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/dist/index.js +14 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,20 @@ const server = new McpServer({
|
|
|
22
22
|
name: "iris",
|
|
23
23
|
version: pkg.version,
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
// Lazy client: defer the IrisClient constructor (which throws when
|
|
26
|
+
// IRIS_API_KEY is missing) until a tool invocation actually issues an HTTP call.
|
|
27
|
+
// MCP discovery (initialize, tools/list) never touches the proxy, so the server
|
|
28
|
+
// boots cleanly without an API key set and surfaces a structured error only
|
|
29
|
+
// when a tool is invoked.
|
|
30
|
+
let realClient = null;
|
|
31
|
+
const client = new Proxy({}, {
|
|
32
|
+
get(_target, prop, receiver) {
|
|
33
|
+
if (!realClient)
|
|
34
|
+
realClient = new IrisClient();
|
|
35
|
+
const value = Reflect.get(realClient, prop, receiver);
|
|
36
|
+
return typeof value === "function" ? value.bind(realClient) : value;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
26
39
|
registerCampaignTools(server, client);
|
|
27
40
|
registerContactTools(server, client);
|
|
28
41
|
registerConversationTools(server, client);
|