@cognigy/plugin-engine 1.0.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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +245 -0
  3. package/dist/api/client.d.ts +21 -0
  4. package/dist/api/client.d.ts.map +1 -0
  5. package/dist/api/client.js +123 -0
  6. package/dist/api/client.js.map +1 -0
  7. package/dist/config.d.ts +19 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +141 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +93 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/instructions.d.ts +2 -0
  16. package/dist/instructions.d.ts.map +1 -0
  17. package/dist/instructions.js +36 -0
  18. package/dist/instructions.js.map +1 -0
  19. package/dist/schemas/tools.d.ts +1846 -0
  20. package/dist/schemas/tools.d.ts.map +1 -0
  21. package/dist/schemas/tools.js +581 -0
  22. package/dist/schemas/tools.js.map +1 -0
  23. package/dist/tools/definitions.d.ts +12 -0
  24. package/dist/tools/definitions.d.ts.map +1 -0
  25. package/dist/tools/definitions.js +1522 -0
  26. package/dist/tools/definitions.js.map +1 -0
  27. package/dist/tools/filters.d.ts +13 -0
  28. package/dist/tools/filters.d.ts.map +1 -0
  29. package/dist/tools/filters.js +107 -0
  30. package/dist/tools/filters.js.map +1 -0
  31. package/dist/tools/handlers.d.ts +71 -0
  32. package/dist/tools/handlers.d.ts.map +1 -0
  33. package/dist/tools/handlers.js +3603 -0
  34. package/dist/tools/handlers.js.map +1 -0
  35. package/dist/tools/nodeRegistry.d.ts +37 -0
  36. package/dist/tools/nodeRegistry.d.ts.map +1 -0
  37. package/dist/tools/nodeRegistry.js +175 -0
  38. package/dist/tools/nodeRegistry.js.map +1 -0
  39. package/dist/tools/packageManagement.d.ts +140 -0
  40. package/dist/tools/packageManagement.d.ts.map +1 -0
  41. package/dist/tools/packageManagement.js +455 -0
  42. package/dist/tools/packageManagement.js.map +1 -0
  43. package/dist/tools/voiceChecklist.d.ts +80 -0
  44. package/dist/tools/voiceChecklist.d.ts.map +1 -0
  45. package/dist/tools/voiceChecklist.js +635 -0
  46. package/dist/tools/voiceChecklist.js.map +1 -0
  47. package/dist/tools/webchatSettings.d.ts +14 -0
  48. package/dist/tools/webchatSettings.d.ts.map +1 -0
  49. package/dist/tools/webchatSettings.js +462 -0
  50. package/dist/tools/webchatSettings.js.map +1 -0
  51. package/dist/utils/logger.d.ts +19 -0
  52. package/dist/utils/logger.d.ts.map +1 -0
  53. package/dist/utils/logger.js +52 -0
  54. package/dist/utils/logger.js.map +1 -0
  55. package/dist/utils/rateLimiter.d.ts +33 -0
  56. package/dist/utils/rateLimiter.d.ts.map +1 -0
  57. package/dist/utils/rateLimiter.js +68 -0
  58. package/dist/utils/rateLimiter.js.map +1 -0
  59. package/package.json +64 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cognigy GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,245 @@
