alibaba/spring-ai-alibaba · error · IllegalArgumentException

The current mode does not support Studio's MCP node code gen

Error message

The current mode does not support Studio's MCP node code generation. Please start the complete StudioApplication class

What it means

MCPNodeSection.render requires an injected McpServerService to look up MCP server definitions. In stripped-down runtime modes the service is null, so render throws IllegalArgumentException telling the developer to run the full StudioApplication.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/generator/workflow/sections/MCPNodeSection.java:54

@Component
public class MCPNodeSection implements NodeSection<MCPNodeData> {

	private final McpServerService mcpServerService;

	public MCPNodeSection(@Autowired(required = false) McpServerService mcpServerService) {
		this.mcpServerService = mcpServerService;
	}

	@Override
	public boolean support(NodeType nodeType) {
		return NodeType.MCP.equals(nodeType);
	}

	@Override
	public String render(Node node, String varName) {
		if (this.mcpServerService == null) {
			throw new IllegalArgumentException(
					"The current mode does not support Studio's MCP node code generation. Please start the complete StudioApplication class");
		}
		MCPNodeData nodeData = (MCPNodeData) node.getData();

		RequestContext context = RequestContextHolder.getRequestContext();
		McpServerEntity mcpServerEntity = mcpServerService.getMcpByCode(context.getWorkspaceId(),
				nodeData.getServerCode(), null);
		if (mcpServerEntity == null) {
			throw new IllegalArgumentException("MCP Server [" + nodeData.getServerCode() + "] not found!");
		}

		McpServerDeployConfig deployConfig = JsonUtils.fromJson(mcpServerEntity.getDeployConfig(),
				McpServerDeployConfig.class);
		String endPoint = deployConfig.getRemoteEndpoint();
		String baseUri = deployConfig.getRemoteAddress();

		return String.format("""
				// -- MCP Node [%s] --

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Start the application via the complete StudioApplication class so MCP beans are registered
  2. Remove the MCP node from the workflow before generating code in lightweight mode
  3. Provide/wire an McpServerService bean implementation in your custom bootstrap

Example fix

// before
SpringApplication.run(SomeLiteApp.class, args);
// after
SpringApplication.run(StudioApplication.class, args);
Defensive patterns

Strategy: fallback

Validate before calling

if (applicationContext.getBeanProvider(McpServerService.class).getIfAvailable() == null) { throw new IllegalStateException("MCP support unavailable; start StudioApplication"); }

Type guard

null

Try / catch

try { section.render(node, varName); } catch (IllegalArgumentException e) { /* fall back: skip MCP nodes or abort generation with guidance */ }

Prevention

When it happens

Trigger: Generating code for a workflow containing an MCP node while Studio runs in a mode where McpServerService was not wired (e.g., not starting StudioApplication).

Common situations: Running Studio admin via a partial/test bootstrap or embedded mode that excludes MCP beans; deployment using a slimmed application class without MCP support.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/4a740dd06fa3a835. Report an issue: GitHub.