Quarkus Model Context Protocol (MCP) Server

by quarkiverse

193 stars
349 downloads
Not rated
GitHub Website

About

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

Details

Author
quarkiverse
GitHub stars
193
Downloads
349
Categories
Other

- Declarative and programmatic APIs for MCP server implementation.
- Supports tools, prompts, and resources via CDI beans.
- Provides HTTP/SSE and STDIO transport options.
- Annotation-driven development with @Tool, @Prompt, @Resource.
- Integrates seamlessly with Quarkus build and runtime.

Add the quarkus-mcp-server-http (or quarkus-mcp-server-stdio) Maven dependency to your project. Annotate CDI bean methods with @Tool, @Prompt, or @Resource to define server features. Run your Quarkus application to start the MCP server.

Quarkus MCP Server

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> All Contributors <!-- ALL-CONTRIBUTORS-BADGE:END --> Version

This Quarkus extension provides both declarative and programmatic APIs that enable developers to easily implement MCP[^1] server features.

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

> [!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>
    <artifactId>quarkus-mcp-server-http</artifactId>
    <version>${quarkus-mcp-server-version}</version>
</dependency>

> [!NOTE]
> This dependency includes both the legacy "HTTP/SSE" and the "Streamable HTTP" transport. Use the quarkus-mcp-server-stdio artifactId if you want to use the STDIO transport instead. See also the Transports section in the docs for more information.

Step #2

Add server features (prompts, resources and tools) represented by _annotated business methods_ of CDI beans.

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

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

@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.txt")
byte[] alpha() throws IOException{
return Files.readAllBytes(Path.of("alpha.txt"));
}

}

Step #3

Run your Quarkus app and have fun!

Documentation

The full documentation is available at https://quarkiverse.github.io/quarkiverse-docs/quarkus-mcp-server/dev/index.html.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mkouba">Martin Kouba<br /><sub><b>Martin Kouba</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=mkouba" title="Code">💻</a> <a href="#maintenance-mkouba" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/geoand">Georgios Andrianakis<br /><sub><b>Georgios Andrianakis</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=geoand" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://xam.dk">Max Rydahl Andersen<br /><sub><b>Max Rydahl Andersen</b></sub></a><br /><a href="#example-maxandersen" title="Examples">💡</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/r_svoboda">Rostislav Svoboda<br /><sub><b>Rostislav Svoboda</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=rsvoboda" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/gastaldi">George Gastaldi<br /><sub><b>George Gastaldi</b></sub></a><br /><a href="#infra-gastaldi" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jmartisk">Jan Martiska<br /><sub><b>Jan Martiska</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=jmartisk" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://iocanel.com">Ioannis Canellos<br /><sub><b>Ioannis Canellos</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=iocanel" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sberyozkin">Sergey Beryozkin<br /><sub><b>Sergey Beryozkin</b></sub></a><br /><a href="#example-sberyozkin" title="Examples">💡</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://kpavlov.me">Konstantin Pavlov<br /><sub><b>Konstantin Pavlov</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=kpavlov" title="Tests">⚠️</a> <a href="#infra-kpavlov" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mvduijnhoven">Martijn van Duijnhoven<br /><sub><b>Martijn van Duijnhoven</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=mvduijnhoven" title="Code">💻</a> <a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=mvduijnhoven" title="Tests">⚠️</a> <a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=mvduijnhoven" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/PierreBtz">Pierre Beitz<br /><sub><b>Pierre Beitz</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=PierreBtz" title="Code">💻</a> <a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=PierreBtz" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mrecouly">Matthieu Recouly<br /><sub><b>Matthieu Recouly</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=mrecouly" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://wjglerum.nl">Willem Jan Glerum<br /><sub><b>Willem Jan Glerum</b></sub></a><br /><a href="#infra-wjglerum" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/SaSteffen">Sascha Steffen<br /><sub><b>Sascha Steffen</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=SaSteffen" title="Code">💻</a> <a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=SaSteffen" title="Tests">⚠️</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/cescoffier">Clement Escoffier<br /><sub><b>Clement Escoffier</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=cescoffier" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rolfedh">Rolfe Dlugy-Hegwer<br /><sub><b>Rolfe Dlugy-Hegwer</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=rolfedh" title="Documentation">📖</a> <a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=rolfedh" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://brunobat.com/about">Bruno Baptista<br /><sub><b>Bruno Baptista</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=brunobat" title="Documentation">📖</a> <a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=brunobat" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/moayad-alyaghshi">Moayad Alyaghshi<br /><sub><b>Moayad Alyaghshi</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-mcp-server/issues?q=author%3Amoayad-alyaghshi" title="Bug reports">🐛</a> <a href="https://github.com/quarkiverse/quarkus-mcp-server/commits?author=moayad-alyaghshi" title="Code">💻</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.