ai-toolkit-mcp
The server lets an MCP client inspect and manage ai-toolkit datasets, captions, and LoRA training jobs through the ai-toolkit UI API.
Check connection status, GPUs/VRAM, queues, active jobs, and data folders.
List datasets and create datasets by uploading local files/folders.
Read and write per-image captions, and queue ai-toolkit’s built-in auto-captioner.
List jobs, get job status/config, and fetch a default job template.
Create jobs from YAML/JSON, clone an existing job, or apply dotted-path overrides; update stopped jobs.
Start/stop jobs, including forced stop, and trigger checkpoint saves or sample generation.
Monitor jobs with logs, loss-curve summaries, checkpoint/sample outputs, and latest sample images.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ai-toolkit-mcp train a LoRA on the rufus dataset, same settings as last run but 2000 steps"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ai-toolkit-mcp
An MCP server for ostris/ai-toolkit. It lets an AI agent in Griptape Nodes, Claude Code, Claude Desktop, or any other MCP client set up, launch, and monitor LoRA training runs on your own machine.
"Train a LoRA of my dog on the
rufusdataset, same settings as last week's run but 2000 steps. Check on it in a bit and show me the latest samples."
It talks to the ai-toolkit web UI's API, so every job it creates shows up in the UI, uses the UI's per-GPU queue, and appears on the UI's loss graph. You can switch between chatting and clicking at any time.
Requirements
ai-toolkit installed, with its UI running (
cd ai-toolkit/ui && npm run build_and_start, default address http://localhost:8675)
You don't need to clone this repo. uvx fetches and runs it.
Related MCP server: sd-api-mcp
Setup
Griptape Nodes
Open Settings → MCP Servers → + New MCP Server
Server Name/ID:
ai-toolkit, Connection Type:Local Process (stdio)Configuration JSON:
{ "transport": "stdio", "command": "uvx", "args": ["--from", "git+https://github.com/shhlife/ai-toolkit-mcp", "ai-toolkit-mcp"], "env": { "AI_TOOLKIT_URL": "http://localhost:8675" } }Enable the
ai-toolkitserver on an Agent node (or use it from an MCP Task node) and start asking.
This lets you build workflows like: generate or caption a dataset with Griptape nodes, have the Agent kick off training, then pull the finished LoRA back into a generation flow.
Claude Code
claude mcp add ai-toolkit -- uvx --from git+https://github.com/shhlife/ai-toolkit-mcp ai-toolkit-mcpClaude Desktop (or any MCP client using mcpServers JSON)
{
"mcpServers": {
"ai-toolkit": {
"command": "uvx",
"args": ["--from", "git+https://github.com/shhlife/ai-toolkit-mcp", "ai-toolkit-mcp"]
}
}
}Configuration
Env var | Default | Purpose |
|
| Where the ai-toolkit UI is running. Can point at another machine or a cloud GPU box. |
| unset | Set this if you started the UI with |
Tools
Tool | What it does |
| Best practices by topic: workflow, dataset, captions, models, settings, VRAM, monitoring, troubleshooting |
| Connection check: GPUs, VRAM, queues, active jobs, data folders |
| Dataset folders with full paths and file counts |
| Make a dataset (or add to one) from local files/folders, including existing caption |
| Read and write per-image captions |
| Queue ai-toolkit's built-in captioner (Qwen3-Omni) on a dataset |
| Jobs with status, step progress, speed, model |
| A job's full config as YAML |
| Every model your ai-toolkit install can train (read live from it), with preset names |
| New job from a model preset, YAML, or a clone of an existing job, plus dotted-path overrides like |
| Edit a stopped job, including switching its model preset |
| Queue or stop a job (graceful stop saves a checkpoint; |
| Ask a running job to save or sample now |
| Tail of the training log, without progress-bar noise |
| Loss curve summary (start/end/min, smoothed trend) |
| Checkpoint files and samples |
| Returns the latest sample images so the agent can see how training looks |
Read-only tools are marked as read-only, so clients with tool approval (Griptape Nodes, Claude) can
auto-approve them and only ask before anything that creates, starts, or stops a job. Nothing in this server
deletes jobs, datasets, or files (set_captions does overwrite the captions you give it).
create_dataset uploads through the UI's API rather than writing into ai-toolkit's folder directly, so it
works the same whether ai-toolkit is on your machine or a remote GPU box. ai-toolkit replaces spaces and
special characters in uploaded file names with _.
How agents learn best practices
training_guidereturns practical advice per topic. The tool descriptions tell agents to call it before planning a run, so this works in every MCP client. The text lives inguide.py; edit it as you learn what works.Model presets come from your ai-toolkit install's own model definitions, the same ones the UI's model dropdown uses, so new models show up automatically when you update ai-toolkit.
create_job/update_jobcheck the config and return warnings in plain language.The server also sends usage instructions when a client connects. Claude Code reads those; Griptape Nodes currently doesn't pass them to its agents, which is why the guide is a tool.
Reusing models you already downloaded
ai-toolkit keeps ComfyUI-format weights in its own models folder for many models and downloads them
there even when the model is already in your Hugging Face cache (LTX-2.5 always loads this way). When
ai-toolkit runs on the same machine as this server, create_job / update_job point the job at the
cached files instead and say so under using_hf_cache. Models that aren't cached get a warning before
anything starts. The cache location comes from HF_HUB_CACHE, HUGGINGFACE_HUB_CACHE, or HF_HOME.
Tips
create_job(model=...)applies the same settings the UI does when you pick a model. For edit models that need control images (Kontext, Qwen-Image-Edit), set one job up in the UI and have the agent clone it withbase_job.Per-model reference configs live in ai-toolkit's
config/examples/folder. You can paste one intocreate_job(config=...).
Development
uv sync
uv run pytest
uv run mcp dev src/ai_toolkit_mcp/server.py # MCP InspectorGriptape Nodes library (experimental)
The griptape_library/ folder is a Griptape Nodes library that exposes a subset of the tools (status, datasets,
models, jobs, job logs, start and stop) through the engine's own MCP server. It needs an engine that supports
AdvancedNodeLibrary.get_mcp_tools (griptape-nodes-engine#6035).
In Griptape Nodes, add
griptape_library/griptape_nodes_library.jsonfrom a checkout of this repo as a library.Add an MCP server pointing at
http://localhost:8125/mcp/libraries/ai_toolkit/(or usehttp://localhost:8125/mcp/?libraries=ai_toolkitfor the engine's tools plus these).
The handlers call the same functions as the standalone server, so results match.
License
Available Tools
19 toolsai_toolkit_statusARead-only
Connection check and machine overview: GPUs (VRAM, load), queues, active jobs, and data folders.
Inputs: no named parameters. Returns: result
auto_caption_datasetA
Queue ai-toolkit's built-in captioning job (Qwen3-Omni) for a dataset, like the UI's Caption button.
Only uncaptioned files are captioned unless recaption is set. prompt overrides the captioning
instruction; by default an image prompt is used for image-only datasets and ai-toolkit's video/audio
prompt otherwise. Uses GPU time and downloads the captioner model on first use. Track it with get_job.
Inputs: dataset (required), prompt, gpu_ids, recaption, +1 more. Returns: result
create_datasetA
Create a dataset (or add to an existing one) by uploading local files into ai-toolkit.
paths are files or folders on the machine running this MCP server; folders are searched recursively
for images, videos, audio, and matching caption files (e.g. photo1.jpg + photo1.txt). Files are sent
over the UI's API, so this also works when ai-toolkit runs on another machine.
Inputs: name (required), paths (required), caption_ext. Returns: result
create_jobA
Create a training job in the ai-toolkit UI.
Config source (pick one): config as YAML/JSON text (full job file or just its config: body),
or base_job (id/name) to clone an existing job's config. Neither = the default template.
overrides sets values inside config.process[0] by dotted path, e.g.
{"train.steps": 4000, "datasets.0.folder_path": "D:/datasets/me", "trigger_word": "ohwx",
"network.linear": 16, "sample.samples": [{"prompt": "ohwx at the beach"}]}.
gpu_ids is the GPU index (e.g. "0" or "0,1"). Set start to queue it immediately.
Inputs: name (required), start, config, gpu_ids, +2 more. Returns: result
get_captionsBRead-only
Captions for each file in a dataset (empty string = uncaptioned), plus a count of missing ones.
Inputs: dataset (required), limit, caption_ext. Returns: result
get_jobCRead-only
Status and progress of one job. job is a job id or name.
Inputs: job (required). Returns: result
get_job_configBRead-only
Full training config of a job as YAML. Useful as a starting point for a new run.
Inputs: job (required). Returns: result
get_job_logBRead-only
Last lines of a job's training log, with progress-bar noise collapsed.
Inputs: job (required), tail_lines. Returns: result
get_lossBRead-only
Loss curve summary: first/last/min values, a smoothed trend, and evenly spaced points.
Inputs: job (required), key, max_points. Returns: result
list_datasetsARead-only
List dataset folders in ai-toolkit's datasets folder, with full paths and file counts.
Use the path value as datasets.0.folder_path when creating a job.
Inputs: no named parameters. Returns: result
list_job_outputsBRead-only
Checkpoint (.safetensors) files and sample media produced by a job, as local paths.
Inputs: job (required). Returns: result
list_jobsBRead-only
List training jobs (newest first) with status, progress, and model.
Inputs: active_only. Returns: result
new_job_templateARead-only
The ai-toolkit UI's default job config (Flex.1 LoRA) as YAML, to edit and pass to create_job.
For other models, cloning a previous job with create_job(base_job=...) is more reliable, or see ai-toolkit's config/examples/*.yaml for per-model settings.
Inputs: no named parameters. Returns: result
set_captionsA
Write captions. captions maps a file name (as shown by get_captions) to its caption text;
existing captions for those files are replaced.
Inputs: dataset (required), captions (required), caption_ext. Returns: result
start_jobA
Queue a job and start its GPU queue. Resumes from the last checkpoint if one exists.
Inputs: job (required). Returns: result
stop_jobADestructive
Stop a job gracefully (saves a checkpoint first). force kills the process immediately,
only for jobs stuck and ignoring a normal stop.
Inputs: job (required), force. Returns: result
triggerA
Ask a running job to save a checkpoint or generate samples on its next step.
Inputs: job (required), action (required). Returns: result
update_jobA
Edit a job that isn't running: replace its config (YAML/JSON) and/or apply dotted-path overrides
inside config.process[0] (same format as create_job).
Inputs: job (required), config, gpu_ids, overrides. Returns: result
view_samplesBRead-only
Return the most recent sample images from a job so you can judge training progress visually.
Inputs: job (required), count.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools have distinct resource+action boundaries, but get_job_config and new_job_template both return starting-point YAML, and view_samples overlaps list_job_outputs in surfacing sample media. Descriptions clarify intended contexts, so misselection risk is low.
Predominantly snake_case verb_noun names (list_jobs, create_job, stop_job), with minor exceptions like trigger, ai_toolkit_status, and new_job_template that are verbless or namespaced nouns. The pattern is readable and mostly predictable.
19 tools across datasets, captions, job lifecycle, and monitoring is slightly heavy but each tool earns its place. It is not excessive for a server covering dataset preparation, captioning, job CRUD, and training monitoring.
Dataset and captioning flows are well covered (list/create, get/set/auto), and job lifecycle is rich (create/update/start/stop/trigger, logs/loss/outputs). Missing explicit delete operations for datasets/jobs and checkpoints, but core workflows have no dead ends.
Maintenance
Related MCP Connectors
Generate AI images and videos from your agent: list models, start jobs, and fetch the results.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Create AI images and videos, manage projects and credits, and use workspace campaign context.
AI-callable tools for API mocking, testing, monitoring, security, and automation.
Related MCP Servers
- FlicenseAqualityCmaintenanceEnables AI agents to connect to the NeuralForgeAI cluster for inspecting and controlling YOLO training jobs, including launching, monitoring, canceling studies, and verifying dataset paths.8-
- AlicenseAqualityCmaintenanceEnables AI agents to interact with a Stable Diffusion REST API for image generation, inpainting, model management, and merging.18GPL 3.0
- AlicenseAqualityBmaintenanceEnables AI agents to generate images on a local Stable Diffusion Forge Neo instance, automatically inferring prompt style and sampling parameters from the user's setup and past generations, and providing tools for LoRA search, model management, and module checks.101MIT
- AlicenseBqualityBmaintenanceEnables an agent to control a running ComfyUI instance by submitting workflows, running randomized batch generation with LoRA stacks and IP-Adapter blending, and reading back provenance for every generated image.1317 PyPIMIT