MLflow MCP 服务器:MLflow 的自然语言接口
该项目通过模型上下文协议 (MCP) 为 MLflow 提供自然语言接口。它允许您使用简单的英语查询 MLflow 跟踪服务器,从而更轻松地管理和探索您的机器学习实验和模型。
概述
MLflow MCP Agent由两个主要组件组成:
MLflow MCP 服务器(
mlflow_server.py
):连接到您的 MLflow 跟踪服务器并通过模型上下文协议 (MCP) 公开 MLflow 功能。MLflow MCP 客户端(
mlflow_client.py
):提供自然语言界面,使用对话式 AI 助手与 MLflow MCP 服务器进行交互。
特征
自然语言查询:用简单的英语询问有关 MLflow 跟踪服务器的问题
模型注册表探索:获取有关已注册模型的信息
实验跟踪:列出并探索您的实验和运行
系统信息:获取有关 MLflow 环境的状态和元数据
先决条件
Python 3.8+
MLflow 服务器正在运行(默认值:
http://localhost:8080
)LLM 的 OpenAI API 密钥
安装
克隆此存储库:
git clone https://github.com/iRahulPandey/mlflowMCPServer.git cd mlflowMCPServer创建虚拟环境:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate安装所需的软件包:
pip install mcp[cli] langchain-mcp-adapters langchain-openai langgraph mlflow设置您的 OpenAI API 密钥:
export OPENAI_API_KEY=your_key_here(可选)配置 MLflow 跟踪服务器 URI:
export MLFLOW_TRACKING_URI=http://localhost:8080
用法
启动 MCP 服务器
首先,启动 MLflow MCP 服务器:
该服务器连接到您的 MLflow 跟踪服务器并通过 MCP 公开 MLflow 功能。
进行查询
服务器运行后,您可以使用客户端进行自然语言查询:
示例查询:
“显示 MLflow 中所有已注册的模型”
“列出我的所有实验”
“获取名为‘iris-classifier’的模型的详细信息”
“我的 MLflow 服务器的状态如何?”
配置
您可以使用环境变量自定义行为:
MLFLOW_TRACKING_URI
:MLflow 跟踪服务器的 URI(默认值:http://localhost:8080
)OPENAI_API_KEY
:您的 OpenAI API 密钥MODEL_NAME
:要使用的 OpenAI 模型(默认值:gpt-3.5-turbo-0125
)MLFLOW_SERVER_SCRIPT
:MLflow MCP 服务器脚本的路径(默认值:mlflow_server.py
)LOG_LEVEL
:日志级别(默认值:INFO
)
MLflow MCP 服务器( mlflow_server.py
)
该服务器连接到您的 MLflow 跟踪服务器并通过 MCP 公开以下工具:
list_models
:列出 MLflow 模型注册表中所有已注册的模型list_experiments
:列出 MLflow 跟踪服务器中的所有实验get_model_details
:获取特定注册模型的详细信息get_system_info
:获取有关 MLflow 跟踪服务器和系统的信息
限制
目前仅支持 MLflow 的部分功能
客户端需要互联网访问才能使用 OpenAI 模型
对于复杂的 MLflow 操作,错误处理可能会受到限制
未来的改进
添加对 MLflow 模型预测的支持
提高对更复杂查询的自然语言理解
添加指标和参数的可视化功能
支持更多 MLflow 操作,例如运行管理和工件处理
致谢
模型上下文协议(MCP) :用于协议规范
LangChain :用于代理框架
MLflow :用于跟踪和模型注册功能
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
MLflow 的自然语言界面,允许用户通过模型上下文协议使用简单的英语查询和管理他们的机器学习实验和模型。
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to interact with n8n workflows through natural language, supporting actions like listing, creating, updating, executing and monitoring workflows.Last updated -1491,337MIT License
- AsecurityAlicenseAqualityEnables querying documents through a Langflow backend using natural language questions, providing an interface to interact with Langflow document Q\&A flows.Last updated -114MIT License
- -securityAlicense-qualityA Model Context Protocol Server that enables LLMs to interact with and execute REST API calls through natural language prompts, supporting GET/PUT/POST/PATCH operations on configured APIs.Last updated -6Apache 2.0
- -securityFlicense-qualityA simple application demonstrating Model Context Protocol (MCP) integration with FastAPI and Streamlit, allowing users to interact with LLMs through a clean interface.Last updated -3