Created
March 18, 2025 12:01
-
-
Save ehsavoie/1d1a5ea36519b48bf29a0e3e3d1e0ca9 to your computer and use it in GitHub Desktop.
Chicory MCP Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <beans xmlns="https://jakarta.ee/xml/ns/jakartaee" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd" | |
| bean-discovery-mode="all"> | |
| </beans> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ///usr/bin/env jbang "$0" "$@" ; exit $? | |
| //JAVA 17+ | |
| //REPOS mavencentral,jboss=https://repository.jboss.org/ | |
| //DEPS org.wildfly.bom:wildfly-expansion:${wildfly.version:35.0.1.Final}@pom | |
| //DEPS org.wildfly:wildfly-ai-bom:0.4.2@pom | |
| //DEPS org.wildfly.glow:wildfly-glow:1.3.3.Final | |
| //DEPS jakarta.ws.rs:jakarta.ws.rs-api | |
| //DEPS jakarta.enterprise:jakarta.enterprise.cdi-api | |
| //DEPS org.wildfly:wildfly-mcp-api | |
| //DEPS org.extism.sdk:chicory-sdk:0.1.3 | |
| //GLOW --spaces=incubating --server-version=35.0.1.Final | |
| //FILES WEB-INF/beans.xml=beans.xml | |
| import java.nio.charset.StandardCharsets; | |
| import java.util.Map; | |
| import org.extism.sdk.chicory.Manifest; | |
| import org.extism.sdk.chicory.ManifestWasm; | |
| import org.extism.sdk.chicory.Plugin; | |
| import org.wildfly.mcp.api.Tool; | |
| import org.wildfly.mcp.api.ToolArg; | |
| public class ChicoryMcpServer { | |
| @Tool(description = "Count the number of vowels in a String") | |
| public String countVowels(@ToolArg(description = "The string from which to count the number of vowels") String message) { | |
| String url = "https://github.com/extism/plugins/releases/latest/download/count_vowels.wasm"; | |
| ManifestWasm wasm = ManifestWasm.fromUrl(url).build(); | |
| Map<String, String> config = Map.of("vowels", "aeiouyAEIOUY"); | |
| Manifest manifest = Manifest.ofWasms(wasm) | |
| .withOptions(new Manifest.Options().withConfig(config)).build(); | |
| Plugin plugin = Plugin.ofManifest(manifest).build(); | |
| byte[] output = plugin.call("count_vowels", message.getBytes(StandardCharsets.UTF_8)); | |
| return new String(output, StandardCharsets.UTF_8); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment