返回市场
标签工作室MCP服务器

标签工作室MCP服务器

作者:HumanSignal24 星标更新:2025-05-30

项目介绍

Label Studio MCP 服务器

概述

此项目提供了一个模型上下文协议(MCP)服务器,允许通过 label-studio-sdkLabel Studio 实例进行交互。它支持通过自然语言或结构化调用从 MCP 客户端对标注项目、任务和预测进行程序化管理。使用此 MCP 服务器,您可以执行如下请求:

  • “在 Label Studio 中创建一个带有这些数据的项目...”
  • “我的 RAG 审查项目中有多少任务已被标注?”
  • “为我的任务添加预测。”
  • “更新我的标注模板以包含评论框。”

Label Studio MCP 服务器示例用法

功能

  • 项目管理:创建、更新、列出并查看 Label Studio 项目的详细信息/配置。
  • 任务管理:从文件导入任务,在项目中列出任务,并检索任务数据/注释。
  • 预测集成:向特定任务添加模型预测。
  • SDK 集成:利用官方的 label-studio-sdk 进行通信。

先决条件

  1. 运行中的 Label Studio 实例:您需要一个可以从该 MCP 服务器运行位置访问的 Label Studio 实例。
  2. API 密钥:从您的 Label Studio 用户账户设置中获取 API 密钥。

配置

MCP 服务器需要 您的 Label Studio 实例的 URL 和 API 密钥。如果通过 MCP 客户端配置文件启动服务器,可以在服务器定义中直接指定环境变量。这通常适用于客户端管理的服务器。

在您的 claude_desktop_config.json 文件或 Cursor MCP 设置中添加以下 JSON 条目:

{
    "mcpServers": {
        "label-studio": {
            "command": "uvx",
            "args": [
                "--from",
                "git+https://github.com/HumanSignal/label-studio-mcp-server",
                "mcp-label-studio"
            ],
            "env": {
                "LABEL_STUDIO_API_KEY": "your_actual_api_key_here", // <-- 您的 API 密钥
                "LABEL_STUDIO_URL": "http://localhost:8080"
            }
        }
    }
}

工具

MCP 服务器提供了以下工具:

项目管理

  • get_label_studio_projects_tool():列出可用项目(ID、标题、任务数量)。
  • get_label_studio_project_details_tool(project_id: int):检索特定项目的详细信息。
  • get_label_studio_project_config_tool(project_id: int):获取项目的 XML 标注配置。
  • create_label_studio_project_tool(title: str, label_config: str, ...):创建一个新的项目,包括标题、XML 配置和可选设置。返回项目详情,包括 URL。
  • update_label_studio_project_config_tool(project_id: int, new_label_config: str):更新现有项目的 XML 标注配置。

任务管理

  • list_label_studio_project_tasks_tool(project_id: int):列出项目中的任务 ID(最多 100 个)。
  • get_label_studio_task_data_tool(project_id: int, task_id: int):检索特定任务的数据负载。
  • get_label_studio_task_annotations_tool(project_id: int, task_id: int):获取特定任务的现有注释。
  • import_label_studio_project_tasks_tool(project_id: int, tasks_file_path: str):从 JSON 文件(包含任务对象列表)导入任务到项目中。返回导入摘要和项目 URL。

预测

  • create_label_studio_prediction_tool(task_id: int, result: List[Dict[str, Any]], ...):为特定任务创建预测。需要预测结果作为符合 Label Studio 格式的字典列表。可选参数 model_versionscore

示例用例

  1. 使用 create_label_studio_project_tool 创建新项目。
  2. 准备一个包含任务数据的 JSON 文件(tasks.json)。
  3. 使用 import_label_studio_project_tasks_tool 导入任务,提供步骤 1 中的项目 ID 和 tasks.json 的路径。
  4. 使用 list_label_studio_project_tasks_tool 列出任务 ID。
  5. 使用 get_label_studio_task_data_tool 获取特定任务的数据。
  6. 生成预测结果结构(字典列表)。
  7. 使用 create_label_studio_prediction_tool 添加预测。

联系方式

如有问题或需要支持,请通过 GitHub Issues 联系我们。