Unsloth MCP Server
The Unsloth MCP Server enables efficient LLM fine-tuning and inference, leveraging Unsloth optimizations for 2x faster training and 80% less memory usage.
Check Installation (
check_installation): Verify whether Unsloth is properly installed on your system.List Supported Models (
list_supported_models): Retrieve all models supported by Unsloth, including Llama, Mistral, Phi, and Gemma variants.Load a Model (
load_model): Load a pretrained model with options for 4-bit quantization, custom sequence length, and gradient checkpointing.Fine-tune a Model (
finetune_model): Fine-tune using LoRA/QLoRA on a custom dataset, with configurable learning rate, batch size, LoRA rank/alpha, and gradient accumulation steps.Generate Text (
generate_text): Run inference with a fine-tuned model, controlling output via max tokens, temperature, and top-p sampling.Export a Model (
export_model): Export fine-tuned models to deployment-ready formats — GGUF, Ollama, vLLM, or Hugging Face — with optional quantization settings.
Enables loading, fine-tuning, and using models from Hugging Face, with optional authentication via HUGGINGFACE_TOKEN for accessing private models and datasets.
Requires Node.js for running the MCP server and handling API requests to the Unsloth optimization library.
Utilizes NVIDIA GPUs with CUDA support for accelerated model training and inference, with custom CUDA kernels for performance optimization.
Supports exporting fine-tuned models to Ollama format for local deployment and inference.
Uses OpenAI's Triton language for custom CUDA kernels that optimize model performance.
Leverages Python for model training and inference operations, with specific version requirements (3.10-3.12) for compatibility.
Uses PyTorch as the underlying framework for model operations, with optimizations for faster training and reduced memory usage.
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., "@Unsloth MCP Server load the Llama-3.2-1B model with 4-bit quantization for fine-tuning"
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.
Unsloth MCP Server
An MCP server for Unsloth - a library that makes LLM fine-tuning 2x faster with 80% less memory.
What is Unsloth?
Unsloth is a library that dramatically improves the efficiency of fine-tuning large language models:
Speed: 2x faster fine-tuning compared to standard methods
Memory: 80% less VRAM usage, allowing fine-tuning of larger models on consumer GPUs
Context Length: Up to 13x longer context lengths (e.g., 89K tokens for Llama 3.3 on 80GB GPUs)
Accuracy: No loss in model quality or performance
Unsloth achieves these improvements through custom CUDA kernels written in OpenAI's Triton language, optimized backpropagation, and dynamic 4-bit quantization.
Related MCP server: genpark-int8-symmetric-per-tensor-quantizer-skill
Features
Optimize fine-tuning for Llama, Mistral, Phi, Gemma, and other models
4-bit quantization for efficient training
Extended context length support
Simple API for model loading, fine-tuning, and inference
Export to various formats (GGUF, Hugging Face, etc.)
Installation
Current state: install from source (below). The package is prepared for npm (
name,bin,server.jsonregistry manifest are in place) but is not yet published — thenpx-based config in the next section works only after the npm publish lands.
Install Unsloth on the machine that will run the fine-tuning:
pip install unslothBuild the server from source:
git clone https://github.com/OtotaO/unsloth-mcp-server.git cd unsloth-mcp-server npm install npm run buildPoint your MCP client (Claude Desktop, Claude Code, Cline, Cursor, …) at the built entrypoint:
{ "mcpServers": { "unsloth": { "command": "node", "args": ["/path/to/unsloth-mcp-server/build/index.js"], "env": { "HUGGINGFACE_TOKEN": "your_token_here" } } } }HUGGINGFACE_TOKENis optional (only needed for gated/private models). Omit theenvblock if you don't use one.
After npm publish (planned)
Once published to npm as unsloth-mcp-server, the same clients can run it over stdio via npx with no clone/build:
{
"mcpServers": {
"unsloth": {
"command": "npx",
"args": ["-y", "unsloth-mcp-server"],
"env": { "HUGGINGFACE_TOKEN": "your_token_here" }
}
}
}For Claude Code: claude mcp add unsloth -- npx -y unsloth-mcp-server
Available Tools
check_installation
Verify if Unsloth is properly installed on your system.
Parameters: None
Example:
const result = await use_mcp_tool({
server_name: "unsloth",
tool_name: "check_installation",
arguments: {}
});list_supported_models
Get a list of all models supported by Unsloth, including Llama, Mistral, Phi, and Gemma variants.
Parameters: None
Example:
const result = await use_mcp_tool({
server_name: "unsloth",
tool_name: "list_supported_models",
arguments: {}
});load_model
Load a pretrained model with Unsloth optimizations for faster inference and fine-tuning.
Parameters:
model_name(required): Name of the model to load (e.g., "unsloth/Llama-3.2-1B")max_seq_length(optional): Maximum sequence length for the model (default: 2048)load_in_4bit(optional): Whether to load the model in 4-bit quantization (default: true)use_gradient_checkpointing(optional): Whether to use gradient checkpointing to save memory (default: true)
Example:
const result = await use_mcp_tool({
server_name: "unsloth",
tool_name: "load_model",
arguments: {
model_name: "unsloth/Llama-3.2-1B",
max_seq_length: 4096,
load_in_4bit: true
}
});finetune_model
Fine-tune a model with Unsloth optimizations using LoRA/QLoRA techniques.
Parameters:
model_name(required): Name of the model to fine-tunedataset_name(required): Name of the dataset to use for fine-tuningoutput_dir(required): Directory to save the fine-tuned modelmax_seq_length(optional): Maximum sequence length for training (default: 2048)lora_rank(optional): Rank for LoRA fine-tuning (default: 16)lora_alpha(optional): Alpha for LoRA fine-tuning (default: 16)batch_size(optional): Batch size for training (default: 2)gradient_accumulation_steps(optional): Number of gradient accumulation steps (default: 4)learning_rate(optional): Learning rate for training (default: 2e-4)max_steps(optional): Maximum number of training steps (default: 100)dataset_text_field(optional): Field in the dataset containing the text (default: 'text')load_in_4bit(optional): Whether to use 4-bit quantization (default: true)
Example:
const result = await use_mcp_tool({
server_name: "unsloth",
tool_name: "finetune_model",
arguments: {
model_name: "unsloth/Llama-3.2-1B",
dataset_name: "tatsu-lab/alpaca",
output_dir: "./fine-tuned-model",
max_steps: 100,
batch_size: 2,
learning_rate: 2e-4
}
});generate_text
Generate text using a fine-tuned Unsloth model.
Parameters:
model_path(required): Path to the fine-tuned modelprompt(required): Prompt for text generationmax_new_tokens(optional): Maximum number of tokens to generate (default: 256)temperature(optional): Temperature for text generation (default: 0.7)top_p(optional): Top-p for text generation (default: 0.9)
Example:
const result = await use_mcp_tool({
server_name: "unsloth",
tool_name: "generate_text",
arguments: {
model_path: "./fine-tuned-model",
prompt: "Write a short story about a robot learning to paint:",
max_new_tokens: 512,
temperature: 0.8
}
});export_model
Export a fine-tuned Unsloth model to various formats for deployment.
Parameters:
model_path(required): Path to the fine-tuned modelexport_format(required): Format to export to (gguf, ollama, vllm, huggingface)output_path(required): Path to save the exported modelquantization_bits(optional): Bits for quantization (for GGUF export) (default: 4)
Example:
const result = await use_mcp_tool({
server_name: "unsloth",
tool_name: "export_model",
arguments: {
model_path: "./fine-tuned-model",
export_format: "gguf",
output_path: "./exported-model.gguf",
quantization_bits: 4
}
});Advanced Usage
Custom Datasets
You can use custom datasets by formatting them properly and hosting them on Hugging Face or providing a local path:
const result = await use_mcp_tool({
server_name: "unsloth",
tool_name: "finetune_model",
arguments: {
model_name: "unsloth/Llama-3.2-1B",
dataset_name: "json",
data_files: {"train": "path/to/your/data.json"},
output_dir: "./fine-tuned-model"
}
});Memory Optimization
For large models on limited hardware:
Reduce batch size and increase gradient accumulation steps
Use 4-bit quantization
Enable gradient checkpointing
Reduce sequence length if possible
Troubleshooting
Common Issues
CUDA Out of Memory: Reduce batch size, use 4-bit quantization, or try a smaller model
Import Errors: Ensure you have the correct versions of torch, transformers, and unsloth installed
Model Not Found: Check that you're using a supported model name or have access to private models
Version Compatibility
Python: 3.10, 3.11, or 3.12 (not 3.13)
CUDA: 11.8 or 12.1+ recommended
PyTorch: 2.0+ recommended
Performance Benchmarks
Model | VRAM | Unsloth Speed | VRAM Reduction | Context Length |
Llama 3.3 (70B) | 80GB | 2x faster | >75% | 13x longer |
Llama 3.1 (8B) | 80GB | 2x faster | >70% | 12x longer |
Mistral v0.3 (7B) | 80GB | 2.2x faster | 75% less | - |
Requirements
Python 3.10-3.12
NVIDIA GPU with CUDA support (recommended)
Node.js and npm
License
Apache-2.0
Available Tools
6 toolscheck_installationB
Check if Unsloth is properly installed
Inputs: no named parameters.
export_modelB
Export a fine-tuned Unsloth model to various formats
Inputs: model_path (required), export_format (required), output_path (required), quantization_bits.
finetune_modelC
Fine-tune a model with Unsloth optimizations
Inputs: model_name (required), dataset_name (required), output_dir (required), max_seq_length, +8 more.
generate_textC
Generate text using a fine-tuned Unsloth model
Inputs: model_path (required), prompt (required), max_new_tokens, temperature, +1 more.
list_supported_modelsB
List all models supported by Unsloth
Inputs: no named parameters.
load_modelC
Load a pretrained model with Unsloth optimizations
Inputs: model_name (required), max_seq_length, load_in_4bit, use_gradient_checkpointing.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: checking installation, listing models, loading models, fine-tuning, generating text, and exporting models. The descriptions make it unambiguous which tool to use for each step in the workflow.
All tools follow a consistent verb_noun pattern with clear, descriptive names (e.g., check_installation, export_model, finetune_model). There are no deviations in naming conventions or style mixing.
With 6 tools, this server is well-scoped for its purpose of fine-tuning and using models with Unsloth optimizations. Each tool earns its place by covering a distinct, essential operation in the model lifecycle.
The tool set provides complete coverage for the domain: from checking prerequisites and listing models, through loading, fine-tuning, and generating text, to exporting the final model. There are no obvious gaps or dead ends in the workflow.
Maintenance
Related MCP Connectors
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
33 tools: LLM chat, summaries, translation, embeddings, speech, images. From $0.002.
Turn any LLM multimodal; generate images, voices, videos, 3D models, music, and more.
Rent GPUs at live prices and serve any Hugging Face model, with spend caps for AI agents.
Related MCP Servers
- AlicenseAqualityAmaintenanceOwn your sovereign AI model. Domain-specific fine-tuning of open-source LLMs and SLMs with total control and zero infrastructure hassle. Tuning Engines provides specialized tuning agents to tailor top open models to your needs — fast, predictable, fully delivered. Fine-tune Qwen, Llama, DeepSeek, Mistral, Gemma, Phi, StarCoder, and CodeLlama models from 1B to 72B parameters on your data via CLI o38184 npm6MIT
- AlicenseNot gradedqualityBmaintenanceEnables zero-dependency INT8 symmetric quantization of LLM weights and activations on a per-tensor or per-channel basis, reporting SNR and MSE reconstruction telemetry along with TTFT/TPOT latency and jitter metrics. Also exposes edge inference primitives such as PagedAttention block allocation, radix prefix caching, and speculative decoding verification through the Model Context Protocol.7MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to manage LLM inference memory through virtual paged-attention KV-cache block mapping, non-contiguous physical page allocation, zero-copy fragmentation tracking, radix-trie prefix caching, INT8 quantized compute, and speculative decoding verification. It also exposes prefill and decode latency telemetry so edge deployments can be benchmarked and tuned without external dependencies.7MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables profiling and optimizing edge and on-device LLM inference by measuring TTFT, TPOT, tokens/second throughput, and P50/P90/P99 jitter while providing standard-library primitives for quantization, paged attention, speculative decoding, and prefix caching.MIT