MCP Server + Flight + XGBoost
A demonstration of integrating machine learning models with Claude using the Model Control Protocol (MCP) server
Overview
In this example, we’ll create:
- A Claude integration with MCP server that can access the sentiment analysis capabilities
- A sentiment analysis model server using Arrow Flight using UDFs with xorq
- a XGBoost UDF with pre-trained model that will be served by Flight
This pattern enables AI assistants like Claude to access specialized machine learning models while maintaining a conversational interface, expanding Claude’s capabilities beyond its training data.
Demo
Watch this demonstration of the MCP server with Claude in action:
Try It Yourself
The complete source code for this example is available in the xorq GitHub repository: mcp_flight_server.py
How It Works
-
MCP Server: The example initializes a specialized Flight server with a Model Control Protocol (MCP) server. This provides a standardized way for Claude to interact with the ML model.
-
Flight Service: The server loads two pre-trained models:
- A TF-IDF vectorizer to transform text data
- An XGBoost regression model trained to predict sentiment scores
-
Input/Output Mappers: Custom functions translate between Claude’s natural language requests and the ML model’s required format, then transform the model outputs back into a Claude-friendly response.
Next Steps
Try modifying this example to:
- Create a more complex input mapping to handle various types of user queries