Back to MCP Catalog

Quarkus MCP Server

Developer ToolsJava
A Quarkus extension for implementing Model Context Protocol servers
Available Tools

toLowerCase

Converts the string value to lower case

value

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.

Overview

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.

Installation

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>

Implementation

Defining Server Features

Server features are implemented as annotated business methods of CDI beans:

  1. Tools: Use the @Tool annotation to expose methods as callable tools
  2. Resources: Use the @Resource annotation to provide access to data
  3. Prompts: Use the @Prompt annotation to define prompt templates

Example:

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);
    }
}

Configuration

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

Running the Server

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).

Client Integration

The MCP server can be used with any MCP client. For Java applications, the LangChain4j project provides MCP client functionality.

Related MCPs

Apple Shortcuts
Developer ToolsJavaScript

Control Apple Shortcuts automations from AI assistants

Clojars Dependency Lookup
Developer ToolsJavaScript

Fetch dependency information from Clojars, the Clojure community's artifact repository

Simple Timeserver
Developer ToolsPython

Provides Claude with current time and timezone information

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.