Skip to content

Commit

Permalink
Merge pull request quarkiverse#12 from maxandersen/template
Browse files Browse the repository at this point in the history
add template
  • Loading branch information
maxandersen authored Feb 5, 2025
2 parents e9a910c + 1272634 commit f8150f4
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 8 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,44 @@ Other ideas:
- jfr/java hooked to jmx/jfr
- quarkus dev mode
- ...

## Contributing

If you have ideas for other servers, feel free to contribute them to this project.

To get started, clone the repository and build it:

```bash
git clone https://github.com/quarkiverse/quarkus-mcp-servers
cd quarkus-mcp-servers
mvn clean install
```

Then run the following command to generate a new server for i.e. jfr:

```shell
mkdir jfr
cd jfr
jbang -t mcp jfr
```

This will create the `jfr` directory with a Hello World MCP server.

You can then build it:

```shell
mvn clean install
```

To wire it into the full project you need to add `<module>jfr</module>` to the root `pom.xml` file.

Make sure you have added some useful content to the `README.md` file + updated the demo image.

Then open a PR :)







34 changes: 26 additions & 8 deletions jbang-catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"filesystem": {
"script-ref": "https://github.com/quarkiverse/quarkus-mcp-servers/releases/download/early-access/mcp-server-filesystem.jar",
"java":"17+"
"java": "17+"
},
"mcp-server-jdbc": {
"script-ref": "jdbc/.scripts/mcpjdbc.java",
Expand All @@ -25,19 +25,37 @@
},
"mcp-server-jfx": {
"script-ref": "https://github.com/quarkiverse/quarkus-mcp-servers/releases/download/early-access/mcp-server-jfx.jar",
"java": "17+",
"dependencies": ["org.openjfx:javafx-controls:21", "org.openjfx:javafx-graphics:21", "org.openjfx:javafx-swing:21"]
"dependencies": [
"org.openjfx:javafx-controls:21",
"org.openjfx:javafx-graphics:21",
"org.openjfx:javafx-swing:21"
],
"java": "17+"
},
"jfx": {
"script-ref": "https://github.com/quarkiverse/quarkus-mcp-servers/releases/download/early-access/mcp-server-jfx.jar",
"java": "17+",
"dependencies": ["org.openjfx:javafx-controls:21", "org.openjfx:javafx-graphics:21", "org.openjfx:javafx-swing:21"]
"dependencies": [
"org.openjfx:javafx-controls:21",
"org.openjfx:javafx-graphics:21",
"org.openjfx:javafx-swing:21"
],
"java": "17+"
},
"kubernetes": {
"script-ref": "kubernetes/src/main/java/io/quarkus/mcp/servers/kubernetes/MCPServerKubernetes.java",
"java": "17+"
}

},
"templates": {}
}
"templates": {
"mcp": {
"file-refs": {
"src/main/resources/application.properties": "template/application.properties",
"src/main/java/io/quarkus/mcp/servers/{basename}/MCPServer{basename}.java": "template/MCPServer.java.qute",
"images/{basename}-demo.png": "template/demo.png",
"pom.xml": "template/pom.xml.qute",
"README.md": "template/README.md.qute"
},
"properties": {}
}
}
}
25 changes: 25 additions & 0 deletions template/MCPServer.java.qute
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.quarkus.mcp.servers.{baseName};

import io.quarkiverse.mcp.server.Prompt;
import io.quarkiverse.mcp.server.PromptArg;
import io.quarkiverse.mcp.server.PromptMessage;
import io.quarkiverse.mcp.server.TextContent;
import io.quarkiverse.mcp.server.Tool;
import io.quarkiverse.mcp.server.ToolArg;

public class MCPServer{baseName} {

@Tool(description = "Say hello")
String hello(@ToolArg(description = "Who you want to be greeted") String who) {
return "Hello " + who;
}

@Prompt(description = "Make a greeting")
PromptMessage make_greeting(@PromptArg(description = "Who you want to be greeted") String who) {
return PromptMessage.withUserRole(new TextContent(
"""
The assistants goal is to greet the user {who}
"""
));
}
}
48 changes: 48 additions & 0 deletions template/README.md.qute
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Model Context Protocol Server for \{baseName\}

This Model Context Protocol(MCP) server enables Large Language Models (LLMs) to work with {basename}.

![](images/\{basename\}-demo.png)


## General Usage

1. Install [jbang](https://www.jbang.dev/download/)
2. Configure your MCP Client to run the server (see [Claude Desktop Config](#claude-desktop-config) below)

Below are examples of command lines to use for configuring the server.

Start server:

```shell
jbang mcp-server-{basename}@quarkusio
```

## Components

Below are the MCP components provided by this server.

### Tools

* **hello_world** - say hello to the user

### Prompts

* **make_greeting** - example prompt to get started exploring the server

## Claude Desktop Config and [mcp-cli](https://github.com/chrishayuk/mcp-cli)

Add this to your `claude_desktop.json` or `server_config.json` file:

```json
{
"mcpServers": {
"jdbc": {
"command": "jbang",
"args": [
"mcp-server-{basename}@quarkiverse/quarkus-mcp-server"
]
}
}
}
```
Empty file added template/application.properties
Empty file.
Binary file added template/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
115 changes: 115 additions & 0 deletions template/pom.xml.qute
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.quarkus.mcp.servers</groupId>
<artifactId>mcp-server-{baseName}</artifactId>

<parent>
<groupId>io.quarkiverse.mcp.servers</groupId>
<artifactId>mcp-servers-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>

<properties>

</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>$\{quarkus.platform.group-id}</groupId>
<artifactId>$\{quarkus.platform.artifact-id}</artifactId>
<version>$\{quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus.mcp.servers</groupId>
<artifactId>mcp-server-shared</artifactId>
<version>$\{version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-qute</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>$\{quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>$\{quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
<goal>native-image-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>$\{compiler-plugin.version}</version>
<configuration>
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>$\{surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>$\{maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>$\{surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<native.image.path>
$\{project.build.directory}/$\{project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>$\{maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

</project>

0 comments on commit f8150f4

Please sign in to comment.