Model Context Protocol (MCP)

The Model Context Protocol (MCP) is an open protocol designed to connect AI models with external tools, resources, and data sources in a standardized way. An MCP server exposes resources, prompts, and tools that AI clients can discover and invoke dynamically, enabling more powerful and context-aware applications.

MCP Server

Helidon provides support for building Model Context Protocol (MCP) servers through a dedicated extension. The MCP Server feature is not part of the core Helidon Framework – it is delivered as a separate project hosted in the helidon-mcp GitHub repository.

Helidon MCP Server Extension

The Helidon MCP Server extension allows you to build and run MCP servers with Helidon.

Key points:

  • Separate repository: helidon-mcp

  • Independent lifecycle: Requires Helidon but has its own versioning and release cadence

  • Dedicated documentation: Full usage guides, configuration details, and examples are provided directly in the helidon-mcp documentation

To get started:

  1. Visit the helidon-mcp GitHub repository.
  2. Follow the setup and usage instructions in the repository’s documentation.
  3. Explore how to expose your Helidon resources as MCP tools, prompts, and data sources.

MCP Client

Helidon includes support for an MCP client through its integration with LangChain4j. With this integration, you can set up the MCP client using Helidon configuration and plug it directly into your LangChain4j AI Services and Agents.

In LangChain4j, an MCP (Model Context Protocol) client acts as a bridge between the language model and external services or resources that follow the MCP standard. Instead of directly embedding custom logic into the application, the MCP client enables the model to discover, connect to, and interact with external tools and data providers in a standardized way.

To add MCP Clients to your AI Service, use @Ai.McpClients annotation to reference configured clients:

@Ai.Service
@Ai.ChatModel("expensive-model")
@Ai.McpClients(value = {"foo-mcp-server", "bar-mcp-server"})
public interface ChatAiService {
    String chat(String question);
}
Copied

If you want to have your MCP clients created from the configuration, it should be placed under the langchain4j.mcp-clients.

langchain4j:
  providers:
    open-ai:
      api-key: "${OPEN_AI_API_TOKEN}"

  models:
    expensive-model:
      provider: open-ai
      model-name: "openai.gpt-oss-120b"

  mcp-clients:
    foo-mcp-server:
      uri: http://foo-mcp-server
      initialization-timeout: PT15M
    bar-mcp-server:
      uri: http://bar-mcp-server
      tool-execution-timeout: PT10S
Copied

These are all the MCP Client configuration options currently supported:

Configuration options

KeyKindTypeDescription
client-nameVALUEStringSets the name that the client will use to identify itself to the MCP server in the initialization message
client-versionVALUEStringSets the version string that the client will use to identify itself to the MCP server in the initialization message
initialization-timeoutVALUEDurationSets the timeout for initializing the client
keyVALUEStringSets a unique identifier for the client
log-requestsVALUEBooleanWhether to log request traffic
log-responsesVALUEBooleanWhether to log response traffic
ping-timeoutVALUEDurationThe timeout to apply when waiting for a ping response
prompts-timeoutVALUEDurationThe timeout for prompt-related operations (listing prompts as well as rendering the contents of a prompt)
protocol-versionVALUEStringSets the protocol version that the client will advertise in the initialization message
reconnect-intervalVALUEDurationThe delay before attempting to reconnect after a failed connection
resources-timeoutVALUEDurationSets the timeout for resource-related operations (listing resources as well as reading the contents of a resource)
tlsVALUEi.h.c.t.TlsTLS configuration for the MCP server connection
tool-execution-timeoutVALUEDurationSets the timeout for tool execution
tool-execution-timeout-error-messageVALUEStringThe error message to return when a tool execution times out
uriVALUEURIThe URL of the MCP server

Deprecated Options

KeyKindTypeDescription
sse-uriVALUEURIThe initial URI where to connect to the server and request an SSE channel