Skip to content

This extension enables developers to implement the MCP server features easily.

License

Notifications You must be signed in to change notification settings

mkouba/quarkus-mcp-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quarkus Model Context Protocol (MCP) Server

All Contributors

Version

"Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools."

This extension provides a declarative API that enables developers to implement the MCP server features easily.

Get Started

Step #1 - add the following dependency to your POM file:

<dependency>
    <groupId>io.quarkiverse.mcp</groupId>
    <artifactId>quarkus-mcp-server</artifactId>
    <version>${project-version}</version>
</dependency>

Step #2 - add server features (prompts, resources and tools) represented by an annotated business method of a CDI bean.

import java.nio.file.Files;

import jakarta.inject.Inject;

import io.quarkiverse.mcp.server.Prompt;
import io.quarkiverse.mcp.server.PromptArg;
import io.quarkiverse.mcp.server.PromptMessage;

import io.quarkiverse.mcp.server.Tool;
import io.quarkiverse.mcp.server.Resource;

// This class is automatically registered as a @Singleton CDI bean
public class ServerFeatures {

    @Inject
    CodeService codeService;

    @Tool
    TextContent toLowerCase(String value) {
        return new TextContent(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(String uri) {
        return BlobResourceContents.create(uri, Files.readAllBytes(Paths.ALPHA));
    }

}

Step #3 - run your Quarkus app!

Read the full documentation.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Martin Kouba
Martin Kouba

💻 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

About

This extension enables developers to implement the MCP server features easily.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%