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 ships an experimental MCP server as part of the ML Commons plugin. The MCP server uses the Streamable HTTP transport protocol and provides several key capabilities:
- Tool Discovery: Clients can discover available tools on the MCP server
- Tool Execution: Invoke tools using JSON-RPC over HTTP
- Stateless Communication: All communication happens over stateless HTTP calls
Prerequisites
Before using MCP tools, enable the MCP server functionality in your cluster:
PUT /_cluster/settings
{
"persistent": {
"plugins.ml_commons.mcp_server_enabled": "true"
}
}
Two implementation approaches
Lucenia provides two ways to work with MCP:
1. Built-in MCP Server (Lucenia 0.7.1+)
The built-in MCP server is integrated into the ML Commons plugin and accessible via the /_plugins/_ml/mcp endpoint using Streamable HTTP transport.
Advantages:
- No additional setup required
- Direct integration with Lucenia's ML Commons tools
- Automatic authentication and authorization
- Stateless HTTP communication
Usage:
# Connect to the built-in MCP server
curl -X POST "https://localhost:9200/_plugins/_ml/mcp" \
-H "Authorization: Basic <credentials>" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}'
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 POST "https://localhost:9200/_plugins/_ml/mcp" \
-H "Authorization: Basic $(echo -n 'username:password' | base64)" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}'
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.