sebastiandaschner blog


Writing Your Own MCP Server

#java #quarkus #ai monday, march 31, 2025

AI agent tools such as Goose allow to call tools, that is function calling that can invoke any desired behavior in external tools and applications. In this video, I’m showing how to implement your own MCP server using Java and Quarkus, and how to use it via the Goose command line agent.

 

 

Thanks to Quarkus' MCP Server Extension, defining prompts and tools is straightforward, in a declarative way:

import io.quarkiverse.mcp.server.Tool;
import io.quarkiverse.mcp.server.ToolArg;
// ...

@ApplicationScoped
public class MCPServerFavoriteCoffee {

    @RestClient
    FavoriteCoffeeClient client;

    @Tool(description = "Lists all coffee beans")
    public List<CoffeeBean> list_coffee_beans(@ToolArg(
            description = "The coffee flavor to filter by." +
            "The flavors are: Spicy, Chocolaty, Fruity, Flowery, Buttery, Earthy, Winey, Nutty",
                required = false) String flavor) {
        return client.beans(flavor);
    }

}

Have a look at the favorite coffee project on GitHub for a full example.

 

More Information

 

Found the post useful? Then you might enjoy my Developer Productivity Masterclass.