There is 1 comment.
 
 
LLM AI Integration / cid:jira-generated-image-avatar-fc3fbde4-d141-4cdd-80cd-1d23a0143006 LLMAI-207 Open

Space access whitelist limits amount of shown folders

 
View issue   ·   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-8a70f4e0-af14-4f0c-9fd5-8da0813da224 Jörg M on 14/Oct/26 11:43
 

The following comment is AI generated, but the workaround worked for me and might help others!

Analysis (source review, not yet verified on a running instance)

Where the problem is: The issue is in the space picker UI of the MCP configuration page. The MCP server's filter logic (DefaultMCPSpaceFilter) is not involved and has no size limit on the configured lists.

The picker in AI.MCP.Code.MCPServerConfigSheet is rendered with the platform documentTree macro:

{{documentTree id="mcp-space-picker-tree" links="false" checkboxes="true" finder="true" showRoot="false" showWikis="$mcpReachOn" showSpaces="true" showAttachments="false" showTranslations="false" /}}

No limit is set, so the tree falls back to the platform default of limit: 15 (documentTree_macros.vm). Children are then loaded page by page through "x more" (SpaceTreeNode#getChildrenQuery uses setOffset/setLimit).

Suspected cause (unconfirmed): The paginated loading probably interacts badly with the jsTree checkbox handling in AI.MCP.Code.MCPSpacePickerJSX. Two code paths look relevant:

  • The changed.jstree handler re-selects chippedNodes on deselect_all (triggered by the finder).
  • preselectStoredReferences calls openTo() on the stored references.
    Both can cause re-loads and re-selection, which would explain why a different number of entries shows up each time and why the page "jumps" when a finder result is selected. showOnlyViewable=true (the default) may also affect what each page returns.

Proposed fix:

  1. Short term: set an explicit, higher limit on the documentTree macro in MCPServerConfigSheet, e.g. limit="1000". The trade-off is a slower tree on wikis with very many spaces.
  2. Proper fix: make the picker's selection and chip reconciliation robust against lazy loading and pagination. Do not reconcile on partial or re-loaded selections, and do not rely on the finder's deselect_all workaround.

Workaround for affected users: The filter is stored as an object of AI.MCP.Code.MCPServerConfigClass on AI.MCP.Code.MCPServerConfig, in the spaceFilterSpaces / spaceFilterDocuments StaticList properties (relational storage). These can be edited directly in the object editor (/bin/edit/AI/MCP/Code/MCPServerConfig?editor=object):

  • Separate entries with |.
  • Write entries for the current wiki without a prefix, and entries for other wikis as wiki:Space.
    The sheet renders stored values as chips with hidden inputs, so they are kept when the form is saved later. Editing the database directly is not recommended: it bypasses the document cache and MCPConfigChangeEventListener.

Reviewed against application-ai-llm master @ e3c0e01 and xwiki-platform stable-17.10.x.