The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
feat(mcp): add opt-in direct tool mode (?mode=direct) (#26892)
UDIT_SINGH@0795ca4ecbc60b
diff --git a/packages/twenty-docs/user-guide/ai/capabilities/mcp.mdx b/packages/twenty-docs/user-guide/ai/capabilities/mcp.mdxindex 12e61e8bc2a..ef914dcaa72 100644--- a/packages/twenty-docs/user-guide/ai/capabilities/mcp.mdx+++ b/packages/twenty-docs/user-guide/ai/capabilities/mcp.mdx@@ -108,6 +108,8 @@ Record operation names follow a grammar, so an assistant can build them withoutFor anything else, `get_tool_catalog` browses the remaining tools one category at a time. It is a fallback: an unfiltered call returns hundreds of operations and most assistants will truncate the response.+`/mcp?mode=direct` lists every tool directly and needs a client that loads tools on demand.+## PermissionsMCP connections inherit the permissions of the authenticated user (OAuth) or the role assigned to the API key. To restrict what the MCP server can do:diff --git a/packages/twenty-server/src/engine/api/mcp/controllers/__tests__/mcp-core.controller.spec.ts b/packages/twenty-server/src/engine/api/mcp/controllers/__tests__/mcp-core.controller.spec.tsindex 4d257e687c8..f92e9c51944 100644--- a/packages/twenty-server/src/engine/api/mcp/controllers/__tests__/mcp-core.controller.spec.ts+++ b/packages/twenty-server/src/engine/api/mcp/controllers/__tests__/mcp-core.controller.spec.ts@@ -124,6 +124,7 @@ describe('McpCoreController', () => {userWorkspaceId: mockUserWorkspaceId,apiKey: mockApiKey,application: undefined,+ isDirectMode: false,},);expect(result).toEqual(mockResponse);@@ -172,6 +173,7 @@ describe('McpCoreController', () => {userWorkspaceId: mockUserWorkspaceId,apiKey: mockApiKey,application: undefined,+ isDirectMode: false,},);expect(result).toEqual(mockResponse);@@ -219,6 +221,7 @@ describe('McpCoreController', () => {userWorkspaceId: mockUserWorkspaceId,apiKey: mockApiKey,application: undefined,+ isDirectMode: false,},);expect(result).toEqual(mockResponse);@@ -284,6 +287,7 @@ describe('McpCoreController', () => {userId: undefined,userWorkspaceId: undefined,apiKey: mockApiKey,+ isDirectMode: false,},);expect(result).toEqual(mockResponse);@@ -348,6 +352,7 @@ describe('McpCoreController', () => {userWorkspaceId: mockUserWorkspaceId,apiKey: mockApiKey,application: undefined,+ isDirectMode: false,},expect.any(Function),);diff --git a/packages/twenty-server/src/engine/api/mcp/controllers/mcp-core.controller.ts b/packages/twenty-server/src/engine/api/mcp/controllers/mcp-core.controller.tsindex d2e586af4bf..a2fae8be7f4 100644--- a/packages/twenty-server/src/engine/api/mcp/controllers/mcp-core.controller.ts+++ b/packages/twenty-server/src/engine/api/mcp/controllers/mcp-core.controller.ts@@ -5,6 +5,7 @@ import {HttpCode,HttpStatus,Post,+ Query,Res,UseFilters,UseGuards,@@ -66,6 +67,7 @@ export class McpCoreController {application: FlatApplication | undefined,@Headers('accept') acceptHeader: string | undefined,@Res({ passthrough: true }) res: Response,+ @Query('mode') mode?: string,) {const authContext = {workspace,@@ -73,6 +75,7 @@ export class McpCoreController {userWorkspaceId,apiKey,application,+ isDirectMode: mode === 'direct',};// JSON-RPC notifications (no id) expect no response body regardless of Acceptdiff --git a/packages/twenty-server/src/engine/api/mcp/services/mcp-instruction-builder.service.ts b/packages/twenty-server/src/engine/api/mcp/services/mcp-instruction-builder.service.tsindex ca676918da9..059ba020494 100644--- a/packages/twenty-server/src/engine/api/mcp/services/mcp-instruction-builder.service.ts+++ b/packages/twenty-server/src/engine/api/mcp/services/mcp-instruction-builder.service.ts@@ -23,10 +23,12 @@ export class McpInstructionBuilderService {workspaceId,roleId,rolePermissionConfig,+ isDirectMode,}: {workspaceId: string;roleId: string;rolePermissionConfig: RolePermissionConfig;+ isDirectMode: boolean;}): Promise<string> {const [{ flatObjectMetadataMaps }, allSkills, actionToolCatalog] =await Promise.all([@@ -61,6 +63,7 @@ export class McpInstructionBuilderService {objectNames,actionToolNames,skillNames,+ isDirectMode,});}}diff --git a/packages/twenty-server/src/engine/api/mcp/services/mcp-protocol.service.ts b/packages/twenty-server/src/engine/api/mcp/services/mcp-protocol.service.tsindex ad4b531c38d..b66aa69d4a0 100644--- a/packages/twenty-server/src/engine/api/mcp/services/mcp-protocol.service.ts+++ b/packages/twenty-server/src/engine/api/mcp/services/mcp-protocol.service.ts@@ -1,5 +1,6 @@import { HttpException, HttpStatus, Injectable } from '@nestjs/common';+import { isNonEmptyString } from '@sniptt/guards';import { type ToolSet, zodSchema } from 'ai';import { type ActorMetadata, FieldActorSource } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';@@ -32,6 +33,7 @@ import { type FlatApplication } from 'src/engine/core-modules/application/types/import { type WorkspaceAuthContext } from 'src/engine/core-modules/auth/types/workspace-auth-context.type';import { buildApiKeyAuthContext } from 'src/engine/core-modules/auth/utils/build-api-key-auth-context.util';import { COMMON_PRELOAD_TOOLS } from 'src/engine/core-modules/tool-provider/constants/common-preload-tools.const';+import { type ToolProviderContext } from 'src/engine/core-modules/tool-provider/interfaces/tool-provider-context.type';import { ToolRegistryService } from 'src/engine/core-modules/tool-provider/services/tool-registry.service';import {createLearnToolsTool,@@ -107,10 +109,12 @@ export class McpProtocolService {workspaceId,roleId,rolePermissionConfig,+ isDirectMode,}: {workspaceId: string;roleId: string;rolePermissionConfig: RolePermissionConfig;+ isDirectMode: boolean;},) {const instructions =@@ -118,6 +122,7 @@ export class McpProtocolService {workspaceId,roleId,rolePermissionConfig,+ isDirectMode,});return wrapJsonRpcResponse(requestId, {@@ -235,14 +240,14 @@ export class McpProtocolService {apiKey?: FlatApiKey;application?: FlatApplication;},- ): Promise<ToolSet> {+ ): Promise<{ toolSet: ToolSet; toolContext: ToolProviderContext }> {const actorContext = await this.buildActorContext(workspace.id,options?.userId,options?.apiKey,);- const toolContext = {+ const toolContext: ToolProviderContext = {workspaceId: workspace.id,roleId,rolePermissionConfig,@@ -258,7 +263,7 @@ export class McpProtocolService {toolContext,);- return {+ const toolSet: ToolSet = {...annotatePreloadedMcpTools(preloadedTools),[GET_TOOL_CATALOG_TOOL_NAME]: {...createGetToolCatalogTool(this.toolRegistry, workspace.id, roleId, {@@ -314,6 +319,8 @@ export class McpProtocolService {annotations: MCP_CLOSED_WORLD_READ_ONLY_TOOL_ANNOTATIONS,} as McpAnnotatedTool,};++ return { toolSet, toolContext };}// Returns null for JSON-RPC notifications (no id), which require no response body@@ -325,12 +332,14 @@ export class McpProtocolService {userWorkspaceId,apiKey,application,+ isDirectMode,}: {workspace: FlatWorkspace;userId?: string;userWorkspaceId?: string;apiKey: FlatApiKey | undefined;application?: FlatApplication;+ isDirectMode: boolean;},sseWriter?: (data: Record<string, unknown>) => void,): Promise<Record<string, unknown> | null> {@@ -352,6 +361,7 @@ export class McpProtocolService {workspaceId: workspace.id,roleId,rolePermissionConfig,+ isDirectMode,});}@@ -391,7 +401,7 @@ export class McpProtocolService {? buildApiKeyAuthContext({ workspace, apiKey }): undefined;- const toolSet = await this.buildMcpToolSet(+ const { toolSet, toolContext } = await this.buildMcpToolSet(workspace,roleId,rolePermissionConfig,@@ -414,14 +424,56 @@ export class McpProtocolService {});}+ const shouldForwardToExecuteTool =+ isDirectMode &&+ isNonEmptyString(params.name) &&+ !isDefined(toolSet[params.name]);+return await this.mcpToolExecutorService.handleToolCall(id,toolSet,- params,+ shouldForwardToExecuteTool+ ? {+ ...params,+ name: EXECUTE_TOOL_TOOL_NAME,+ arguments: {+ toolName: params.name,+ arguments: params.arguments ?? {},+ },+ }+ : params,sseWriter,);}+ if (isDirectMode) {+ const {+ [GET_TOOL_CATALOG_TOOL_NAME]: _getToolCatalogTool,+ [LEARN_TOOLS_TOOL_NAME]: _learnToolsTool,+ [EXECUTE_TOOL_TOOL_NAME]: _executeToolTool,+ ...nativeTools+ } = toolSet;++ const registryTools = await this.toolRegistry.getToolsByCategories(+ toolContext,+ { excludeTools: [...MCP_EXCLUDED_TOOL_NAMES] },+ );++ const annotatedRegistryTools = Object.fromEntries(+ Object.entries(registryTools).map(+ ([toolName, registryTool]): [string, McpAnnotatedTool] => [+ toolName,+ { ...registryTool, annotations: MCP_EXECUTE_TOOL_ANNOTATIONS },+ ],+ ),+ );++ return this.mcpToolExecutorService.handleToolsListing(id, {+ ...annotatedRegistryTools,+ ...nativeTools,+ });+ }+return this.mcpToolExecutorService.handleToolsListing(id, toolSet);} catch (error) {if (error instanceof HttpException) {diff --git a/packages/twenty-server/src/engine/api/mcp/services/mcp-tool-executor.service.ts b/packages/twenty-server/src/engine/api/mcp/services/mcp-tool-executor.service.tsindex 46c72623434..a53b4fa24c0 100644--- a/packages/twenty-server/src/engine/api/mcp/services/mcp-tool-executor.service.ts+++ b/packages/twenty-server/src/engine/api/mcp/services/mcp-tool-executor.service.ts@@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';import { isNonEmptyString } from '@sniptt/guards';import { type ToolExecuteFunction, type ToolSet } from 'ai';-import { isDefined } from 'twenty-shared/utils';+import { isDefined, isPlainObject } from 'twenty-shared/utils';import { TOOL_EXECUTION_DURATION_MS_BUCKET_BOUNDARIES } from 'src/engine/core-modules/metrics/constants/tool-execution-duration-ms-bucket-boundaries.constant';import { TOOL_OUTPUT_TOKENS_BUCKET_BOUNDARIES } from 'src/engine/core-modules/metrics/constants/tool-output-tokens-bucket-boundaries.constant';@@ -173,7 +173,10 @@ export class McpToolExecutorService {return {name,description: toolDefinition.description,- inputSchema,+ inputSchema: {+ ...(isPlainObject(inputSchema) ? inputSchema : {}),+ type: 'object',+ },...(isDefined(toolDefinition.annotations) && {annotations: toolDefinition.annotations,}),diff --git a/packages/twenty-server/src/engine/api/mcp/utils/__tests__/build-mcp-server-instructions.util.spec.ts b/packages/twenty-server/src/engine/api/mcp/utils/__tests__/build-mcp-server-instructions.util.spec.tsindex d8ecbfc2a28..2f60081c3a9 100644--- a/packages/twenty-server/src/engine/api/mcp/utils/__tests__/build-mcp-server-instructions.util.spec.ts+++ b/packages/twenty-server/src/engine/api/mcp/utils/__tests__/build-mcp-server-instructions.util.spec.ts@@ -16,6 +16,7 @@ describe('buildMcpServerInstructions', () => {const instructions = buildMcpServerInstructions({objectNames: 'companies, people',actionToolNames: ['send_email', 'search_help_center'],+ isDirectMode: false,});expect(getActionLine(instructions)).toContain(@@ -29,6 +30,7 @@ describe('buildMcpServerInstructions', () => {const withUpload = buildMcpServerInstructions({objectNames: 'companies',actionToolNames: ['create_file_upload', 'complete_file_upload'],+ isDirectMode: false,});expect(withUpload).toContain('To attach a file: create_file_upload');@@ -36,6 +38,7 @@ describe('buildMcpServerInstructions', () => {const withoutUpload = buildMcpServerInstructions({objectNames: 'companies',actionToolNames: ['send_email'],+ isDirectMode: false,});expect(withoutUpload).not.toContain('To attach a file');@@ -45,6 +48,7 @@ describe('buildMcpServerInstructions', () => {const withHttp = buildMcpServerInstructions({objectNames: 'companies',actionToolNames: ['http_request'],+ isDirectMode: false,});expect(withHttp).toContain('http_request is ONLY for external');@@ -52,6 +56,7 @@ describe('buildMcpServerInstructions', () => {const withoutHttp = buildMcpServerInstructions({objectNames: 'companies',actionToolNames: ['send_email'],+ isDirectMode: false,});expect(withoutHttp).not.toContain('http_request is ONLY for external');@@ -61,6 +66,7 @@ describe('buildMcpServerInstructions', () => {const instructions = buildMcpServerInstructions({objectNames: 'companies',actionToolNames: ['send_email'],+ isDirectMode: false,});for (const toolName of [@@ -79,6 +85,7 @@ describe('buildMcpServerInstructions', () => {const instructions = buildMcpServerInstructions({objectNames: 'companies',actionToolNames: ['send_email'],+ isDirectMode: false,});expect(instructions).toContain(@@ -96,8 +103,29 @@ describe('buildMcpServerInstructions', () => {const instructions = buildMcpServerInstructions({objectNames: 'companies',actionToolNames: ['send_email'],+ isDirectMode: false,});expect(instructions).not.toContain('Available skills');});++ it('should point direct mode at the listed tools instead of the meta-tools', () => {+ const directInstructions = buildMcpServerInstructions({+ objectNames: 'companies',+ actionToolNames: ['send_email'],+ isDirectMode: true,+ });++ for (const toolName of [+ EXECUTE_TOOL_TOOL_NAME,+ LEARN_TOOLS_TOOL_NAME,+ GET_TOOL_CATALOG_TOOL_NAME,+ ]) {+ expect(directInstructions).not.toContain(toolName);+ }++ expect(directInstructions).toContain(+ 'Tools for objects or app functions created during this session only appear after reconnecting',+ );+ });});diff --git a/packages/twenty-server/src/engine/api/mcp/utils/build-mcp-server-instructions.util.ts b/packages/twenty-server/src/engine/api/mcp/utils/build-mcp-server-instructions.util.tsindex 801ea47765e..d29d398cd15 100644--- a/packages/twenty-server/src/engine/api/mcp/utils/build-mcp-server-instructions.util.ts+++ b/packages/twenty-server/src/engine/api/mcp/utils/build-mcp-server-instructions.util.ts@@ -4,10 +4,12 @@ export const buildMcpServerInstructions = ({objectNames,actionToolNames,skillNames,+ isDirectMode,}: {objectNames: string;actionToolNames: string[];skillNames?: string;+ isDirectMode: boolean;}): string => {const availableActionTools = new Set(actionToolNames);@@ -21,21 +23,38 @@ export const buildMcpServerInstructions = ({` person.companyId → company`,` note / task / activity are attachable to any object via targetRecordId`,``,- `Meta-tools (always available):`,- ` execute_tool(toolName, arguments) — execute any CRUD or action tool by name`,- ` learn_tools(toolNames) — fetch input schemas before calling tools; pass ALL needed tool names in one call, not one call per tool`,- ` load_skills(skillNames) — load step-by-step instructions for complex tasks`,- ` list_object_metadata_names() — list this workspace's object names`,- ` list_skills() — list the available skill names`,- ` get_tool_catalog(categories) — fallback discovery, only when you do not know which tool exists. Pass ONE category, never call it unfiltered`,+ ...(isDirectMode+ ? [+ `Tools:`,+ ` Every tool you can use is listed directly with its input schema. Call it by name.`,+ ` Tools for objects or app functions created during this session only appear after reconnecting (the tool list does not change mid-session).`,+ ` load_skills(skillNames) — load step-by-step instructions for complex tasks`,+ ` list_object_metadata_names() — list this workspace's object names`,+ ` list_skills() — list the available skill names`,+ ]+ : [+ `Meta-tools (always available):`,+ ` execute_tool(toolName, arguments) — execute any CRUD or action tool by name`,+ ` learn_tools(toolNames) — fetch input schemas before calling tools; pass ALL needed tool names in one call, not one call per tool`,+ ` load_skills(skillNames) — load step-by-step instructions for complex tasks`,+ ` list_object_metadata_names() — list this workspace's object names`,+ ` list_skills() — list the available skill names`,+ ` get_tool_catalog(categories) — fallback discovery, only when you do not know which tool exists. Pass ONE category, never call it unfiltered`,+ ]),``,...(skillNames ? [`Available skills: ${skillNames}.`, ``] : []),`CRUD tool name grammar — construct names directly without prior discovery:`,` Read: find_many_{objects} | find_one_{object} | group_by_{objects}`,` Write: create_one_{object} | create_many_{objects} | update_one_{object} | update_many_{objects} | delete_one_{object} | delete_many_{objects} | upsert_many_{objects}. Use upsert_many_{objects} instead of update_many_{objects} when each record has its own individual data.`,- ` Not sure a constructed name exists? Pass it to learn_tools — unknown names come back under notFound with the closest matching names. Never call get_tool_catalog just to check a name.`,+ ...(isDirectMode+ ? []+ : [+ ` Not sure a constructed name exists? Pass it to learn_tools — unknown names come back under notFound with the closest matching names. Never call get_tool_catalog just to check a name.`,+ ]),``,- `Non-CRUD tools — use learn_tools for schemas:`,+ isDirectMode+ ? `Non-CRUD tools:`+ : `Non-CRUD tools — use learn_tools for schemas:`,` ACTION: ${actionToolNames.join(' | ')}`,` WORKFLOW: list_workflows | create_complete_workflow | create/update/delete_workflow_version_step | activate/deactivate_workflow_version | list_workflow_runs | get_workflow_run | get_workflow_current_version`,` METADATA: get/create/update/delete_object_metadata | get/create/update/delete_field_metadata`,@@ -43,12 +62,20 @@ export const buildMcpServerInstructions = ({` VIEW: get_views | get_view_query_parameters | create/update/delete_view | manage view fields, filters, sorts`,` WEBHOOK: list/create/update/delete_webhook`,` NAVIGATION: list/create/update/delete_navigation_menu_item`,- ` LOGIC_FUNCTION: app_{function_name} — workspace-specific; use list_logic_function_tools to discover`,- ` Don't know which tool exists at all? get_tool_catalog with ONE category from the list above, then learn_tools, then execute_tool.`,+ ...(isDirectMode+ ? [+ ` LOGIC_FUNCTION: app_{function_name} — workspace-specific; listed with the other tools`,+ ]+ : [+ ` LOGIC_FUNCTION: app_{function_name} — workspace-specific; use list_logic_function_tools to discover`,+ ` Don't know which tool exists at all? get_tool_catalog with ONE category from the list above, then learn_tools, then execute_tool.`,+ ]),``,`Skills vs Tools:`,` Skills = documentation (load_skills) — teach HOW to do something, correct schemas and patterns`,- ` Tools = execution (execute_tool) — let you DO something`,+ isDirectMode+ ? ` Tools = execution (call directly) — let you DO something`+ : ` Tools = execution (execute_tool) — let you DO something`,` For complex tasks (workflows, metadata), load the matching skill BEFORE calling tools.`,` ⚠️ Never call workflow or metadata tools without loading their skill first.`,``,@@ -66,7 +93,9 @@ export const buildMcpServerInstructions = ({` Multiple metrics → run parallel group_by calls, merge results`,` Per-record updates (different data per record) → find_many_{objects} first, then upsert_many_{objects} with each record's id (or other unique identifier) and new values`,` Bulk update (same data for all) → update_many_{objects}`,- ` Non-CRUD task → use tool name from the list above + learn_tools for schema`,+ isDirectMode+ ? ` Non-CRUD task → call the matching tool directly`+ : ` Non-CRUD task → use tool name from the list above + learn_tools for schema`,``,`Execution rules:`,` Independent tool calls → run in parallel`,diff --git a/packages/twenty-server/test/integration/ai/suites/mcp-tool-catalog.integration-spec.ts b/packages/twenty-server/test/integration/ai/suites/mcp-tool-catalog.integration-spec.tsindex 1c616e2cf58..285d9c93446 100644--- a/packages/twenty-server/test/integration/ai/suites/mcp-tool-catalog.integration-spec.ts+++ b/packages/twenty-server/test/integration/ai/suites/mcp-tool-catalog.integration-spec.ts@@ -24,9 +24,9 @@ import { ToolCategory } from 'twenty-shared/ai';const baseUrl = `http://localhost:${APP_PORT}`;-const postMcp = (body: object, bearer: string) =>+const postMcp = (body: object, bearer: string, path = '/mcp') =>request(baseUrl)- .post('/mcp')+ .post(path).set('Authorization', `Bearer ${bearer}`).set('Content-Type', 'application/json').set('Accept', 'application/json')@@ -36,6 +36,7 @@ const callMcpTool = async (bearer: string,toolName: string,toolArguments: object,+ path = '/mcp',) => {const response = await postMcp({@@ -45,6 +46,7 @@ const callMcpTool = async (id: '1',},bearer,+ path,).expect(200);return response.body.result as {@@ -96,6 +98,31 @@ const isDispatchFailure = (result: {// here must be a conscious decision, not silent drift.const EXPECTED_CATEGORIES_WITHOUT_READ_ONLY_TOOLS: string[] = [];+const listMcpTools = async (+ bearer: string,+ path: string,+): Promise<{ name: string; inputSchema: { type?: string } }[]> => {+ const response = await postMcp(+ { jsonrpc: '2.0', method: 'tools/list', id: '1' },+ bearer,+ path,+ ).expect(200);++ return response.body.result.tools;+};++const META_MODE_TOOL_NAMES = [+ 'execute_tool',+ 'get_tool_catalog',+ 'learn_tools',+ 'list_object_metadata_names',+ 'list_skills',+ 'load_skills',+ 'search_help_center',+];++const DIRECT_MODE_PATH = '/mcp?mode=direct';+const createApiKeyToken = async (roleId: string): Promise<string> => {const createResponse = await makeMetadataApiRequest({query: gql`@@ -288,4 +315,87 @@ describe('MCP tool catalog (integration)', () => {expect(catalog[ToolCategory.DATABASE_CRUD]?.length).toBeGreaterThan(0);});});++ describe('direct mode', () => {+ it('should list registry tools directly, without the meta-tools or MCP-excluded tools', async () => {+ const toolNames = (+ await listMcpTools(adminApiKeyToken, DIRECT_MODE_PATH)+ ).map((tool) => tool.name);++ expect(toolNames).toEqual(+ expect.arrayContaining([+ 'find_many_companies',+ 'search_help_center',+ 'load_skills',+ ]),+ );++ for (const hiddenToolName of [+ 'get_tool_catalog',+ 'learn_tools',+ 'execute_tool',+ 'http_request',+ ]) {+ expect(toolNames).not.toContain(hiddenToolName);+ }+ });++ it('should declare an object root on every input schema', async () => {+ const tools = await listMcpTools(adminApiKeyToken, DIRECT_MODE_PATH);++ const toolsWithoutObjectRoot = tools+ .filter((tool) => tool.inputSchema.type !== 'object')+ .map((tool) => tool.name);++ expect(toolsWithoutObjectRoot).toEqual([]);+ });++ it('should call a listed tool by name', async () => {+ const result = await callMcpTool(+ adminApiKeyToken,+ 'find_many_companies',+ { limit: 1, select: ['id'] },+ DIRECT_MODE_PATH,+ );++ expect(result.isError).toBe(false);+ });++ it('should refuse MCP-excluded tools called by name', async () => {+ const result = await callMcpTool(+ adminApiKeyToken,+ 'http_request',+ {},+ DIRECT_MODE_PATH,+ );++ expect(result.isError).toBe(true);+ expect(isDispatchFailure(result)).toBe(true);+ });++ it('should keep plain /mcp on the meta-tools', async () => {+ const toolNames = (await listMcpTools(adminApiKeyToken, '/mcp')).map(+ (tool) => tool.name,+ );++ expect([...toolNames].sort()).toEqual(META_MODE_TOOL_NAMES);++ const response = await postMcp(+ {+ jsonrpc: '2.0',+ method: 'tools/call',+ params: {+ name: 'find_many_companies',+ arguments: { limit: 1, select: ['id'] },+ },+ id: '1',+ },+ adminApiKeyToken,+ ).expect(200);++ expect(response.body.error?.message).toBe(+ 'Unknown tool: find_many_companies',+ );+ });+ });});