Serveur MCP Hugging Face
Connectez les assistants IA au Hugging Face Hub. Configuration : https://huggingface.co/settings/mcp
Cas d'usage et exemples
Trouver le meilleur modèle pour une tâche
User: "Find the best model for code generation"
1. model_search(task="text-generation", query="code", sort="trendingScore", limit=10)
2. hub_repo_details(repo_ids=["top-result-id"], include_readme=true)
Comparer des modèles de différents fournisseurs
User: "Compare Llama vs Qwen for text generation"
1. model_search(author="meta-llama", task="text-generation", sort="downloads", limit=5)
2. model_search(author="Qwen", task="text-generation", sort="downloads", limit=5)
3. hub_repo_details(repo_ids=["meta-llama/Llama-3.2-1B", "Qwen/Qwen3-8B"], include_readme=true)
Trouver des datasets d'entraînement
User: "Find datasets for sentiment analysis in English"
1. dataset_search(query="sentiment", tags=["language:en", "task_categories:text-classification"], sort="downloads")
2. hub_repo_details(repo_ids=["top-dataset-id"], repo_type="dataset", include_readme=true)
Découvrir des outils IA (MCP Spaces)
User: "Find a tool that can remove image backgrounds"
1. space_search(query="background removal", mcp=true)
2. dynamic_space(operation="view_parameters", space_name="result-space-id")
3. dynamic_space(operation="invoke", space_name="result-space-id", parameters="{...}")
Générer des images
User: "Create an image of a robot reading a book"
1. dynamic_space(operation="discover") # See available tasks
2. gr1_flux1_schnell_infer(prompt="a robot sitting in a library reading a book, warm lighting, detailed")
Rechercher un sujet
User: "What are the latest papers on RLHF?"
1. paper_search(query="reinforcement learning from human feedback", results_limit=10)
2. hub_repo_details(repo_ids=["paper-linked-model"], include_readme=true) # If paper links to models
Apprendre à utiliser une bibliothèque
User: "How do I fine-tune with LoRA using PEFT?"
1. hf_doc_search(query="LoRA fine-tuning", product="peft")
2. hf_doc_fetch(doc_url="https://huggingface.co/docs/peft/...")
Exécuter un job GPU rapide
User: "Run this Python script on a GPU"
hf_jobs(operation="uv", args={
"script": "# /// script\n# dependencies = [\"torch\"]\n# ///\nimport torch\nprint(torch.cuda.is_available())",
"flavor": "t4-small"
})
Entraîner un modèle sur GPU cloud
User: "Run my training script on an A10G"
hf_jobs(operation="run", args={
"image": "pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime",
"command": ["/bin/sh", "-lc", "pip install transformers trl && python train.py"],
"flavor": "a10g-small",
"secrets": {"HF_TOKEN": "$HF_TOKEN"}
})
Vérifier le statut du job
User: "What's happening with my training job?"
1. hf_jobs(operation="ps")
2. hf_jobs(operation="logs", args={"job_id": "job-xxxxx"})
Explorer les tendances
User: "What models are trending right now?"
model_search(sort="trendingScore", limit=20)
Obtenir les détails de la carte modèle
User: "Tell me about Mistral-7B"
hub_repo_details(repo_ids=["mistralai/Mistral-7B-v0.1"], include_readme=true)
Trouver des modèles quantifiés
User: "Find GGUF versions of Llama 3"
model_search(query="Llama 3 GGUF", sort="downloads", limit=10)
Utiliser un Gradio Space comme outil
User: "Transcribe this audio file"
1. space_search(query="speech to text transcription", mcp=true)
2. dynamic_space(operation="view_parameters", space_name="openai/whisper")
3. dynamic_space(operation="invoke", space_name="openai/whisper", parameters="{\"audio\": \"...\"}")
Planifier des jobs récurrents
User: "Run this data sync every day at midnight"
hf_jobs(operation="scheduled uv", args={
"script": "...",
"cron": "0 0 * * *",
"flavor": "cpu-basic"
})
Guide de sélection des outils
| Objectif | Outil |
|---|---|
| Trouver des modèles | model_search |
| Trouver des datasets | dataset_search |
| Trouver des Spaces/apps | space_search |
| Trouver des articles | paper_search |
| Obtenir README/détails du dépôt | hub_repo_details |
| Apprendre l'utilisation d'une bibliothèque | hf_doc_search → hf_doc_fetch |
| Exécuter du code sur GPU/CPU | hf_jobs |
| Utiliser des apps Gradio comme outils | dynamic_space |
| Générer des images | gr1_flux1_schnell_infer ou dynamic_space |
| Vérifier l'authentification | hf_whoami |
Astuces
- Utilisez
sort="trendingScore"pour trouver ce qui est populaire maintenant - Utilisez
sort="downloads"pour trouver des options éprouvées - Définissez
mcp=truedansspace_searchpour trouver des Spaces utilisables comme outils - Utilisez
include_readme=truedanshub_repo_detailspour la documentation complète du modèle/dataset - Pour les jobs accédant à des dépôts privés, incluez toujours
secrets: {"HF_TOKEN": "$HF_TOKEN"} - Utilisez
dynamic_space(operation="discover")pour voir toutes les tâches disponibles basées sur les Spaces