huggingface-mcp
3.2
If you are the rightful owner of huggingface-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This is a Model Context Protocol (MCP) server for interacting with the Hugging Face Hub API, focusing on managing Spaces.
Hugging Face Hub MCP Server
This is a Model Context Protocol (MCP) server for interacting with the Hugging Face Hub API, focusing on managing Spaces.
Features
- List, create, update, and delete Hugging Face Spaces
- Manage files within Spaces (list, get, upload, delete)
- Get Space logs and runtime information
- Search for Spaces
- Change Space settings (hardware, privacy, SDK)
- Duplicate existing Spaces
- Restart and pause Spaces
Installation
- Clone this repository
- Install dependencies:
cd mcp-server-huggingface
npm install
- Build the TypeScript code:
npm run build
Usage
Start the server:
npm start
Available Tools
The following MCP tools are available:
Space Management
list-my-spaces
: List all Hugging Face spaces for the authenticated userget-spaces-by-user
: List Hugging Face spaces by a specific user or organizationget-space
: Get details about a specific Hugging Face spacecreate-space
: Create a new Hugging Face spaceduplicate-space
: Duplicate an existing Hugging Face spaceupdate-space
: Update metadata of a Hugging Face spacedelete-space
: Delete a Hugging Face spacerename-space
: Rename a Hugging Face space
Space Configuration
get-space-hardware
: Get available hardware options for Hugging Face spacesget-space-runtimes
: Get available runtime options for Hugging Face spacesrestart-space
: Restart a Hugging Face spacepause-space
: Pause a running Hugging Face space
File Management
list-space-files
: List files in a Hugging Face spaceget-space-file
: Get the content of a file from a Hugging Face spaceupload-text-file
: Upload text content to a file in a Hugging Face spaceupload-file
: Upload a file from the local filesystem to a Hugging Face spacedelete-space-file
: Delete a file from a Hugging Face space
Space Inspection
get-space-logs
: Get logs for a Hugging Face spacesearch-spaces
: Search for Hugging Face spaces
Example Tool Calls
Listing Your Spaces
{
"name": "list-my-spaces",
"arguments": {}
}
Creating a New Space
{
"name": "create-space",
"arguments": {
"name": "my-demo-space",
"private": true,
"sdk": "gradio"
}
}
Uploading a File to a Space
{
"name": "upload-text-file",
"arguments": {
"spaceId": "username/my-demo-space",
"path": "app.py",
"content": "import gradio as gr\n\ndef greet(name):\n return \"Hello, \" + name + \"!\"\n\ndemo = gr.Interface(fn=greet, inputs=\"text\", outputs=\"text\")\ndemo.launch()"
}
}
Getting Space Logs
{
"name": "get-space-logs",
"arguments": {
"spaceId": "username/my-demo-space",
"count": 50
}
}
Notes
- This MCP server uses a hardcoded API token for authentication.
- All operations are performed using this API token.
License
MIT