From 9aadfdcdfffb54034f29041f6ac91d48bad1e136 Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Fri, 24 Apr 2026 15:46:32 +0200 Subject: [PATCH] [MCP] Loosen API page restriction beyond APIV2 (#7726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes [AB#631961](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/631961) ## Summary - Replace blanket `APIPublisher='microsoft'` block with two simple rules: block `Microsoft.API.V1` namespace and `APIVersion = 'beta'` pages - Opens up extension APIs (EDocument, Subscription Billing, Quality Management, PowerBI Reports, Intercompany, Cloud Migration, Automation APIs, etc.) for MCP tool configuration - `ValidateAPIPublisher` bypass preserved for internal code paths ## Blocked - **V1 namespace**: APIV1 base (49 pages) + Sustainability (7 pages) - **Beta version**: API Reports Finance (9), ExpenseAgent (39), ALCodeCoverage (5) ## Allowed (new) - BCApps: EDocument, EDocument Connectors, Subscription Billing, Quality Management, PowerBI Reports, Performance Toolkit, AI Test Toolkit - NAV: IRS Forms, VAT Group, Intercompany, Cloud Migration, Agent toolkit, Dataverse, Automate, Runtime, Admin, Automation (APIV2 + BaseApp), PowerBI Labels ## Changes - **MCPConfigImplementation**: `ValidateAPITool`, `LookupAPITools`, `GetAPIPublishers`, `AddToolsByAPIGroup` updated to filter by V1 namespace + beta version - Error label renamed `InvalidAPIVersionErr` → `APIToolNotSupportedErr` ## Follow-up `AboutText` additions on extension API pages will be done separately. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- .../MCPConfigImplementation.Codeunit.al | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/System Application/App/MCP/src/Configuration/Codeunits/MCPConfigImplementation.Codeunit.al b/src/System Application/App/MCP/src/Configuration/Codeunits/MCPConfigImplementation.Codeunit.al index ad6fc4ecfe..31f7936d63 100644 --- a/src/System Application/App/MCP/src/Configuration/Codeunits/MCPConfigImplementation.Codeunit.al +++ b/src/System Application/App/MCP/src/Configuration/Codeunits/MCPConfigImplementation.Codeunit.al @@ -26,7 +26,7 @@ codeunit 8351 "MCP Config Implementation" ToolsCannotBeAddedToDefaultConfigErr: Label 'Tools cannot be added to the default configuration.'; PageNotFoundErr: Label 'Page not found.'; InvalidPageTypeErr: Label 'Only API pages are supported.'; - InvalidAPIVersionErr: Label 'Only API v2.0 pages are supported.'; + APIToolNotSupportedErr: Label 'This API page is not available for MCP configuration.'; DefaultMCPConfigurationDescriptionLbl: Label 'Default MCP configuration'; DynamicToolModeRequiredErr: Label 'Dynamic tool mode needs to be enabled to discover read-only objects.'; VersionNotValidErr: Label 'The API version is not valid for the selected tool.'; @@ -470,8 +470,8 @@ codeunit 8351 "MCP Config Implementation" MCPAPIConfigToolLookup: Page "MCP API Config Tool Lookup"; begin PageMetadata.SetRange(PageType, PageMetadata.PageType::API); - PageMetadata.SetFilter(APIPublisher, '<>%1', 'microsoft'); PageMetadata.SetFilter("AL Namespace", '<>%1', 'Microsoft.API.V1'); + PageMetadata.SetFilter(APIVersion, '<>%1', 'beta'); MCPAPIConfigToolLookup.LookupMode := true; MCPAPIConfigToolLookup.SetTableView(PageMetadata); @@ -488,7 +488,10 @@ codeunit 8351 "MCP Config Implementation" begin PageMetadata.SetLoadFields(PageType, APIPublisher, APIGroup); PageMetadata.SetRange(PageType, PageMetadata.PageType::API); - PageMetadata.SetFilter(APIPublisher, '<>%1&<>%2', '', 'microsoft'); + PageMetadata.SetFilter(APIPublisher, '<>%1', ''); + PageMetadata.SetFilter("AL Namespace", '<>%1', 'Microsoft.API.V1'); + PageMetadata.SetFilter(APIVersion, '<>%1', 'beta'); + if not PageMetadata.FindSet() then exit; @@ -532,11 +535,11 @@ codeunit 8351 "MCP Config Implementation" if not ValidateAPIPublisher then exit(PageMetadata); - if PageMetadata.APIPublisher = 'microsoft' then - Error(InvalidAPIVersionErr); - if PageMetadata."AL Namespace" = 'Microsoft.API.V1' then - Error(InvalidAPIVersionErr); + Error(APIToolNotSupportedErr); + + if PageMetadata.APIVersion = 'beta' then + Error(APIToolNotSupportedErr); exit(PageMetadata); end; @@ -558,12 +561,12 @@ codeunit 8351 "MCP Config Implementation" if (APIGroup = '') or (APIPublisher = '') then exit; - if APIPublisher = 'microsoft' then - exit; - PageMetadata.SetRange(PageType, PageMetadata.PageType::API); PageMetadata.SetFilter(APIPublisher, APIPublisher); PageMetadata.SetFilter(APIGroup, APIGroup); + PageMetadata.SetFilter("AL Namespace", '<>%1', 'Microsoft.API.V1'); + PageMetadata.SetFilter(APIVersion, '<>%1', 'beta'); + if not PageMetadata.FindSet() then exit;