원클릭으로
unsloth-mcp-server
// Work with the Unsloth MCP Server codebase. Use when maintaining, extending, or debugging this specific MCP server implementation. Provides architecture knowledge, code patterns, and development workflows.
// Work with the Unsloth MCP Server codebase. Use when maintaining, extending, or debugging this specific MCP server implementation. Provides architecture knowledge, code patterns, and development workflows.
Self-learning workflow system that tracks what works best for your use cases. Records experiment results, suggests optimizations, creates custom templates, and builds a personal knowledge base. Use to learn from experience and optimize your LLM workflows over time.
Create, clean, and optimize datasets for LLM fine-tuning. Covers formats (Alpaca, ShareGPT, ChatML), synthetic data generation, quality assessment, and augmentation. Use when preparing data for training.
Export and deploy fine-tuned models to production. Covers GGUF/Ollama, vLLM, HuggingFace Hub, Docker, quantization, and platform selection. Use after fine-tuning when you need to deploy models efficiently.
Advanced techniques for optimizing LLM fine-tuning. Covers learning rates, LoRA configuration, batch sizes, gradient strategies, hyperparameter tuning, and monitoring. Use when fine-tuning models for best performance.
Train and use SuperBPE tokenizers for 20-33% token reduction across any project. Covers training, optimization, validation, and integration with any LLM framework. Use when you need efficient tokenization, want to reduce API costs, or maximize context windows.
Analyze, compare, and work with tokenizers using Unsloth tools. Compare different tokenizers, analyze token efficiency, and integrate with Unsloth models. For SuperBPE training, see the 'superbpe' skill.
| name | unsloth-mcp-server |
| description | Work with the Unsloth MCP Server codebase. Use when maintaining, extending, or debugging this specific MCP server implementation. Provides architecture knowledge, code patterns, and development workflows. |
Project-specific guidance for the Unsloth MCP Server codebase.
A production-ready MCP (Model Context Protocol) server that enables Claude to fine-tune LLMs using Unsloth.
Location: /home/user/unsloth-mcp-server
Key Stats:
src/
├── index.ts # Main MCP server (1414 lines)
├── cli.ts # CLI tool (245 lines)
├── utils/ # Utility modules
│ ├── logger.ts # Winston logging
│ ├── validation.ts # Input validation
│ ├── security.ts # Security controls
│ ├── metrics.ts # Performance tracking
│ ├── config.ts # Configuration system
│ ├── cache.ts # Dual-layer cache
│ └── progress.ts # Progress tracking
└── __tests__/ # Test suites
├── validation.test.ts
├── security.test.ts
├── metrics.test.ts
├── cache.test.ts
├── config.test.ts
├── progress.test.ts
└── integration.test.ts
npm test # All tests
npm test:watch # Watch mode
npm test:coverage # With coverage
npm test -- integration # Just integration tests
npm run build # Compile TypeScript
npm run lint # Type check + ESLint
npm run lint:fix # Auto-fix issues
npm run format # Format with Prettier
npm run bench # Run performance benchmarks
npm run bench:compare baseline.json results.json # Compare
npm run cli help # Show help
npm run cli check # Check installation
npm run cli models # List models
npm run cli config # Show config
npm run cli metrics # Show metrics
src/utils/validation.ts:case 'your_new_tool':
validators.requiredField(args, 'required_param');
validators.optionalPositive(args, 'optional_param', 'Optional param');
break;
src/index.ts (ListToolsRequestSchema):{
name: 'your_new_tool',
description: 'Clear description of what it does',
inputSchema: {
type: 'object',
properties: {
required_param: {
type: 'string',
description: 'Parameter description'
}
},
required: ['required_param']
}
}
src/index.ts (CallToolRequestSchema):case 'your_new_tool': {
const { required_param } = args as { required_param: string };
const script = `
import json
try:
# Your Python code here
result = {"success": True}
print(json.dumps(result))
except Exception as e:
print(json.dumps({"error": str(e)}))
`;
const result = await this.executeUnslothScript(script);
return this.createSuccessResponse(name, startTime, result);
}
src/__tests__/validation.test.ts:describe('your_new_tool', () => {
it('should validate required parameters', () => {
expect(() =>
validateToolInputs('your_new_tool', {
required_param: 'value',
})
).not.toThrow();
});
it('should reject missing parameters', () => {
expect(() => validateToolInputs('your_new_tool', {})).toThrow('required_param is required');
});
});
import logger from './utils/logger.js';
logger.info('Operation started', { param: value });
logger.debug('Debug info', { details });
logger.error('Error occurred', { error: err.message });
import { cache } from './utils/cache.js';
// Check cache first
const cached = cache.get<ModelList>('models');
if (cached) return cached;
// Compute and cache
const models = await loadModels();
cache.set('models', models, 3600); // 1 hour TTL
import { metricsCollector } from './utils/metrics.js';
const startTime = Date.now();
// ... operation ...
metricsCollector.endTool('tool_name', startTime, true);
const stats = metricsCollector.getStats('tool_name');
import { config } from './utils/config.js';
const serverConfig = config.get();
const cacheEnabled = serverConfig.cache.enabled;
Config files (priority order):
UNSLOTH_*)./config.json~/.unsloth-mcp-config.jsonExample config.json:
{
"cache": {
"enabled": true,
"ttl": 3600,
"maxSize": 1000
},
"logging": {
"level": "info"
}
}
package.json versionsrc/index.ts version (2 places)CHANGELOG.mdfeat: bump version to X.Y.Zsrc/utils/your-utility.tssrc/__tests__/your-utility.test.tssrc/index.tsnpm run benchGitHub Actions runs on every push/PR:
Pre-commit hooks (Husky):
| Operation | Target | Actual |
|---|---|---|
| Validation | <0.01ms | ✅ 0.005ms |
| Cache Get | <0.01ms | ✅ 0.010ms |
| Cache Set | <0.02ms | ✅ 0.015ms |
| Config Get | <0.005ms | ✅ 0.005ms |
| Metrics | <0.01ms | ✅ 0.010ms |
docker-compose build
docker-compose up unsloth-mcp
npm install
npm run build
npm start
{
"mcpServers": {
"unsloth-server": {
"command": "node",
"args": ["/path/to/build/index.js"],
"env": {
"HUGGINGFACE_TOKEN": "your_token"
}
}
}
}
npm install againrm -rf .cache/npm run lint to see TypeScript errorstsconfig.json is valid.jsnpm run prepare.husky/pre-commit existschmod +x .husky/pre-commit# Development
npm run dev # Run in dev mode
npm run cli check # Test CLI
# Testing
npm test # Run all tests
npm run lint # Check types and lint
# Building
npm run build # Build for production
# Benchmarking
npm run bench # Run benchmarks
# Formatting
npm run format # Format all files
npm test for examples