[xwiki-contrib/ai-llm] 337190: LLMAI-136: Harden the MCP server infrastructure
Branch: refs/heads/main Home: https://github.com/xwiki-contrib/ai-llm Commit: 337190219ad2d8fff9bb36ed86a825a09eb1b9b7 https://github.com/xwiki-contrib/ai-llm/commit/337190219ad2d8fff9bb36ed86a82... Author: Paul Pantiru <[email protected]> Date: 2026-06-11 (Thu, 11 Jun 2026) Changed paths: M application-ai-llm-mcp/application-ai-llm-mcp-server/pom.xml A application-ai-llm-mcp/application-ai-llm-mcp-server/src/checkstyle/checkstyle-suppressions.xml M application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/DefaultMCPResource.java A application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/MCPToolSupport.java M application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/XWikiMCPServerManager.java A application-ai-llm-mcp/application-ai-llm-mcp-server/src/test/java/org/xwiki/contrib/llm/mcp/internal/MCPToolSupportTest.java M application-ai-llm-mcp/application-ai-llm-mcp-server/src/test/java/org/xwiki/contrib/llm/mcp/internal/XWikiMCPServerManagerTest.java Log Message: ----------- LLMAI-136: Harden the MCP server infrastructure * Run tool handlers inline on the request thread (immediateExecution) and remove the Reactor scheduler context-propagation hook this replaces * Add a per-call middleware seam in the server manager: an INFO audit line (tool, acting user, outcome, duration - never arguments) and normalization of escaping exceptions and null results into regular MCP error results * Fault-isolate tool registration: a tool that throws or whose name clashes is skipped with a warning instead of failing the whole server build * Append a man-tool usage hint to the initialization instructions whenever the man tool is registered * Add MCPToolSupport: shared argument coercion with strict semantics, result builders, and a declarative parameter descriptor that generates both the advertised input schema and the typed accessors from one declaration * Support per-file checkstyle suppressions; exempt the composition-root server manager from ClassFanOutComplexity Commit: 7eba9f6913df2909db26f2a4578e12172c3e8a53 https://github.com/xwiki-contrib/ai-llm/commit/7eba9f6913df2909db26f2a4578e1... Author: Paul Pantiru <[email protected]> Date: 2026-06-11 (Thu, 11 Jun 2026) Changed paths: M application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/MCPManTool.java M application-ai-llm-mcp/application-ai-llm-mcp-server/src/test/java/org/xwiki/contrib/llm/mcp/internal/MCPManToolTest.java Log Message: ----------- LLMAI-146: Improve the man tool * Add built-in reference pages served by `man <id>` and listed in the catalog; first page: `man xwiki-syntax`, a grounded XWiki Syntax 2.1 quick reference for agents writing page source * Render SYNOPSIS and OPTIONS in the schema's parameter declaration order (importance order) instead of alphabetically * Declare the tool parameter through the shared parameter descriptor Commit: 142363828a7b71345fef600f14b941dbbcdc6dff https://github.com/xwiki-contrib/ai-llm/commit/142363828a7b71345fef600f14b94... Author: Paul Pantiru <[email protected]> Date: 2026-06-11 (Thu, 11 Jun 2026) Changed paths: M application-ai-llm-mcp/application-ai-llm-mcp-server/pom.xml M application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/MCPQueryDocumentsTool.java M application-ai-llm-mcp/application-ai-llm-mcp-server/src/test/java/org/xwiki/contrib/llm/mcp/internal/MCPQueryDocumentsToolTest.java Log Message: ----------- LLMAI-138: Improve query_documents results, filters and paging * Add a Modified line to every result: last modification instant (ISO 8601) and the author as a serialized reference reusable in the author filter * Show the relevance score only when results are actually ordered by it * Add a count/paging footer with an explicit continuation offset; paging steps by limit since the rights post-filter can shrink a page * Add offset paging and an opt-in includeHidden filter * Distinguish an empty in-range page (rights filtering) from paging past the last result * Tighten the always-shipped description and point to `man query_documents` from it and from the query-syntax error message * Declare parameters through the shared descriptor; stale pom comments renamed to the tool's current name Commit: 0f2c7f647c6a6ff92eaadde3ecfc0fbf968dd05d https://github.com/xwiki-contrib/ai-llm/commit/0f2c7f647c6a6ff92eaadde3ecfc0... Author: Paul Pantiru <[email protected]> Date: 2026-06-11 (Thu, 11 Jun 2026) Changed paths: A application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/MCPGetDocumentTool.java A application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/MCPSourceText.java M application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/resources/META-INF/components.txt A application-ai-llm-mcp/application-ai-llm-mcp-server/src/test/java/org/xwiki/contrib/llm/mcp/internal/MCPGetDocumentToolTest.java Log Message: ----------- LLMAI-139: Add the get_document read tool * Returns the document's raw, byte-exact source, LF-normalized and numbered cat -n style (MCPSourceText, shared with the edit tool so edit strings formed from read output match the edit-time source) * Full content up to a ~6000-token output budget; beyond it a heading outline (with source line numbers as section handles) and offset/limit slice reads with continuation hints * rendered=true returns the page executed to plain text (macros run, includes expanded) for understanding script-driven pages; read-only * VIEW is checked before any load so protected documents never leak their existence; rendering runs with the content author's rights (sdoc), so the caller only ever needs VIEW Commit: efbd9612e9ee4f072664289ecab4a29c1b9be7c2 https://github.com/xwiki-contrib/ai-llm/commit/efbd9612e9ee4f072664289ecab4a... Author: Paul Pantiru <[email protected]> Date: 2026-06-11 (Thu, 11 Jun 2026) Changed paths: M application-ai-llm-mcp/application-ai-llm-mcp-server/pom.xml A application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/MCPEditDocumentTool.java M application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/resources/META-INF/components.txt A application-ai-llm-mcp/application-ai-llm-mcp-server/src/test/java/org/xwiki/contrib/llm/mcp/internal/MCPEditDocumentToolTest.java Log Message: ----------- LLMAI-140: Add the edit_document tool * Exact-string search-and-replace on the raw source (the text returned by get_document): an ordered array of edits applied to an in-memory copy and saved exactly once, as a single version with an [AI]-marked comment * old_string must match exactly and be unique unless replace_all (which reports its replacement count); a non-matching edit fails with a re-read hint, so exact matching doubles as optimistic concurrency * Optional base_version parameter adds a best-effort version check on top * Also implements LLMAI-141: an empty old_string on a missing document creates it, so creation and editing are one tool with one workflow * EDIT is checked before load (no existence leak); the save goes through api.Document for author attribution and save-time rights; creation is a major save, subsequent edits are minor * Returns the new version, a compare-versions URL and numbered context windows around each change; input caps bound abuse Compare: https://github.com/xwiki-contrib/ai-llm/compare/1d2509bb1d54...efbd9612e9ee To unsubscribe from these emails, change your notification settings at https://github.com/xwiki-contrib/ai-llm/settings/notifications
participants (1)
-
XWiki Notifications