This Node.js package connects your Claude Desktop client to Hugging Face Spaces through the Model Context Protocol (MCP), enabling AI capabilities like image generation, vision models, and text-to-speech with minimal setup.
To get started with mcp-hfspace, you'll need to:
mcpServers
section of your Claude Desktop config file:"mcp-hfspace": {
"command": "npx",
"args": [
"-y",
"@llmindset/mcp-hfspace"
]
}
The config file is located at:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Make sure you're using Claude Desktop 0.78 or greater.
You can specify Hugging Face spaces as arguments to connect to different AI capabilities. The server will automatically configure the appropriate endpoints.
It's recommended to set a working directory for handling file uploads and downloads:
"mcp-hfspace": {
"command": "npx",
"args": [
"-y",
"@llmindset/mcp-hfspace",
"--work-dir=/path/to/your/directory",
"shuttleai/shuttle-jaguar",
"styletts2/styletts2",
"Qwen/QVQ-72B-preview"
]
}
You can set the working directory using either:
--work-dir=/your_directory
argumentMCP_HF_WORK_DIR
environment variableTo access private Hugging Face spaces, provide your token using either:
--hf-token=hf_...
argumentHF_TOKEN
environment variableUse spaces like shuttleai/shuttle-3.1-aesthetic
or black-forest-labs/FLUX.1-schnell
for generating images. Simply ask Claude to generate an image with your chosen model, and the image will be saved to your working directory and included in Claude's context window.
For analyzing images, you can use spaces like merve/paligemma2-vqav2
:
use paligemma to find out who is in "image.jpg"
You can also provide image URLs: use paligemma to detect humans in https://example.com/image.jpg
With spaces like parler-tts/parler_tts
, you can generate audio:
Use transcription models like hf-audio/whisper-large-v3-turbo
:
For image analysis and transformation, try spaces like microsoft/OmniParser
or gokaygokay/Inspyrenet-Rembg
(for background removal):
You can connect to other AI chat models like Qwen/Qwen2.5-72B-Instruct
to have Claude interact with them.
You can specify a particular API endpoint by adding it to the space name:
Qwen/Qwen2.5-72B-Instruct/model_chat
By default, the server operates in Claude Desktop Mode. You can disable this using:
--desktop-mode=false
argumentCLAUDE_DESKTOP_MODE=false
environment variable@spaces.GPU(duration=20)
decorator in the space's app.py
to request less quota.There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.