Skip to content

Instantly share code, notes, and snippets.

@ehsavoie
Last active February 13, 2026 10:12
Show Gist options
  • Select an option

  • Save ehsavoie/3a12066ebd026ab3bb8d97733251f661 to your computer and use it in GitHub Desktop.

Select an option

Save ehsavoie/3a12066ebd026ab3bb8d97733251f661 to your computer and use it in GitHub Desktop.
Simple MCP server with JBang (you need the beans.xml file next to the java file)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
bean-discovery-mode="all">
</beans>
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17+
//REPOS mavencentral,jboss=https://repository.jboss.org/
//DEPS org.wildfly.bom:wildfly-expansion:${wildfly.version:39.0.1.Final}@pom
//DEPS org.wildfly.generative-ai:wildfly-ai-bom:0.9.0@pom
//DEPS org.wildfly.glow:wildfly-glow:1.5.2.Final
//DEPS jakarta.ws.rs:jakarta.ws.rs-api
//DEPS jakarta.enterprise:jakarta.enterprise.cdi-api
//DEPS org.wildfly.generative-ai:wildfly-mcp-api
//GLOW --spaces=incubating --server-version=39.0.1.Final
//FILES WEB-INF/beans.xml=beans.xml
import org.wildfly.mcp.api.Tool;
import org.wildfly.mcp.api.ToolArg;
public class SimpleMcpServer {
@Tool(description = "Provide a welcome customized message", name = "hello")
public String helloWorld(@ToolArg(description = "the name of the current user") String user) throws InterruptedException {
return "Hello World " + user;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment