n8n-io/n8n · error

MCP server search is not available on this instance.

Error message

MCP server search is not available on this instance.

What it means

Capability guard in handleSearch: the InstanceAiContext carries no mcpService, so MCP server discovery/search is not available on this deployment. The tool aborts rather than returning an empty result set that would look like 'no servers found'.

Solutions

  1. Skip MCP server search and ask the user for the server slug/tools directly
  2. Enable the MCP service on the instance if server discovery is required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/tools/mcp-servers.tool.ts:123 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/3f50f74f6d2aafb2. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/instance-ai/src/tools/mcp-servers.tool.ts:123

	slug: string,
): z.infer<typeof detailsOutputSchema> {
	const service = (context.connectedMcpServices ?? []).find((entry) => entry.slug === slug);
	if (!service) return { slug, tools: [], hint: NOT_CONNECTED_HINT };

	return {
		slug,
		tools: service.toolNames,
		hint: service.toolNames.length === 0 ? BROKEN_CONNECTION_HINT : undefined,
	};
}

async function handleSearch(
	context: InstanceAiContext,
	queries: string[],
): Promise<z.infer<typeof searchOutputSchema>> {
	const { mcpService } = context;
	if (!mcpService) {
		throw new Error('MCP server search is not available on this instance.');
	}

	const matches = await mcpService.search(queries);
	const results = matches.slice(0, MAX_RESULTS);

	return {
		results,
		hint: joinHints(
			results.length > 0 && CONNECT_HINT,
			matches.length > results.length && TRUNCATED_HINT,
		),
	};
}

export function createMcpServersTool(context: InstanceAiContext) {
	return new Tool(DOMAIN_TOOL_IDS.MCP_SERVERS)
		.description(DESCRIPTION)
		.input(mcpServersToolInputSchema)

View on GitHub (pinned to 5ac6606e81)