Quarkus extension for integrating Model Context Protocol (MCP) client capabilities with LangChain4j
Quarkus Dev UI integration for interactive tool testing, exploration, and execution with example parameters. Provides a browser-based interface for exploring and testing MCP tools during development.
Backend service providing MCP client information and tool execution for Dev UI.
package io.quarkiverse.langchain4j.mcp.runtime.devui;
public class McpClientsJsonRpcService {
/**
* Get information about all configured MCP clients and their tools.
*
* @return List of MCP client information including tools, descriptions, and arguments
*/
public List<McpClientInfo> clientInfos() { ... }
/**
* Execute a tool with provided arguments.
*
* @param clientName Name of the MCP client
* @param toolName Name of the tool to execute
* @param arguments JSON string containing tool arguments
* @return Tool execution result as JSON string
*/
public String executeTool(String clientName, String toolName, String arguments) { ... }
}Model representing MCP client information for Dev UI.
package io.quarkiverse.langchain4j.mcp.runtime.devui.json;
public class McpClientInfo {
/**
* CDI/logical client name.
*/
private String cdiName;
/**
* Tools provided by this client.
*/
private List<McpToolInfo> tools;
// Getters and setters
}Model representing MCP tool information for Dev UI.
package io.quarkiverse.langchain4j.mcp.runtime.devui.json;
public class McpToolInfo {
/**
* Tool name.
*/
private String name;
/**
* Tool description.
*/
private String description;
/**
* JSON example input generated from tool schema.
*/
private String exampleInput;
/**
* Tool arguments.
*/
private List<McpToolArgInfo> args;
// Getters and setters
}Model representing tool argument information for Dev UI.
package io.quarkiverse.langchain4j.mcp.runtime.devui.json;
public class McpToolArgInfo {
/**
* Argument name.
*/
private String name;
/**
* Argument JSON type (string, integer, number, boolean, array, object).
*/
private String type;
/**
* Argument description.
*/
private String description;
/**
* Whether argument is required.
*/
private boolean required;
// Getters and setters
}Run Quarkus in development mode:
mvn quarkus:devOr with Gradle:
./gradlew quarkusDevNavigate to:
http://localhost:8080/q/dev-uiLook for the "LangChain4j MCP" card in the Dev UI. Click it to access MCP-specific features.
View all configured MCP clients:
Browse tools from each MCP client:
Execute tools directly from the browser:
The Dev UI automatically generates example inputs from JSON schemas:
JSON Schema:
{
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "File path"
},
"count": {
"type": "integer",
"description": "Number of items"
},
"recursive": {
"type": "boolean",
"description": "Recursive flag"
}
},
"required": ["path"]
}Generated Example:
{
"path": "example",
"count": 1,
"recursive": true
}Utility class for generating example JSON from schemas.
package io.quarkiverse.langchain4j.mcp.runtime.devui.json;
public class JsonSchemaToExampleStringHelper {
/**
* Generate example JSON string from JSON schema element.
*
* @param element JSON schema element
* @return Example JSON string
*/
public static String generateExampleStringFromSchema(JsonSchemaElement element) { ... }
}Supported Schema Types:
JsonBooleanSchema → "true"JsonNumberSchema → "1.0"JsonStringSchema → "example"JsonIntegerSchema → "1"JsonNullSchema → "null"JsonObjectSchema → {"key": value, ...}JsonArraySchema → [value]JsonAnyOfSchema → first optionJsonEnumSchema → first enum valuequarkus.langchain4j.mcp.filesystem.transport-type=stdio
quarkus.langchain4j.mcp.filesystem.command=npm,exec,@modelcontextprotocol/server-filesystem,/workspaceOpen Dev UI at http://localhost:8080/q/dev-ui
Click "LangChain4j MCP" card
Select "filesystem" client
Browse available tools:
list_directory - List files in directoryread_file - Read file contentswrite_file - Write file contentscreate_directory - Create directoryClick "read_file" tool
Modify example input:
{
"path": "/workspace/README.md"
}Click "Execute"
View file contents in result panel
quarkus.langchain4j.mcp.github.transport-type=streamable-http
quarkus.langchain4j.mcp.github.url=https://github-mcp.example.com/mcp
quarkus.langchain4j.mcp.github.header.Authorization=Bearer ${GITHUB_TOKEN}Open Dev UI
Select "github" client
Explore tools:
list_repositories - List user repositoriescreate_issue - Create GitHub issuelist_pull_requests - List PRsTest create_issue:
{
"repo": "myorg/myrepo",
"title": "Test issue from Dev UI",
"body": "Testing MCP integration"
}quarkus.langchain4j.mcp.database.transport-type=stdio
quarkus.langchain4j.mcp.database.command=python,/opt/mcp-db/server.py
quarkus.langchain4j.mcp.database.environment.DB_HOST=localhost
quarkus.langchain4j.mcp.database.environment.DB_PORT=5432Open Dev UI
Select "database" client
Test query tool:
{
"sql": "SELECT * FROM users LIMIT 10"
}Add MCP server configurations to application.properties:
quarkus.langchain4j.mcp.server1.transport-type=stdio
quarkus.langchain4j.mcp.server1.command=...
quarkus.langchain4j.mcp.server2.transport-type=streamable-http
quarkus.langchain4j.mcp.server2.url=...mvn quarkus:devOpen Dev UI and browse available tools from each server.
Execute tools with different inputs to verify functionality.
Adjust timeouts, authentication, and other settings based on test results.
Once tools are verified, implement AI service:
@RegisterAiService
public interface MyAssistant {
@McpToolBox({"server1", "server2"})
String chat(@UserMessage String message);
}Test the AI service with real LLM interactions now that tools are verified.
mvn quarkus:dev)Install with Tessl CLI
npx tessl i tessl/maven-io-quarkiverse-langchain4j--quarkus-langchain4j-mcp