CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-io-quarkiverse-langchain4j--quarkus-langchain4j-mcp

Quarkus extension for integrating Model Context Protocol (MCP) client capabilities with LangChain4j

Overview
Eval results
Files

dev-ui.mddocs/

Dev UI Support

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.

Capabilities

JSON-RPC Service

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) { ... }
}

Client Information

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
}

Tool Information

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
}

Tool Argument Information

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
}

Accessing Dev UI

Starting Dev Mode

Run Quarkus in development mode:

mvn quarkus:dev

Or with Gradle:

./gradlew quarkusDev

Opening Dev UI

Navigate to:

http://localhost:8080/q/dev-ui

MCP Extension Card

Look for the "LangChain4j MCP" card in the Dev UI. Click it to access MCP-specific features.

Dev UI Features

Client List

View all configured MCP clients:

  • Client name
  • Transport type
  • Connection status
  • Number of available tools

Tool Explorer

Browse tools from each MCP client:

  • Tool name and description
  • Input parameters with types
  • Required vs optional parameters
  • Example input (auto-generated)

Interactive Tool Execution

Execute tools directly from the browser:

  1. Select an MCP client
  2. Choose a tool
  3. Review auto-generated example input
  4. Modify input parameters as needed
  5. Click "Execute"
  6. View execution results

Example Inputs

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
}

JSON Schema to Example Helper

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 option
  • JsonEnumSchema → first enum value

Usage Examples

Exploring Filesystem Tools

  1. Start application in dev mode with filesystem MCP server:
quarkus.langchain4j.mcp.filesystem.transport-type=stdio
quarkus.langchain4j.mcp.filesystem.command=npm,exec,@modelcontextprotocol/server-filesystem,/workspace
  1. Open Dev UI at http://localhost:8080/q/dev-ui

  2. Click "LangChain4j MCP" card

  3. Select "filesystem" client

  4. Browse available tools:

    • list_directory - List files in directory
    • read_file - Read file contents
    • write_file - Write file contents
    • create_directory - Create directory
  5. Click "read_file" tool

  6. Modify example input:

{
  "path": "/workspace/README.md"
}
  1. Click "Execute"

  2. View file contents in result panel

Testing GitHub Integration

  1. Configure GitHub MCP server:
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}
  1. Open Dev UI

  2. Select "github" client

  3. Explore tools:

    • list_repositories - List user repositories
    • create_issue - Create GitHub issue
    • list_pull_requests - List PRs
  4. Test create_issue:

{
  "repo": "myorg/myrepo",
  "title": "Test issue from Dev UI",
  "body": "Testing MCP integration"
}
  1. Execute and verify issue creation

Testing Database Tools

  1. Configure database MCP server:
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=5432
  1. Open Dev UI

  2. Select "database" client

  3. Test query tool:

{
  "sql": "SELECT * FROM users LIMIT 10"
}
  1. View query results

Development Workflow

1. Configure MCP Servers

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=...

2. Start Dev Mode

mvn quarkus:dev

3. Explore Tools

Open Dev UI and browse available tools from each server.

4. Test Tools

Execute tools with different inputs to verify functionality.

5. Iterate on Configuration

Adjust timeouts, authentication, and other settings based on test results.

6. Implement AI Service

Once tools are verified, implement AI service:

@RegisterAiService
public interface MyAssistant {
    @McpToolBox({"server1", "server2"})
    String chat(@UserMessage String message);
}

7. Test AI Service

Test the AI service with real LLM interactions now that tools are verified.

Dev UI Benefits

Rapid Development

  • Immediate feedback on MCP server configuration
  • Quick tool testing without writing code
  • Example inputs for understanding tool schemas

Debugging

  • Verify tool availability and connectivity
  • Test authentication and authorization
  • Inspect tool responses and error messages

Documentation

  • Browse tool descriptions and parameters
  • Understand required vs optional parameters
  • Learn tool schemas through examples

Exploration

  • Discover available tools from MCP servers
  • Understand tool capabilities before integration
  • Test edge cases and error handling

Important Notes

  • Dev UI is only available in development mode (mvn quarkus:dev)
  • Not available in production builds
  • Tool execution happens synchronously in Dev UI
  • Tool execution uses configured timeouts
  • Authentication (if configured) is applied to Dev UI tool executions
  • Example inputs are auto-generated from JSON schemas
  • Dev UI provides direct access to MCP client operations
  • Results are displayed as formatted JSON
  • Errors are displayed with stack traces for debugging
  • All configured MCP clients are available in Dev UI

Install with Tessl CLI

npx tessl i tessl/maven-io-quarkiverse-langchain4j--quarkus-langchain4j-mcp

docs

ai-service-integration.md

authentication.md

configuration.md

dev-ui.md

index.md

observability.md

registry-client.md

transport.md

tile.json