"Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools."
This extension define a declarative APIs that enable developers to implement the MCP server features easily.
Add server features (prompts, resources and tools) represented by annotated business methods of beans.
public class ServerFeatures {
@Inject
CodeService codeService;
@Tool(description = "Converts the string value to lower case")
String toLowerCase(String value) {
return value.toLowerCase();
}
@Prompt(name = "code_assist")
PromptMessage codeAssist(@PromptArg(name = "lang") String language) {
return PromptMessage.withUserRole(new TextContent(codeService.assist(language)));
}
@Resource(uri = "file:///project/alpha")
BlobResourceContents alpha(RequestUri uri) throws IOException{
return BlobResourceContents.create(uri.value(), Files.readAllBytes(Paths.ALPHA));
}
}This is a copy (with some modifications) from the API defined in https://github.com/quarkiverse/quarkus-mcp-server/tree/main/core/runtime/src/main/java/io/quarkiverse/mcp/server.