## What's Changed
Related video manual about MCP setup - https://www.youtube.com/watch?v=PfcDh0JekIk
1. 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/mcp` speaks Streamable HTTP through the official `mcp/sdk` PHP 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 new `lhaimcp`/`use` permission) 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 from `tools/list`; the endpoint stays disabled until a token is generated and accepts it either as an `Authorization: Bearer <token>` header or as a `?token=` parameter (a generated token uses `random_bytes` and comparisons use `hash_equals`), and allowed CORS origins plus an optional host allowlist for the SDK DNS rebinding protection can be configured through the `ai_mcp_options` chat 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_settings` and `explain_chat_auto_assign`; `LiveHelperChat\Mcp\Access` resolves 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/without `index.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\Rules` diagnoses 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 new `ai_mcp.object_access_rules` event; `LiveHelperChat\Mcp\AutoAssign` is a read-only port of `erLhcoreClassChatWorkflow::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_session` table 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.json` gained the `mcp/sdk` and `symfony/finder` dependencies, `erLhcoreClassSystem::$QueryString` is now a declared property, `ezcUrl::parsePathElement()` no longer warns when a path element is `null`, and the new table is created by the regular database update.
- Audit log size protection: audit records larger than the MySQL `max_allowed_packet` no 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 through `error_log()` instead of propagating up, unless `debug_output` is enabled so developers still see the error.
- Chat transfer to human: `chat/transfertohuman` now runs inside a database transaction, loads the chat with `fetchAndLock()` 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 with `ONLY_FULL_GROUP_BY` enabled 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-spacing` and `--lhc-message-group-spacing` CSS 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.json` and `db.dbml` for the new `lh_mcp_session` table; bumped version to 4.92v.
2. 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`/`use` permission.
- MCP sessions live in the new `lh_mcp_session` table, 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.
For update just follow standard update procedure. For manual update it's update_358.sql
* Treat relative ur is as same site in chat responses by @niels-heinemann in https://github.com/LiveHelperChat/livehelperchat/pull/2410
* Allow self-signed and unverified SSL certificates in Mailconv SMTP transport by @mysubcult in https://github.com/LiveHelperChat/livehelperchat/pull/2413
**Full Changelog**: https://github.com/LiveHelperChat/livehelperchat/compare/4.91v...4.92v