
HuggingMCP
A Model Context Protocol server that allows Claude and other MCP-compatible AI assistants to interact with the Hugging Face ecosystem, enabling repository management, file operations, search, and collections management through natural language.
README
🤗 HuggingMCP - Hugging Face Model Context Protocol Server
Give Claude superpowers with Hugging Face! 🚀
HuggingMCP is a comprehensive Model Context Protocol (MCP) server that allows Claude and other MCP-compatible AI assistants to interact seamlessly with the Hugging Face ecosystem. Create models, manage datasets, edit files, organize collections, and much more - all through natural language!
✨ Features
🏗️ Repository Management
- Create repositories (models, datasets, spaces) with custom settings
- Delete repositories (admin mode required)
- Get detailed repository information and metadata
- List repository files and directory structures
📝 Advanced File Operations
- Read files from any Hugging Face repository (public/private)
- Write/upload files with custom content
- Precise file editing with exact text replacement (old_text → new_text)
- Delete files from repositories
- Binary file support for non-text files
🔍 Search & Discovery
- Search models with filters (author, tags, popularity)
- Search datasets across all of Hugging Face
- Search Spaces and demo applications
- Advanced filtering by downloads, likes, creation date
- Comprehensive metadata for all results
📚 Collections Management
- Create collections to organize repositories
- Add items to collections (models, datasets, spaces, papers)
- Manage collection metadata and descriptions
- Get collection information and item lists
🔒 Security & Permissions
- Token-based authentication with Hugging Face
- Permission controls: read-only, write-only, admin modes
- File size limits to prevent abuse
- Comprehensive error handling
🚀 Quick Start
Prerequisites
- Python 3.10+ installed on your system
- Claude Desktop application (Download here)
- Hugging Face account and access token (Get token here)
Installation
- Create a project directory:
mkdir huggingmcp && cd huggingmcp
-
Save the main.py file from the artifact in your project directory
-
Install dependencies:
# Install uv package manager (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv add "mcp[cli]" huggingface_hub
Configuration
-
Open Claude Desktop settings:
- Go to Settings → Developer
- Click "Edit Config" to open
claude_desktop_config.json
-
Add HuggingMCP configuration:
{
"mcpServers": {
"huggingmcp": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/YOUR/huggingmcp",
"run",
"main.py"
],
"env": {
"HF_TOKEN": "your-hf-token-here",
"HF_ADMIN_MODE": "true",
"HF_READ_ONLY": "false",
"HF_WRITE_ONLY": "false",
"HF_MAX_FILE_SIZE": "100000000"
}
}
}
}
Important: Replace /ABSOLUTE/PATH/TO/YOUR/huggingmcp
with the actual absolute path to your project directory.
Environment Variables:
HF_TOKEN
: Your Hugging Face access token (required)HF_READ_ONLY
: Set to "true" to allow only read operations (optional)HF_WRITE_ONLY
: Set to "true" to allow only write operations (optional)HF_ADMIN_MODE
: Set to "true" to enable repository deletion (optional)HF_MAX_FILE_SIZE
: Maximum file size in bytes (optional)
-
Restart Claude Desktop to load the MCP server
-
Verify connection: Look for the 🔨 hammer icon in Claude Desktop, indicating MCP tools are available.
🎯 Usage Examples
Once connected, you can use natural language to interact with Hugging Face:
🏗️ Repository Operations
"Create a new model repository called 'my-awesome-model' with a custom README"
"Show me information about the 'microsoft/DialoGPT-medium' model"
"List all files in the 'squad' dataset repository"
"Delete my test repository (admin mode required)"
📝 File Management
"Read the README.md file from 'gpt2' model repository"
"Create a new config.json file in my model repo with these settings: {...}"
"Edit the training script and replace 'learning_rate=0.001' with 'learning_rate=0.0001'"
"Delete the old_model.bin file from my repository"
🔍 Search & Discovery
"Find the top 10 most downloaded text classification models"
"Search for datasets related to sentiment analysis by huggingface"
"Show me recent Gradio spaces for image generation"
"Find models tagged with 'pytorch' and 'transformer'"
📚 Collections
"Create a new collection called 'My Favorite Models'"
"Add the 'bert-base-uncased' model to my collection with a note"
"Show me all items in the 'best-nlp-models' collection"
🛡️ Security & Permissions
HuggingMCP includes comprehensive permission controls:
Permission Modes
Mode | Description | Use Case |
---|---|---|
Default | Full read/write access | Development and experimentation |
Read Only | Can only read repositories and files | Safe exploration mode |
Write Only | Can only create/modify (no deletion) | Content creation workflows |
Admin Mode | Full access including deletion | Advanced repository management |
Setting Permissions
Via Environment Variables:
export HF_READ_ONLY=true # Enable read-only mode
export HF_WRITE_ONLY=true # Enable write-only mode
export HF_ADMIN_MODE=true # Enable admin mode
Via Claude Commands:
"Set HuggingMCP to read-only mode"
"Enable admin mode for repository deletion"
"Show me my current permissions"
🧩 Available Tools
HuggingMCP exposes the following tools to Claude:
Configuration & Testing
hf_test
- Test server functionality and connectionget_hf_config
- Get current configuration and capabilitieshf_whoami
- Get current authenticated user info
Repository Management
hf_create_repository
- Create new repos (models/datasets/spaces)hf_delete_repository
- Delete repos (admin mode required)hf_get_repository_info
- Get repo metadata and detailshf_list_repository_files
- List all files in a repository
File Operations
hf_read_file
- Read file content from repositorieshf_write_file
- Write/upload files to repositorieshf_edit_file
- Precise text replacement editinghf_delete_file
- Delete specific files from repositories
Search & Discovery
hf_search_models
- Search Hugging Face modelshf_search_datasets
- Search Hugging Face datasetshf_search_spaces
- Search Hugging Face Spaces
Collections
hf_collection_create
- Create new collectionshf_collection_add
- Add items to collectionshf_collection_info
- Get collection details and items
🔧 Configuration Options
Environment Variables
Variable | Default | Description |
---|---|---|
HF_TOKEN |
None | Your Hugging Face access token (required) |
HF_READ_ONLY |
false | Enable read-only mode |
HF_WRITE_ONLY |
false | Enable write-only mode |
HF_ADMIN_MODE |
false | Enable admin operations (repository deletion) |
HF_MAX_FILE_SIZE |
100000000 | Maximum file size in bytes (100MB default) |
Claude Desktop Config
Basic Configuration:
{
"mcpServers": {
"huggingmcp": {
"command": "python",
"args": ["/path/to/main.py"],
"env": {
"HF_TOKEN": "your-hf-token-here"
}
}
}
}
Advanced Configuration:
{
"mcpServers": {
"huggingmcp": {
"command": "uv",
"args": [
"--directory", "/path/to/huggingmcp",
"run", "main.py"
],
"env": {
"HF_TOKEN": "your-hf-token-here",
"HF_ADMIN_MODE": "true",
"HF_READ_ONLY": "false",
"HF_WRITE_ONLY": "false",
"HF_MAX_FILE_SIZE": "100000000"
}
}
}
}
🐛 Troubleshooting
Common Issues
1. "Connection failed" in Claude Desktop
- Verify the absolute path in your config is correct
- Check that
main.py
exists in the specified directory - Ensure Python/uv is accessible from the command line
2. "Authentication required" errors
- Verify your HF_TOKEN is valid at https://huggingface.co/settings/tokens
- Ensure the token has appropriate permissions (read/write)
- Check that the token is correctly set in the Claude Desktop config env section
- Test with "Who am I currently logged in as?" to verify authentication
3. "Permission denied" errors
- Check your permission settings with
get_hf_config
- Verify you're not in read-only mode for write operations
- Ensure admin mode is enabled for deletion operations
4. General debugging tips
- Check the file exists and you have permissions to access it
- Verify the repository name and file path are correct
- Ensure you're not in read-only mode for write operations
Debug Logs
Check Claude Desktop MCP logs:
- macOS:
~/Library/Logs/Claude/mcp.log
- Windows:
%APPDATA%/Claude/Logs/mcp.log
Enable verbose logging in main.py:
logging.basicConfig(level=logging.DEBUG)
Getting Help
- Check the logs in Claude Desktop's MCP log files
- Verify configuration using the
get_hf_config
tool - Test authentication with
hf_whoami
- Test basic functionality with
hf_test
- Start simple with read operations before trying writes
🤝 Contributing
Found a bug or want to add a feature? Here's how you can help:
- Report Issues: Open an issue describing the problem
- Feature Requests: Suggest new Hugging Face integrations
- Code Contributions: Submit pull requests with improvements
- Documentation: Help improve these docs!
📄 License
MIT License - feel free to use, modify, and distribute!
🙏 Acknowledgments
- Anthropic for creating the Model Context Protocol
- Hugging Face for their amazing platform and APIs
- FastMCP team for the excellent Python SDK
Happy prompting with HuggingMCP! 🤗✨
Now Claude can be your AI pair programmer for all things Hugging Face with 17 powerful tools!
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.