How cognigy/cognigy-plugin works
Purpose and Runtime Entry Points
NiCE Cognigy Plugin is a TypeScript MCP server engine that lets AI-client plugins manage Cognigy.AI resources through its REST API. It is distributed as host-native plugin/extension packages for Claude, Codex, Gemini, Cursor, Antigravity, and Agent Plugins hosts.
Primary runtime entry points are the MCP server in src/index.ts, configuration/bootstrap in src/setup.ts, and the install-manager CLI surface under src/install/. Node.js 20+ is the material runtime.
Host Packaging and Client Boundary
The engine is packaged separately from client-facing manifests. plugin/mcp.json and plugin/plugin.json describe the common plugin; host-specific manifests adapt it to their plugin systems, including plugin/.claude-plugin/plugin.json and plugin/.codex-plugin/mcp.json.
The plugin/skills/ and plugin/agents/ content is declarative guidance executed or loaded by capable hosts, not server business logic. They direct clients toward the MCP tools and Cognigy workflows.
Configuration, Credentials, and Installation
Configuration resolves Cognigy API URL/key from environment first, then a protected user configuration file. Core resolution and validation are in src/config.ts and src/userConfigFile.ts.
The installer is a multi-client orchestration boundary: src/setup.ts selects clients and delegates platform-specific registration to modules such as src/install/claudeCode.ts, src/install/claudeDesktop.ts, src/install/codex.ts, and src/install/gemini.ts. Shell bootstrap scripts, install.sh and install.ps1, launch the published setup package.
MCP Tool Registry and Request Pipeline
src/index.ts initializes the MCP server and exposes the tool surface. src/tools/definitions.ts declares tool metadata/schema associations; src/tools/handlers.ts maps calls to operations; src/schemas/tools.ts provides Zod validation contracts.
The critical request pipeline is: host invokes an MCP tool → schema validation → rate-limit and context setup → handler execution → Cognigy REST request/response translation. This boundary ensures credentials are not passed as tool parameters and malformed calls do not reach Cognigy.
Cognigy API Integration and Audit Context
src/api/client.ts is the outbound HTTP boundary to the configured Cognigy.AI REST API. It is responsible for authenticated API calls and platform-facing error behavior.
Per-run session IDs and per-tool task IDs are constructed through src/utils/actorContext.ts and attached for Cognigy audit attribution. src/utils/rateLimiter.ts protects the API from excessive tool calls; src/utils/logger.ts provides controlled operational logging.
Resource and Agent Lifecycle Operations
General resource reads/deletes, agent creation/update, LLM setup, agent conversation, knowledge, tools, and flow-node changes are centralized in src/tools/handlers.ts, with node-specific validation/lookup in src/tools/nodeRegistry.ts and src/tools/toolParameters.ts.
The defining workflow is AI-agent provisioning: create agent resources, flow, AI Agent Job node, and REST endpoint; then permit iterative talk_to_agent and update operations. Flow visualization/rendering is handled at src/render/flowRender.ts.
Deployment, Portability, and Specialized Workflows
Package import/export/download behavior is isolated in src/tools/packageManagement.ts; snapshot creation/restore rollback is isolated in src/tools/snapshotManagement.ts. These are state-transfer and recovery boundaries around Cognigy projects.
Specialized deployment configuration is implemented through src/tools/webchatSettings.ts (Webchat), src/tools/voiceChecklist.ts (voice audit/go-live), and the central handlers. These operations configure Cognigy endpoints, voice gateway/WebRTC capability, and project-level AI settings rather than hosting any frontend or voice service locally.
External Services and Delivery
The sole runtime external service is the configured Cognigy.AI REST API, including its resource, package, endpoint, knowledge, settings, and audit-event APIs. Documentation lookup is packaged as plugin guidance under plugin/skills/docs-lookup/SKILL.md.
Release delivery is npm/package-based, with plugin manifest consistency enforced by scripts/check-plugin-manifest.mjs and version synchronization by scripts/sync-plugin-version.mjs. GitHub Actions workflows in .github/workflows/release.yml publish release artifacts.
Main entry points: handlers.ts Tool handlers · index.ts MCP server · rateLimiter.ts Request controls · mcp.json Common manifests
Components 20
Plugin Hosts
- AI plugin hosts · Claude, Codex, Gemini, Cursor, Antigravity, and Agent Plugins hosts.
- Common manifests
plugin/mcp.json - Host-specific manifests
plugin/.claude-plugin/plugin.json - Skills and agents · Host-loaded instructions direct clients to MCP tools and Cognigy workflows.
MCP Runtime
- MCP server · Primary Node.js 20+ runtime entry point and tool surface.
src/index.ts - Tool registry · Associates MCP tool metadata with schemas and operations.
src/tools/definitions.ts - Tool contracts
src/schemas/tools.ts - Request controls · Creates audit context and limits excessive tool calls before execution.
src/utils/rateLimiter.ts - Configuration and credentials · Resolves API URL and key from environment or protected user configuration.
src/config.ts - Setup installer · Selects clients and registers the published MCP package per platform.
src/setup.ts - Shell bootstrap
install.sh
Cognigy Operations
- Tool handlers · Centralizes resource, agent, conversation, knowledge, and flow operations.
src/tools/handlers.ts - Node operations
src/tools/nodeRegistry.ts - Agent provisioning · Creates agents, flows, AI Agent Job nodes, and REST endpoints.
src/tools/handlers.ts - Flow rendering
src/render/flowRender.ts - Package and snapshots · Handles package transfer and snapshot rollback.
src/tools/packageManagement.ts - Webchat and voice settings · Configures endpoints, voice capability, and project AI settings.
src/tools/webchatSettings.ts
Packaging & Release
- Release pipeline · Publishes npm/package release artifacts.
.github/workflows/release.yml - Manifest/version checks · Enforces manifest consistency and synchronized versions.
scripts/check-plugin-manifest.mjs
Other components
- Cognigy.AI REST API · Authenticated resource, endpoint, package, knowledge, settings, and audit API boundary.
Connections 22
- AI plugin hosts → Host-specific manifests: loads
- Host-specific manifests → Common manifests: adapts
- AI plugin hosts → Skills and agents: loads guidance
- AI plugin hosts → MCP server: invokes MCP tools
- Common manifests → MCP server: declares
- MCP server → Tool registry: exposes
- Tool registry → Tool contracts: uses
- MCP server → Request controls: sets up request
- Request controls → Tool handlers: permits execution
- Tool contracts → Tool handlers: validates calls
- Tool handlers → Node operations: validates nodes
- Tool handlers → Agent provisioning: drives
- Tool handlers → Flow rendering: renders flows
- Tool handlers → Package and snapshots: transfers and restores
- Tool handlers → Webchat and voice settings: configures
- Tool handlers → Cognigy.AI REST API: REST operations
- Configuration and credentials → Cognigy.AI REST API: supplies authentication
- Request controls → Cognigy.AI REST API: attaches audit context
- Shell bootstrap → Setup installer: launches
- Setup installer → AI plugin hosts: registers with
- Release pipeline → Manifest/version checks: runs
- Release pipeline → Common manifests: publishes package