You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Quarkus extension provides both declarative and programmatic APIs that enable developers to easily implement MCP1 server features.
Note
The LangChain4j project provides the MCP client functionality, either as a low-level programmatic API or as a full-fledged integration into AI-infused applications.
Get Started
Step #1
Add the following dependency to your POM file:
<dependency>
<groupId>io.quarkiverse.mcp</groupId>
<!-- use 'quarkus-mcp-server-stdio' if you want to use the STDIO transport instead of the HTTP/SSE transport -->
<artifactId>quarkus-mcp-server-sse</artifactId>
<version>${project-version}</version>
</dependency>
Step #2
Add server features (prompts, resources and tools) represented by annotated business methods of CDI beans.
importjakarta.inject.Inject;
importjava.io.IOException;
importjava.nio.file.Files;
importjava.nio.file.Path;
importio.quarkiverse.mcp.server.BlobResourceContents;
importio.quarkiverse.mcp.server.Prompt;
importio.quarkiverse.mcp.server.PromptArg;
importio.quarkiverse.mcp.server.PromptMessage;
importio.quarkiverse.mcp.server.Tool;
importio.quarkiverse.mcp.server.Resource;
importio.quarkiverse.mcp.server.TextContent;
// This class is automatically registered as a @Singleton CDI beanpublicclassServerFeatures {
@InjectCodeServicecodeService;
@Tool(description = "Converts the string value to lower case")
StringtoLowerCase(Stringvalue) {
returnvalue.toLowerCase();
}
@Prompt(name = "code_assist")
PromptMessagecodeAssist(@PromptArg(name = "lang") Stringlanguage) {
returnPromptMessage.withUserRole(newTextContent(codeService.assist(language)));
}
@Resource(uri = "file:///project/alpha")
BlobResourceContentsalpha(RequestUriuri) throwsIOException{
returnBlobResourceContents.create(uri.value(), Files.readAllBytes(Path.of("alpha.txt")));
}
}