Converts the string value to lower case
Quarkus MCP Server is an extension that provides declarative and programmatic APIs to easily implement Model Context Protocol (MCP) server features. It enables seamless integration between LLM applications and external data sources and tools through the open Model Context Protocol. The extension supports multiple transport mechanisms including HTTP/SSE and STDIO, making it flexible for various deployment scenarios.
The Quarkus MCP Server extension allows developers to implement Model Context Protocol (MCP) servers with minimal boilerplate code. It provides both declarative and programmatic APIs to define MCP server features such as tools, resources, and prompts.
To use the Quarkus MCP Server in your project, add the appropriate dependency to your Maven POM file:
<dependency>
<groupId>io.quarkiverse.mcp</groupId>
<!-- Choose one of the following transports -->
<!-- For HTTP/SSE transport: -->
<artifactId>quarkus-mcp-server-sse</artifactId>
<!-- OR for STDIO transport: -->
<!-- <artifactId>quarkus-mcp-server-stdio</artifactId> -->
<version>[latest-version]</version>
</dependency>
Server features are implemented as annotated business methods of CDI beans:
@Tool
annotation to expose methods as callable tools@Resource
annotation to provide access to data@Prompt
annotation to define prompt templatesExample:
import jakarta.inject.Inject;
import io.quarkiverse.mcp.server.Tool;
import io.quarkiverse.mcp.server.Resource;
import io.quarkiverse.mcp.server.Prompt;
import io.quarkiverse.mcp.server.PromptArg;
import io.quarkiverse.mcp.server.PromptMessage;
import io.quarkiverse.mcp.server.TextContent;
// This class is automatically registered as a CDI bean
public class ServerFeatures {
@Tool(description = "Converts the string value to lower case")
String toLowerCase(String value) {
return value.toLowerCase();
}
@Resource(path = "/files")
TextContent getFileContents(Path path) {
try {
return TextContent.of(Files.readString(path));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Prompt(name = "code_assist")
PromptMessage codeAssist(@PromptArg(name = "language") String language) {
return PromptMessage.userMessage("Generate sample code in " + language);
}
}
Configure the MCP server in your application.properties
:
# For SSE transport
quarkus.mcp.sse.path=/mcp
quarkus.mcp.sse.cors=true
# For security (optional)
quarkus.mcp.sse.auth.enabled=true
quarkus.mcp.sse.auth.users.alice=password123
Start your Quarkus application as usual:
./mvnw quarkus:dev
For the SSE transport, the MCP server will be available at the configured path (default: /mcp
).
The MCP server can be used with any MCP client. For Java applications, the LangChain4j project provides MCP client functionality.