1
+ # NiCE Cognigy MCP Plugin
2
+
3
+ > **Migrated from [`Cognigy/cognigy-mcp`](https://github.com/Cognigy/cognigy-mcp).** This repository began as a fork of `cognigy-mcp` and is now a detached project distributed exclusively as a **plugin** — supported by **Claude Code** and **Codex** today, with more clients to come. The plugin auto-installs and auto-updates the MCP server engine and ships skills + agents.
4
+
5
+ A plugin that connects your AI assistant to the [Cognigy.AI](https://www.cognigy.com) REST API. Create, test, and improve LLM-based AI Agents through a self-improvement loop — without leaving your client.
6
+
7
+ ## Features
8
+
9
+ - **16 workflow tools** for agent creation, deployment, packaging, and voice setup
10
+ - **One-call agent setup**: creates Agent + Flow + AI Agent Job Node + REST Endpoint automatically
11
+ - **Self-improvement loop**: talk to your agent, evaluate responses, update the job description, repeat
12
+ - **Knowledge store support**: attach RAG knowledge stores to agents as tools
13
+ - **Browser voice deployment**: create Voice Gateway endpoints with WebRTC demo URLs
14
+ - **Voice preview setup**: configure supported speech providers for voice experiences
15
+ - **Skills + agents**: workflow guidance auto-loads as skills in supporting clients; build/go-live loops run as subagents
16
+ - Built-in rate limiting, Zod input validation, and RFC 7807 error responses
17
+
18
+ ## Tools
19
+
20
+ | Tool | Type | Description |
21
+ | ---------------------- | ----- | --------------------------------------------------------------------------------------------------- |
22
+ | `create_ai_agent` | Write | Create a complete AI Agent with auto-provisioned flow, job node, and REST endpoint |
23
+ | `update_ai_agent` | Write | Update persona, guardrails, job config (role, procedures, LLM, temperature) |
24
+ | `setup_llm` | Write | Create an LLM resource (GPT-4, Claude, Mistral, etc.) with automatic connection validation |
25
+ | `talk_to_agent` | Write | Send a message to an AI Agent and get its response |
26
+ | `list_resources` | Read | List projects, agents, flows, endpoints, LLMs, knowledge stores, and more |
27
+ | `get_resource` | Read | Get detailed information about a single resource |
28
+ | `delete_resource` | Write | Permanently delete a resource |
29
+ | `manage_knowledge` | Write | Create knowledge stores, add sources (URL, text, file), list chunks for RAG |
30
+ | `create_tool` | Write | Add a tool (HTTP, knowledge, email, MCP) to an agent's job node |
31
+ | `update_tool` | Write | Update an existing tool node's configuration |
32
+ | `manage_webchat` | Write | Create or configure a Webchat v3 endpoint for website deployment |
33
+ | `manage_flow_nodes` | Write | Create, update, delete, or list flow nodes for conversation logic |
34
+ | `manage_packages` | Write | List exportable resources, upload, inspect, import, export, and download Cognigy package zip files |
35
+ | `manage_voice_gateway` | Write | Create or configure a Voice Gateway endpoint with WebRTC for browser-based voice interaction |
36
+ | `manage_settings` | Write | Manage project-level settings including voice preview and Knowledge AI configuration |
37
+ | `audit_voice_agent` | Write | Audit a voice agent against the Go-Live Checklist; reports by default, applies safe fixes on demand |
38
+
39
+ Detailed workflow guidance (agent creation, knowledge/RAG, voice, webchat, flow nodes, packages, settings, LLM providers, tools, troubleshooting) ships as **skills** that load automatically when your request matches, in clients that support them (e.g. Claude Code) — see below.
40
+
41
+ ## Installation
42
+
43
+ The plugin is supported by **Claude Code** and **Codex** today; more clients will be added. Install steps below cover Claude Code; the plugin always launches the latest published server engine, so you get updates automatically with no manual reinstall.
44
+
45
+ ### Claude Code
46
+
47
+ ```
48
+ /plugin marketplace add Cognigy/cognigy-plugin
49
+ /plugin install cognigy-mcp@cognigy-plugin
50
+ ```
51
+
52
+ On enable, Claude Code prompts for your **Cognigy API base URL** (default `https://api-trial.cognigy.ai`) and **API key** (Cognigy.AI → User Menu → My Profile → API Keys). The key is stored in your system keychain. Requires [Node.js 20+](https://nodejs.org).
53
+
54
+ The first session downloads the server into the plugin's data directory, which takes a moment. If the Cognigy tools don't appear right away on that first launch, run `/mcp`, reconnect the Cognigy server (or restart Claude Code) — later sessions connect instantly and refresh the server to the latest published version automatically.
55
+
56
+ Beyond the MCP tools, the plugin ships **skills** and **agents** that make the workflows discoverable without you having to ask for a guide:
57
+
58
+ - **Skills** (`/skills`) — one per workflow (agent creation, knowledge/RAG, voice gateway, voice go-live checklist, webchat, flow nodes, packages, settings, LLM providers, tools, troubleshooting). Claude loads the matching skill automatically when your request fits — no need to ask for a guide.
59
+ - **Agents** (`/agents`) — `cognigy-agent-builder` runs the full build-and-test loop for a new agent, and `cognigy-voice-go-live` audits a voice agent against the Go-Live Checklist and applies the safe fixes. Each runs in its own context and reports back a summary.
60
+
61
+ ---
62
+
63
+ ## What It Does
64
+
65
+ Create a complete AI Agent in one tool call, then iterate and improve through conversation:
66
+
67
+ 1. **Create** → AI Agent + Flow + Job Node + Endpoint (automatic)
68
+ 2. **Test** → Talk to your agent via REST endpoint
69
+ 3. **Improve** → Update persona, guardrails, job description, tools
70
+ 4. **Test Again** → Compare responses and iterate
71
+ 5. **Deploy** → Publish to Webchat or create a Voice Gateway endpoint with one call
72
+
73
+ ## Configuration
74
+
75
+ The plugin collects your **Cognigy API base URL** and **API key** through Claude Code's install prompt (stored in the system keychain) and passes them to the server as environment variables. The optional variables below can be set in the plugin's MCP server `env` if you need to override defaults.
76
+
77
+ | Variable | Required | Default | Description |
78
+ | ------------------------- | -------- | ------- | -------------------------------- |
79
+ | `COGNIGY_API_BASE_URL` | Yes | — | Your Cognigy API base URL |
80
+ | `COGNIGY_API_KEY` | Yes | — | Your Cognigy API key |
81
+ | `LOG_LEVEL` | No | `info` | `debug`, `info`, `warn`, `error` |
82
+ | `RATE_LIMIT_MAX_REQUESTS` | No | `100` | Max requests per window |
83
+ | `RATE_LIMIT_WINDOW_MS` | No | `60000` | Rate limit window in ms |
84
+
85
+ ## Usage Examples
86
+
87
+ ### 1. Create a customer support agent
88
+
89
+ ```
90
+ Create a Cognigy AI Agent called "Support Bot" in project <projectId> with a helpful
91
+ customer support persona. If the project has no working LLM, first look for another
92
+ project with an llm_model that has a connectionId, import that LLM and its connection
93
+ via manage_packages, and only fall back to setup_llm if no reusable LLM exists.
94
+ Return the endpoint URL only after the project has a confirmed working LLM.
95
+ ```
96
+
97
+ The MCP server should first check whether the target project already has a working LLM. If not, it should prefer reusing the required LLM resource set plus its connection resources from another project via `manage_packages`, and only use `setup_llm` as the last resort before calling `create_ai_agent`.
98
+
99
+ ### 2. Test and improve the agent
100
+
101
+ ```
102
+ Talk to my Support Bot at <endpointUrl> and ask "How do I reset my password?".
103
+ Then update the job description to make the response more concise and actionable.
104
+ Talk to it again and compare the responses.
105
+ ```
106
+
107
+ This triggers the self-improvement loop: `talk_to_agent` → evaluate → `update_ai_agent` → `talk_to_agent` again.
108
+
109
+ ### 3. Add a knowledge store for RAG
110
+
111
+ ```
112
+ Create a knowledge store in project <projectId>, add the URL
113
+ https://docs.example.com/faq as a source, then attach it to my Support Bot
114
+ so the agent can search it when answering questions.
115
+ ```
116
+
117
+ The server will call `manage_knowledge` to create the store and ingest the URL,
118
+ then `create_tool` to attach it as a knowledge search tool on the agent's job
119
+ node.
120
+
121
+ If the project will use Knowledge Search, the server should first configure
122
+ Knowledge AI Settings with `manage_settings { operation: 'set_knowledge_ai',
123
+ ... }` using model IDs from the same project.
124
+
125
+ For normal AI-agent knowledge flows, this should happen before
126
+ `manage_knowledge { operation: 'create_store', ... }`.
127
+
128
+ The model roles are different:
129
+
130
+ - The knowledge store itself needs an embedding-capable model for the index.
131
+ - `knowledgeSearchModelId` is a separate Knowledge AI setting for search
132
+ behavior, but the accepted model type is instance-dependent.
133
+ - If reusing another project's knowledge setup, identify the exact source-project
134
+ Knowledge Search model first and import it into the target project before the
135
+ first `set_knowledge_ai` attempt.
136
+ - Import the full required knowledge model set in one pass. If the embedding
137
+ model, Knowledge Search model, and agent model share one connection, transfer
138
+ that single connection once alongside all of those models.
139
+ - After importing LLMs into the target project, enumerate the target
140
+ project's `llm_model` resources and try those same-project IDs before
141
+ creating a new model.
142
+ - For Knowledge Search specifically, use `list_resources` with
143
+ `resourceType: 'llm_model'` and `useCase: 'knowledgeSearch'` so the
144
+ candidates match the Settings UI dropdown rather than the unfiltered
145
+ project-wide LLM list.
146
+ - Do not substitute a fresh or generic model for `knowledgeSearchModelId`
147
+ unless the user explicitly asks for that and existing same-project candidates
148
+ have already failed API validation.
149
+ - If the exact source-project Knowledge Search model is missing from the target
150
+ project, import it before trying a different model.
151
+ - If all same-project candidates fail, report the exact attempted model IDs
152
+ and API errors rather than claiming a platform-side bug.
153
+ - Do not describe an untried model as "likely" unsupported or rejected.
154
+ - Treat model names in examples as examples only, not as the source of truth.
155
+
156
+ ### 4. Get analytics on recent conversations
157
+
158
+ ```
159
+ Show me the last 20 conversations for project <projectId> and summarize
160
+ what topics users asked about most.
161
+ ```
162
+
163
+ Uses `list_resources` to fetch conversations, then your AI assistant summarizes the content.
164
+
165
+ ### 5. List all projects and agents
166
+
167
+ ```
168
+ List all my Cognigy projects and show which AI Agents exist in each one.
169
+ ```
170
+
171
+ Uses `list_resources` with `resourceType: 'project'` and `resourceType: 'agent'`.
172
+
173
+ ### 6. Import a package into a project
174
+
175
+ ```
176
+ Upload the package at /absolute/path/to/support-bot.zip into project <projectId>,
177
+ show me the import preview, then import it using the default selections.
178
+ ```
179
+
180
+ Uses `manage_packages` with `operation: 'upload_and_inspect'`, then `operation: 'import'`.
181
+
182
+ ### 7. Export a package from project resources
183
+
184
+ ```
185
+ Create a package named "support-bot" from these resource IDs in project <projectId>,
186
+ include dependencies, and save the zip to /absolute/path/to/exports/.
187
+ ```
188
+
189
+ Uses `manage_packages` with `operation: 'list_exportable'` to discover candidates, then `operation: 'export'`, then `operation: 'download'` when needed.
190
+
191
+ ### 8. Configure voice preview and create a browser voice endpoint
192
+
193
+ ```
194
+ Set the voice preview provider for project <projectId> to Microsoft, then create
195
+ a Voice Gateway endpoint for flow <flowId> named "Support Voice" and give me the
196
+ WebRTC demo URL I can open in the browser.
197
+ ```
198
+
199
+ This uses `manage_settings` with `operation: 'set_voice_preview'` to configure speech, then `manage_voice_gateway` to provision a `voiceGateway2` endpoint with a `webrtcDemoUrl`.
200
+
201
+ ### 9. Configure Knowledge AI settings for search
202
+
203
+ ```
204
+ Configure Knowledge AI settings for project <projectId> by setting the Knowledge Search
205
+ model and the Content Parser. If I am creating a new project and another project already
206
+ has a working knowledge setup, reproduce that exact Knowledge Search model and Content
207
+ Parser choice in the new project before trying generic defaults.
208
+ ```
209
+
210
+ This uses `manage_settings` with `operation: 'set_knowledge_ai'` to configure
211
+ `knowledgeSearch` and `contentParser` at the project-settings level. Reusing
212
+ settings does not mean copying another project's settings alone; the required
213
+ model must exist in the target project first, either by import or by creating it there.
214
+ For knowledge workflows, the MCP should import the full required source-project model set
215
+ in one pass, reuse shared connections only once, and try the imported same-project model
216
+ IDs before falling back to `setup_llm`.
217
+
218
+ ## Security
219
+
220
+ - API keys are passed via environment variables and never logged
221
+ - All inputs are validated using Zod schemas before reaching the API
222
+ - Rate limiting is built in to prevent API abuse
223
+
224
+ ## Privacy Policy
225
+
226
+ This MCP server transmits requests to the Cognigy.AI API endpoint configured via `COGNIGY_API_BASE_URL`. No data is collected, stored, or shared by this MCP server itself — all data remains between your AI client and your Cognigy.AI instance.
227
+
228
+ Full privacy policy: [https://www.cognigy.com/privacy-policy](https://www.cognigy.com/privacy-policy)
229
+
230
+ ## Support
231
+
232
+ - **Issues**: [GitHub Issues](https://github.com/Cognigy/cognigy-plugin/issues)
233
+ - **Cognigy support**: support@cognigy.com
234
+ - **Documentation**: see [`docs/`](https://github.com/Cognigy/cognigy-plugin/tree/main/docs) folder
235
+
236
+ ## Documentation
237
+
238
+ - [docs/ARCHITECTURE.md](https://github.com/Cognigy/cognigy-plugin/blob/main/docs/ARCHITECTURE.md) — tool design, self-improvement loop, ID formats
239
+ - [docs/USAGE.md](https://github.com/Cognigy/cognigy-plugin/blob/main/docs/USAGE.md) — detailed usage reference
240
+ - [docs/TESTING.md](https://github.com/Cognigy/cognigy-plugin/blob/main/docs/TESTING.md) — how to test the plugin and a local engine build
241
+ - [docs/CONTRIBUTING.md](https://github.com/Cognigy/cognigy-plugin/blob/main/docs/CONTRIBUTING.md) — development setup and contribution guide
242
+
243
+ ## License
244
+
245
+ [MIT](LICENSE)
@@ -0,0 +1,21 @@
1
+ import { ReadStream } from "fs";
2
+ import { AxiosRequestConfig } from "axios";
3
+ export interface CognigyApiClientConfig {
4
+ baseUrl: string;
5
+ apiKey: string;
6
+ }
7
+ export declare class CognigyApiClient {
8
+ private client;
9
+ private apiKey;
10
+ constructor(config: CognigyApiClientConfig);
11
+ private formatError;
12
+ get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
13
+ post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
14
+ put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
15
+ patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
16
+ delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
17
+ uploadFile<T = any>(url: string, fileData: Buffer | ReadStream, fileName: string, extraFields?: Record<string, string>, options?: {
18
+ timeoutMs?: number;
19
+ }): Promise<T>;
20
+ }
21
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAc,EAGZ,kBAAkB,EAEnB,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAuBD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,sBAAsB;IAmE1C,OAAO,CAAC,WAAW;IAcb,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAKlE,IAAI,CAAC,CAAC,GAAG,GAAG,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,GAAG,EACV,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC;IASP,GAAG,CAAC,CAAC,GAAG,GAAG,EACf,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,GAAG,EACV,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC;IAKP,KAAK,CAAC,CAAC,GAAG,GAAG,EACjB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,GAAG,EACV,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC;IASP,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAKrE,UAAU,CAAC,CAAC,GAAG,GAAG,EACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,UAAU,EAC7B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,CAAC,CAAC;CAiBd"}
@@ -0,0 +1,123 @@
1
+ import axios from "axios";
2
+ import FormData from "form-data";
3
+ import { logger } from "../utils/logger.js";
4
+ const MAX_RETRIES = 3;
5
+ const RETRY_BASE_MS = 500;
6
+ const RETRYABLE_NETWORK_CODES = new Set([
7
+ "ECONNRESET",
8
+ "ECONNREFUSED",
9
+ "ETIMEDOUT",
10
+ "ENOTFOUND",
11
+ "EAI_AGAIN",
12
+ "EPIPE",
13
+ "ERR_NETWORK",
14
+ ]);
15
+ function isRetryable(error) {
16
+ if (error.response) {
17
+ const status = error.response.status;
18
+ return status === 429 || status >= 500;
19
+ }
20
+ return RETRYABLE_NETWORK_CODES.has(error.code ?? "");
21
+ }
22
+ export class CognigyApiClient {
23
+ client;
24
+ apiKey;
25
+ constructor(config) {
26
+ this.apiKey = config.apiKey;
27
+ this.client = axios.create({
28
+ baseURL: config.baseUrl,
29
+ headers: {
30
+ "Content-Type": "application/json",
31
+ Accept: "application/json",
32
+ },
33
+ timeout: 30000,
34
+ });
35
+ this.client.interceptors.request.use((reqConfig) => {
36
+ reqConfig.headers["X-API-Key"] = this.apiKey;
37
+ logger.debug(`API Request: ${reqConfig.method?.toUpperCase()} ${reqConfig.url}`);
38
+ return reqConfig;
39
+ }, (error) => {
40
+ logger.error("API Request Error", { error: error.message });
41
+ return Promise.reject(error);
42
+ });
43
+ this.client.interceptors.response.use((response) => {
44
+ logger.debug(`API Response: ${response.status} ${response.config.url}`);
45
+ return response;
46
+ }, async (error) => {
47
+ const config = error.config;
48
+ const status = error.response?.status ?? 0;
49
+ if (config && isRetryable(error)) {
50
+ config._retryCount = (config._retryCount ?? 0) + 1;
51
+ if (config._retryCount <= MAX_RETRIES) {
52
+ const delay = RETRY_BASE_MS * Math.pow(2, config._retryCount - 1);
53
+ logger.warn(`Retrying request (${config._retryCount}/${MAX_RETRIES}) after ${delay}ms`, {
54
+ status,
55
+ url: config.url,
56
+ });
57
+ await new Promise((r) => setTimeout(r, delay));
58
+ return this.client.request(config);
59
+ }
60
+ }
61
+ const message = error.response?.data?.detail || error.message;
62
+ const traceId = error.response?.data?.traceId;
63
+ logger.error("API Response Error", {
64
+ status: status || "N/A",
65
+ message,
66
+ traceId,
67
+ url: config?.url,
68
+ });
69
+ return Promise.reject(this.formatError(error));
70
+ });
71
+ }
72
+ formatError(error) {
73
+ const data = error.response?.data;
74
+ if (data) {
75
+ const message = data.detail || data.title || "API request failed";
76
+ const enhancedError = new Error(message);
77
+ enhancedError.status = data.status || error.response?.status;
78
+ enhancedError.code = data.code;
79
+ enhancedError.traceId = data.traceId;
80
+ enhancedError.details = data.details;
81
+ return enhancedError;
82
+ }
83
+ return error;
84
+ }
85
+ async get(url, config) {
86
+ const response = await this.client.get(url, config);
87
+ return response.data;
88
+ }
89
+ async post(url, data, config) {
90
+ const response = await this.client.post(url, data, config);
91
+ return response.data;
92
+ }
93
+ async put(url, data, config) {
94
+ const response = await this.client.put(url, data, config);
95
+ return response.data;
96
+ }
97
+ async patch(url, data, config) {
98
+ const response = await this.client.patch(url, data, config);
99
+ return response.data;
100
+ }
101
+ async delete(url, config) {
102
+ const response = await this.client.delete(url, config);
103
+ return response.data;
104
+ }
105
+ async uploadFile(url, fileData, fileName, extraFields, options) {
106
+ const form = new FormData();
107
+ form.append("file", fileData, { filename: fileName });
108
+ if (extraFields) {
109
+ for (const [key, value] of Object.entries(extraFields)) {
110
+ form.append(key, value);
111
+ }
112
+ }
113
+ const response = await this.client.post(url, form, {
114
+ headers: {
115
+ ...form.getHeaders(),
116
+ "X-API-Key": this.apiKey,
117
+ },
118
+ timeout: options?.timeoutMs ?? 120000,
119
+ });
120
+ return response.data;
121
+ }
122
+ }
123
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AACA,OAAO,KAKN,MAAM,OAAO,CAAC;AACf,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAO5C,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,YAAY;IACZ,cAAc;IACd,WAAW;IACX,WAAW;IACX,WAAW;IACX,OAAO;IACP,aAAa;CACd,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,KAAiB;IACpC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACrC,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,IAAI,GAAG,CAAC;I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 export interface Config {
2
+ apiBaseUrl: string;
3
+ endpointBaseUrl: string;
4
+ webchatBaseUrl: string;
5
+ staticFilesBaseUrl: string;
6
+ apiKey: string;
7
+ serverName: string;
8
+ serverVersion: string;
9
+ logLevel: "debug" | "info" | "warn" | "error";
10
+ rateLimit: {
11
+ maxRequests: number;
12
+ windowMs: number;
13
+ };
14
+ }
15
+ /**
16
+ * Load configuration from environment variables
17
+ */
18
+ export declare function loadConfig(): Config;
19
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C,SAAS,EAAE;QACT,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AA2GD;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAoDnC"}
package/dist/config.js ADDED
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Configuration for the NiCE Cognigy MCP Connector
3
+ */
4
+ import { readFileSync } from "fs";
5
+ import { dirname, join } from "path";
6
+ import { fileURLToPath } from "url";
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ function getPackageVersion() {
9
+ try {
10
+ const packageJsonPath = join(__dirname, "..", "package.json");
11
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
12
+ return packageJson.version || "0.0.0";
13
+ }
14
+ catch {
15
+ return "0.0.0";
16
+ }
17
+ }
18
+ const PACKAGE_VERSION = getPackageVersion();
19
+ /**
20
+ * Normalise the API base URL so it always points to the API host.
21
+ * Users may supply the bare UI URL (e.g. https://dev.cognigy.ai) instead of the
22
+ * API URL (https://api-dev.cognigy.ai). We detect this and prepend "api-".
23
+ */
24
+ function normalizeApiBaseUrl(raw) {
25
+ try {
26
+ const url = new URL(raw);
27
+ if (!url.hostname.startsWith("api-") &&
28
+ url.hostname.endsWith(".cognigy.ai")) {
29
+ url.hostname = `api-${url.hostname}`;
30
+ return url.toString().replace(/\/+$/, "");
31
+ }
32
+ }
33
+ catch {
34
+ // fall through
35
+ }
36
+ return raw.replace(/\/+$/, "");
37
+ }
38
+ /**
39
+ * Derive the endpoint base URL from the API base URL.
40
+ * Pattern: https://api-{env}.cognigy.ai -> https://endpoint-{env}.cognigy.ai
41
+ */
42
+ function deriveEndpointBaseUrl(apiBaseUrl) {
43
+ try {
44
+ const url = new URL(apiBaseUrl);
45
+ const match = url.hostname.match(/^api-(.+)$/);
46
+ if (match) {
47
+ return `${url.protocol}//endpoint-${match[1]}`;
48
+ }
49
+ }
50
+ catch {
51
+ // fall through
52
+ }
53
+ return apiBaseUrl.replace(/\/api-/, "/endpoint-");
54
+ }
55
+ /**
56
+ * Derive the static-files base URL from the API base URL.
57
+ * Pattern: https://api-{env}.cognigy.ai -> https://static-{env}.cognigy.ai
58
+ */
59
+ function deriveStaticFilesBaseUrl(apiBaseUrl) {
60
+ try {
61
+ const url = new URL(apiBaseUrl);
62
+ const match = url.hostname.match(/^api-(.+)$/);
63
+ if (match) {
64
+ return `${url.protocol}//static-${match[1]}`;
65
+ }
66
+ }
67
+ catch {
68
+ // fall through
69
+ }
70
+ return apiBaseUrl.replace(/\/api-/, "/static-");
71
+ }
72
+ /**
73
+ * Derive the webchat demo base URL from the API base URL.
74
+ * Pattern: https://api-{env}.cognigy.ai -> https://webchat-{env}.cognigy.ai
75
+ */
76
+ function deriveWebchatBaseUrl(apiBaseUrl) {
77
+ try {
78
+ const url = new URL(apiBaseUrl);
79
+ const match = url.hostname.match(/^api-(.+)$/);
80
+ if (match) {
81
+ return `${url.protocol}//webchat-${match[1]}`;
82
+ }
83
+ }
84
+ catch {
85
+ // fall through
86
+ }
87
+ return apiBaseUrl.replace(/\/api-/, "/webchat-");
88
+ }
89
+ const VALID_LOG_LEVELS = new Set(["debug", "info", "warn", "error"]);
90
+ function parseIntWithDefault(envVar, defaultValue) {
91
+ if (!envVar)
92
+ return defaultValue;
93
+ const parsed = parseInt(envVar, 10);
94
+ if (Number.isNaN(parsed)) {
95
+ console.error(`[config] Invalid integer "${envVar}", using default ${defaultValue}`);
96
+ return defaultValue;
97
+ }
98
+ return parsed;
99
+ }
100
+ /**
101
+ * Load configuration from environment variables
102
+ */
103
+ export function loadConfig() {
104
+ const apiBaseUrl = process.env.COGNIGY_API_BASE_URL;
105
+ const apiKey = process.env.COGNIGY_API_KEY;
106
+ if (!apiBaseUrl) {
107
+ throw new Error("COGNIGY_API_BASE_URL environment variable is required");
108
+ }
109
+ if (!apiKey) {
110
+ throw new Error("COGNIGY_API_KEY environment variable is required");
111
+ }
112
+ const normalizedApiBaseUrl = normalizeApiBaseUrl(apiBaseUrl);
113
+ const endpointBaseUrl = process.env.COGNIGY_ENDPOINT_BASE_URL ||
114
+ deriveEndpointBaseUrl(normalizedApiBaseUrl);
115
+ const webchatBaseUrl = process.env.COGNIGY_WEBCHAT_BASE_URL ||
116
+ deriveWebchatBaseUrl(normalizedApiBaseUrl);
117
+ const staticFilesBaseUrl = process.env.COGNIGY_STATIC_FILES_BASE_URL ||
118
+ deriveStaticFilesBaseUrl(normalizedApiBaseUrl);
119
+ return {
120
+ apiBaseUrl: normalizedApiBaseUrl,
121
+ endpointBaseUrl,
122
+ webchatBaseUrl,
123
+ staticFilesBaseUrl,
124
+ apiKey,
125
+ serverName: process.env.MCP_SERVER_NAME || "cognigy-api-mcp",
126
+ serverVersion: process.env.MCP_SERVER_VERSION || PACKAGE_VERSION,
127
+ logLevel: (() => {
128
+ const raw = process.env.LOG_LEVEL || "info";
129
+ if (!VALID_LOG_LEVELS.has(raw)) {
130
+ console.error(`[config] Invalid LOG_LEVEL "${raw}", falling back to "info"`);
131
+ return "info";
132
+ }
133
+ return raw;
134
+ })(),
135
+ rateLimit: {
136
+ maxRequests: parseIntWithDefault(process.env.RATE_LIMIT_MAX_REQUESTS, 100),
137
+ windowMs: parseIntWithDefault(process.env.RATE_LIMIT_WINDOW_MS, 60000),
138
+ },
139
+ };
140
+ }
141
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAiBpC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAEpE,CAAC;QACF,OAAO,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,eAAe,GAAG,iBAAiB,EAAE,CAAC;AAE5C;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,GAAW;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,IACE,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC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 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}