How can the MCP plus-in call the local JAVA MCP server

I follow the document to develop a MCP tool and set the server in local, And I can use it in Claude desktop. But when I use the MCP plus-in. But when I use it in n8n, it come up this error.


The document url: Build Your Own MCP Server in Under 15 Minutes | Spring AI Tutorial

Hello @string_G

Validate Java Command and Path
Make sure the path specified in Command points to the correct Java installation

/MY_PC/programs/linux_jdk/Jdk-17.0.14+7/bin/java

Test the command manually from the command line to ensure the server starts correctly:

/MY_PC/programs/linux_jdk/Jdk-17.0.14+7/bin/java -jar /MY_PC/Test/Java/Test/courses/target/courses-0.0.1-SNAPSHOT.jar

Make sure the MCP server is running and listening for connections.

netstat -anp | grep <porta>

Replace with the port used by the MCP server (usually configured in the Java code).

Make sure the port used by the MCP server is open for connections

sudo ufw allow <porta>

The correct value in the Arguments field should follow exactly:
-jar /MY_PC/Test/Java/Test/courses/target/courses-0.0.1-SNAPSHOT.jar
Make sure that:
The path to the JAR is correct.
It is accessible by the user running n8n.
The java -jar command works manually.

If the MCP server depends on environment variables (such as CLASSPATH, JAVA_HOME or others), they must be passed in the Environments field.
Format in n8n:
CLASSPATH=/example/path
JAVA_HOME=/MY_PC/programs/linux_jdk/Jdk-17.0.14+7

If this suggestion solved your problem, please mark my post as the solution (blue box with check mark) so that this ongoing discussion does not distract others who want to find the answer to the original question and click the heart. Thanks :blush:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.