Using MCP tools
Model Context Protocol (MCP) is an open protocol standard that provides a standardized way for AI models to connect to external data sources and tools. Lucenia integrates with MCP, enabling agents to use external tools and data sources through MCP servers.
This is an experimental feature and is not recommended for use in a production environment. For updates on its progress, see the Lucenia version history.
Overview
Lucenia 0.7.0 ships an experimental MCP server as part of the ML Commons plugin. The MCP server provides several key capabilities:
- Server-Sent Events (SSE) Interface: The server publishes a core set of tools as first-class MCP endpoints over a streaming Server-Sent Events (SSE) interface (
/_plugins/_ml/mcp/sse
). - Tool Discovery and Execution: An LLM agent—for example, LangChain's ReAct agent—can simply connect to the server, discover the tools it offers, and then invoke the tools using JSON arguments.
Prerequisites
The default HTTP transport method does not support streaming. You must install the transport-reactor-netty4
HTTP transport plugin and use it as the default HTTP transport layer.
# Install the transport plugin
./bin/lucenia-plugin install transport-reactor-netty4
# Configure as default transport in lucenia.yml
http.type: reactor-netty4
Two implementation approaches
Lucenia provides two ways to run an MCP server:
1. Built-in MCP Server (Lucenia 0.7.0+)
The built-in MCP server is integrated into the ML Commons plugin and accessible via the /_plugins/_ml/mcp/sse
endpoint.
Advantages:
- No additional setup required
- Direct integration with Lucenia's ML Commons tools
- Automatic authentication and authorization
Usage:
# Connect to the built-in MCP server
curl -X GET "https://localhost:9200/_plugins/_ml/mcp/sse" \
-H "Authorization: Basic <credentials>" \
-H "Accept: text/event-stream"
2. External MCP Client Connection
The Lucenia MCP client allows Lucenia agents to connect to external tool providers through the MCP protocol, significantly expanding their capabilities beyond native Lucenia functions.
Advantages:
- Access to specialized external services (weather forecasts, translation APIs, document processing tools)
- Flexibility to use third-party MCP servers
- Language-specific integrations
Available MCP APIs
ML Commons supports the following MCP APIs:
Current limitations
- MCP tools can only be used with conversational or plan-execute-reflect agent types
- This is an experimental feature and not recommended for production use
Configuration
Authentication
When connecting to the MCP server, you'll need to include appropriate authentication headers based on your Lucenia security setup:
# Basic authentication
curl -X GET "https://localhost:9200/_plugins/_ml/mcp/sse" \
-H "Authorization: Basic $(echo -n 'username:password' | base64)" \
-H "Accept: text/event-stream"
For Python clients
For Python MCP clients, use this URL to establish the connection:
/_plugins/_ml/mcp/sse?append_to_base_url=true
Next steps
Future development
As this experimental feature matures, we anticipate a growing ecosystem of MCP-compatible tools that will make Lucenia agents increasingly capable of executing complex, multi-step tasks.