Skip to content

MelisAI

The AI module surfaced in the Melis backoffice — agents, instances, models, tools and an MCP inspector. Package melisplatform/melis-ai.

Purpose

MelisAI is the backoffice UI and management layer for Melis Platform's AI features. It does not run the models itself: it provides the tools to configure AI models and platform keys, set up instances (where agents are used across the platform), build agents with their scenarios (steps) and AI tools, track token/query usage, and inspect MCP servers. The actual AI execution is delegated to melis-ai-engine. See the AI guide and the MCP guide.

Enable it

MelisAI is a standard Laminas module. Add it to config/melis.module.load.php (the skeleton already lists it):

php
'MelisAIEngine',
'MelisAIEngineClaude',
'MelisAIEngineGemini',
'MelisAI',

It requires melisplatform/melis-ai-engine (^5.3) and PHP ^8.1|^8.3; the engine owns the database tables and table gateways that this module consumes. Provider modules (Claude / Gemini) supply the models. To use the MCP-based agents (Tool Creator, Minitemplate Creator…), set melis_platform, melis_project_root, melis_php_binary, melis_http_host and melis_request_scheme in config/autoload/platforms.[env].php (see the module README).

Key services

Registered as service_manager aliases in config/module.config.php. They extend MelisGeneralService and read/write through the engine's table gateways (e.g. MelisAIEngineAgentTable, MelisAIEngineInstanceTable).

Service aliasRole
MelisAIAgentServiceCRUD on AI agents — getItemById(), getList(), saveItem(), deleteItem().
MelisAIInstanceServiceLists instances and checks uniqueness — getList(), isInstanceExisting().
MelisAIModelServiceSaves AI model definitions — saveItem().
MelisAIPlatformKeysServiceStores platform/provider API keys — saveItem($data, $keys).
MelisAIScenarioStepServiceAgent scenario steps — saveItem(), deleteItem(), getScenario(), isCodeExisting().
MelisAIScenarioStepDataServicePer-step data (entry/exit params) — saveItem(), deleteItem().
MelisAIScenarioStepFileServiceStep file attachments — saveItem(), getFileByToken().
MelisAIToolServiceAI tools available to agents — getList(), isAiToolExisting().
MelisAIUsageServiceUsage stats — getTotalTokens(), getTotalQueries() (by model, duration, per-instance).
php
// From any controller / service
$agentSrv = $this->getServiceManager()->get('MelisAIAgentService');
$agent    = $agentSrv->getItemById($agentId);

Backoffice

MelisAI is a backoffice tool tree (the Melis AI left-menu section, melisai_toolstree_section). Its tools and tabs are declared in config/app.toolstree.php under the melisai interface; their content comes from config/app.tools.php and config/app.agent.tools.php.

Tool (melisKey)Controller / action
Admin (melisadmin_tool)MelisAI\Controller\Adminrender-tool
↳ Usage (melisai_usage)Adminrender-tool-usage
↳ Platform AI (melisai_platform_ai) — configure models & default modelAdminrender-platform-ai
↳ Instances (melisai_instances)Adminrender-instances
↳ Chat Dev Tool (melisai_chat_dev_tool) — inspect AI request payloadsAdminrender-chat-dev-tool
AI Agents (melisagent_tool)MelisAI\Controller\Agentrender-tool
↳ Agent properties (Scenario / Config / AI Tools tabs)MelisAI\Controller\AgentProperties
MCP Inspector (melis_mcp_inspector_tool)MelisAI\Controller\McpInspectorrender-tool
Instance modalMelisAI\Controller\Instance
AI tool modalMelisAI\Controller\Tool

The left menu itself is rendered by MelisAI\Controller\AIMenu (left-menu) and the tree by MelisAI\Controller\AITreeTools (render-tree-tools). Backoffice listeners (SavePropertiesListener, SaveAgentPropertiesListener, DeleteListener, MelisAIFlashMessengerListener) are attached in src/Module.php to persist forms and flash messages. Form factories under src/Form/Factory/ build the model/agent/tool dropdowns.

A header chat assistant is injected into the backoffice header via the meliscore interface (meliscore_header_ai_main_chat_assistant), served by MelisAI\Controller\GeneralChat (headerMainChatAssistant).

Front office

MelisAI is a backoffice module and ships no front-office templating plugins. It does expose two backoffice view helpers (config/module.config.php):

HelperRole
melisAIIconRenders MelisAI icons (src/View/Helper/MelisAIIconHelper.php).
CustomFormViewHelperRenders the dynamic AI custom form (src/View/Helper/MelisAICustomFormViewHelper.php).

A public route melis-backoffice/melisaifile (MelisAI\Controller\Fileview) serves AI step files by token; it is in excluded_routes so no login is required for that view.

Database tables

MelisAI has no SQL of its own — the schema is installed and versioned by melis-ai-engine (vendor/melisplatform/melis-ai-engine/install/dbdeploy/). The tables it reads/writes through the engine's gateways are:

TableHolds
melis_ai_agentsAI agents.
melis_ai_instances, melis_ai_instance_transInstances and their translations.
melis_ai_modelsAI model definitions.
melis_ai_platform_keysProvider/platform API keys.
melis_ai_scenario_stepsAgent scenario steps.
melis_ai_scenario_steps_datas, melis_ai_scenario_steps_datas_entryexitStep data and entry/exit params.
melis_ai_filesStep file attachments.
melis_ai_daily_usageToken/query usage counters.
melis_ai_conversation_stateConversation state.

MCP servers

The module bundles two standalone MCP servers used by MCP-enabled agents and surfaced through the MCP Inspector tool:

PathPackageRole
mcp/dbmcp/melisplatform/dbmanager-mcpDatabase manager MCP server.
mcp/filemcp/melisplatform/filemanager-mcpFile manager MCP server.

composer.json advertises supports-mcp and allow-mcp-discovery. See MCP.

Key files

ConcernPath
Module + listener wiringvendor/melisplatform/melis-ai/src/Module.php
Service aliases, controllers, view helpers, routesvendor/melisplatform/melis-ai/config/module.config.php
Tool tree (menu, tabs, modals)vendor/melisplatform/melis-ai/config/app.toolstree.php
Admin / instance / tool tables & formsvendor/melisplatform/melis-ai/config/app.tools.php
Agent tool tablesvendor/melisplatform/melis-ai/config/app.agent.tools.php
Backoffice assets, header chat pluginvendor/melisplatform/melis-ai/config/app.interface.php
Servicesvendor/melisplatform/melis-ai/src/Service/
Controllersvendor/melisplatform/melis-ai/src/Controller/
Listenersvendor/melisplatform/melis-ai/src/Listener/
Bundled MCP serversvendor/melisplatform/melis-ai/mcp/dbmcp/, vendor/melisplatform/melis-ai/mcp/filemcp/

Related

The AI engine and providers are documented in the Module reference; workflows are in the AI guide and MCP guide.