A lightweight Model Context Protocol (MCP) server for the classic Iris dataset. This repository demonstrates how to build an interactive model service with resources, tools, and prompt templates using mcp[cli] and a trained scikit-learn classifier.
IrisMCPContextIrisMCP-IrisHubIrisBridgeIrisScope
This repository exposes an Iris flower classifier through MCP resources and tools. It includes:
- A trained Iris classification model backed by
scikit-learn - MCP resources for model metadata, schema, feature descriptions, and sample inputs
- MCP tools for prediction, explanation, batch prediction, and model training
- MCP prompts for generating analysis and comparison responses
model://info— model metadata and version detailsmodel://schema— input schema for prediction requestsmodel://features— feature descriptions for the Iris datasetmodel://classes— class information for each Iris speciespredict(...)— single-sample prediction endpointget_prediction_explanation(...)— explanation and confidence summarybatch_predict(...)— predict multiple samples from JSONtrain_model()— retrain and save the model- prompt templates for deeper analysis and comparison
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uv run python server.pyOr run with the MCP inspector:
npx @modelcontextprotocol/inspector uv run python server.py- Activate the virtual environment.
- Install dependencies.
- Launch
server.py. - Use MCP-compatible tools or the inspector to call resources, tools, and prompts.
server.py— MCP resource/tool definitions and server startupmodel.py— Iris classifier wrapper and persistence logicmodel_config.py— dataset schema, feature names, and descriptionsiris_model.joblib— serialized trained model filemain.ipynb— interactive exploration and development notebook
This project is a great starting point for any MCP-driven machine learning deployment. It shows how to combine a classic model with structured MCP interfaces, making the model accessible, explainable, and easy to extend.