MCP Support
What's Changed
Related video manual about MCP setup - https://www.youtube.com/watch?v=PfcDh0JekIk
-
Notable changes since 4.91v
- AI MCP server: added a Model Context Protocol endpoint so external AI clients (ChatGPT custom connectors, Claude, and other MCP hosts) can inspect a Live Helper Chat installation; the endpoint
aimcp/mcpspeaks Streamable HTTP through the officialmcp/sdkPHP SDK and is a thin bridge that only authenticates the caller and forwards the request, while the protocol itself (handshake, protocol revisions, sessions,tools/list,tools/call, JSON-RPC framing, CORS) is handled by the SDK; a new "MCP Setup" screen (aimcp/key, linked from the Rest API page and protected by the newlhaimcp/usepermission) stores the server name and the access token, shows the endpoint URL and the list of exposed tools read directly from the tool attributes so the page cannot drift fromtools/list; the endpoint stays disabled until a token is generated and accepts it either as anAuthorization: Bearer <token>header or as a?token=parameter (a generated token usesrandom_bytesand comparisons usehash_equals), and allowed CORS origins plus an optional host allowlist for the SDK DNS rebinding protection can be configured through theai_mcp_optionschat configuration. - MCP tools and helpers: eight read-only tools are exposed -
get_user_id_by_email,get_user_id_by_username,get_user_permissions,get_url_permissions,check_user_object_access,explain_chat_access,get_department_auto_assign_settingsandexplain_chat_auto_assign;LiveHelperChat\Mcp\Accessresolves a back office URL into module/view and the permissions it requires with the same logic as the permission explorer (absolute URL, plain path, with/withoutindex.php, with/without siteaccess) and evaluates permissions grouped so that checks in the same group are OR-ed and different groups are AND-ed;LiveHelperChat\Mcp\Rulesdiagnoses object level access for departments, users, chats and canned message replace variables, reporting only identifiers, booleans and generic placeholders (no names, e-mail addresses, chat nicks or message bodies) and can be extended by extensions with the newai_mcp.object_access_rulesevent;LiveHelperChat\Mcp\AutoAssignis a read-only port oferLhcoreClassChatWorkflow::autoAssign()which replays the candidate and gate checks without any write or lock, so it can be run safely against a live installation to answer "would chat X be auto assigned?" or "why was operator Y not auto assigned to chat X?". - MCP sessions and dependencies: handshake sessions are stored in the new
lh_mcp_sessiontable instead of per-request or per-node state, so the endpoint also works on load balanced installations; sessions expire one hour after the last write (the SDK default), a failing query is reported as a missing session instead of turning the endpoint into a PHP error page, and expired sessions are purged by the regular chat cleanup cron so the table stays small;composer.jsongained themcp/sdkandsymfony/finderdependencies,erLhcoreClassSystem::$QueryStringis now a declared property,ezcUrl::parsePathElement()no longer warns when a path element isnull, and the new table is created by the regular database update. - Audit log size protection: audit records larger than the MySQL
max_allowed_packetno longer break the operation being logged - oversized audit messages are truncated to a safe size (16 MB minus a 1 MB reserve for the rest of the query) with UTF-8 safe truncation and a marker showing the original size, and a failing log write is reported througherror_log()instead of propagating up, unlessdebug_outputis enabled so developers still see the error. - Chat transfer to human:
chat/transfertohumannow runs inside a database transaction, loads the chat withfetchAndLock()and locks the department before changing the state, re-validates the chat hash and status after the lock was acquired, and returns a JSON error instead of failing when the chat does not exist or was closed/transferred in the meantime; a missing chat is also handled safely when grouping canned message items, and incomplete canned message replace conditions (missing field, comparator or value) are skipped instead of raising warnings. - Assignment and SQL mode fixes: editing a department operator assignment returns "Assignment record was not found" instead of failing when the assignment record is missing; aggregate queries in the department operator lists (operators, operators group) and in collected survey results set
sql_mode=''so installations withONLY_FULL_GROUP_BYenabled can still list operators and survey results; the operator assignment priority field gained an explanation that it is only taken into account when the department enables assignment by operator priority, otherwise auto-assignment sorts by lowest workload / least recently accepted first. - Bot: the "Update message" bot command can now update the
del_st(deleted status) field of a message, and the bot workflow translation/replace helper guards against a non-object chat. - Widget and operator profile: relative URIs in chat responses are treated as same site links, so they open inside the embedded chat instead of a new browser window; send button and in-progress icons received small padding and alignment fixes; new
--lhc-message-spacingand--lhc-message-group-spacingCSS variables let a theme control the spacing between message bubbles and between message groups without overriding the whole stylesheet; the "job title in new row" theme option is now implemented with CSS classes (op-job-title-sep,operator-profile-content,op-photo) instead of duplicated template markup; the widget React app version was bumped. - Miscellaneous: updated install scripts,
structure.jsonanddb.dbmlfor the newlh_mcp_sessiontable; bumped version to 4.92v.
- AI MCP server: added a Model Context Protocol endpoint so external AI clients (ChatGPT custom connectors, Claude, and other MCP hosts) can inspect a Live Helper Chat installation; the endpoint
-
Summary
- This release focuses on AI tooling for administrators, plus reliability and compatibility fixes.
- A Model Context Protocol endpoint lets AI clients read permission, access and auto-assignment information from an installation through eight read-only tools, protected by an access token and a dedicated
lhaimcp/usepermission. - MCP sessions live in the new
lh_mcp_sessiontable, making the endpoint safe for load balanced setups, with automatic expiry and cleanup. - Oversized audit records are truncated instead of breaking the logged operation, and a failing log write no longer interrupts the request flow.
- Chat transfer to human, department assignments and SQL mode sensitive queries are hardened, and incomplete canned message replace conditions are handled safely.
- Widget links, message spacing and operator profile job titles were polished.
execute doc/update_db/update_358.sql for update
- Treat relative ur is as same site in chat responses by @niels-heinemann in #2410
- Allow self-signed and unverified SSL certificates in Mailconv SMTP transport by @mysubcult in #2413
Full Changelog: 4.91v...4.92v