# quarkus-mcp-server

> MCP Server

This repository provides a Quarkus extension for implementing Model Context Protocol (MCP) servers, enabling seamless integration between LLM applications and external data sources through declarative and programmatic APIs.

## Overview

- **Category:** Developer Tools
- **Language:** Java
- **Stars:** 198
- **Forks:** 13
- **Owner:** quarkiverse
- **GitHub:** https://github.com/quarkiverse/quarkus-mcp-server
- **Homepage:** https://docs.quarkiverse.io/quarkus-mcp-server/dev/
- **Created:** 2024-12-11T12:40:16+00:00
- **Updated:** 2025-03-28T23:28:17+00:00
- **Source:** https://model-context-protocol.com/servers/quarkus-mcp-server-extension-model-context

## Setup

## Setup

### Step #1
Add the following dependency to your POM file:

```xml
<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.

```java
import jakarta.inject.Inject;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import io.quarkiverse.mcp.server.BlobResourceContents;
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;
import io.quarkiverse.mcp.server.TextContent;

// This class is automatically registered as a @Singleton CDI bean
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));
    }

}
```

### Step #3
Run your Quarkus app and have fun!

## Tools

## Available Tools

1.  Prompts (represented by annotated business methods of CDI beans).
2.  Resources (represented by annotated business methods of CDI beans).
3.  Tools (represented by annotated business methods of CDI beans).
4.  `toLowerCase` (Converts the string value to lower case).
5.  `code_assist` (Assists with code based on the specified language).
6.  `alpha` (Retrieves blob resource contents from a specified URI).
