YOLO MCP 后端
本目录是独立 Python 项目,源码包名为 backend。业务说明、前端运行和参考项目见仓库 README。
Web 服务
从本目录执行:
uv sync --python 3.11 --frozen --group test
cp .env.example .env
# 按需调整 DATA_DIR、USE_AUTO_LABEL 和 DEVICE;签名密钥首次启动时自动生成。
uv run --env-file .env uvicorn backend.main:app --host 127.0.0.1 --port 8002
yolo-mcp 也是服务 CLI 入口。模块导入和 --help 不初始化数据库,实际应用启动时通过 migrations/versions/001_init_db.py 初始化空库;默认 SQLite 文件名为 labels.sqlite。结构调整后使用新库,旧库不会自动迁移。不提供历史结构升级或 to_mysql。
DATA_DIR 默认指向用户主目录的 .yolo-mcp/。服务首次启动时在此目录生成 secret.key,后续启动读取同一密钥;数据库和项目文件也默认保存在此目录。
空库允许一次网页初始化管理员,完成后由管理员添加其他账号。个人令牌在网页管理,MCP 使用 Streamable HTTP /mcp 和 Authorization: Bearer <个人令牌>;不提供 OAuth 流程。项目拥有者管理配置和成员,协作者可以标注及训练,系统管理员管理全部项目。详细用法见用户权限与 MCP 接入。
训练与 AI 预标注
项目页可发起异步训练并查看状态、日志与产物,项目配置第 4 步选择 YOLO 算法和 AI 模型。训练代码位于 training/,离线入口为 yolo-mcp-train 或 python -m backend.training.train。默认 Web 依赖不包含 PyTorch/Ultralytics,需要时安装 .[training];优先复用已有 GPU 运行环境。安装和存储约定见训练说明。
服务与训练共用根目录的 Dockerfile,从仓库根目录构建:
docker build -t yolo-mcp:local .
验证
uv run --no-sync pytest
测试使用隔离 SQLite 和临时本地目录,不读取实际凭据。格式采用 Black(Python 3.11、88 列),核心链路同时执行 Flake8 检查。
uv run --no-sync black --check .
uv run --no-sync flake8 .
发行包
在完整仓库根目录执行 uv build --project backend --out-dir dist。构建钩子会运行 pnpm build:frontend,请先安装前端工作区依赖。生成的 wheel 和源码包均包含前端页面,安装后直接运行 yolo-mcp;从源码包构建 wheel 无需前端工具链。可编辑安装跳过构建钩子中的前端编译,开发时单独运行 Vite。
Metadata
Release files for yolo-mcp 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yolo_mcp-2.0.0.tar.gz | 1.4 MB | Without provenance | Details for yolo_mcp-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yolo_mcp-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for yolo_mcp-2.0.0-py3-none-any.whl |
Total release size: 3.7 MB
Release files / yolo_mcp-2.0.0.tar.gz
| Download URL | yolo_mcp-2.0.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b518c9405a2c2c1984ac1cdb9f2df4a5e7b842564947ed7430e555a0a8167dc2
|
|
BLAKE2b-256 checksum How to use checksums |
293e718e9e48d74e19d24abf63588e3d520775ec78be0418db7aad837679bd42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / yolo_mcp-2.0.0-py3-none-any.whl
| Download URL | yolo_mcp-2.0.0-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
813196a5e2b80cb6ce7a2c3fd017a47a8e81cf08db72904ed8ee0b34b5862069
|
|
BLAKE2b-256 checksum How to use checksums |
3048a07d77bdcaf5917dd8225673fa59f7706a0582578baff32551fb68c97235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for yolo-mcp 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.