Server for using HuggingFace Spaces, supporting Images, Audio, Text and more. Claude Desktop mode for ease-of-use.
Read the introduction here llmindset.co.uk/resources/mcp-hfspace/
Connect to Hugging Face Spaces with minimal setup needed - simply add your spaces and go!
By default, it connects to evalstate/FLUX.1-schnell
providing Image Generation capabilities to Claude Desktop.
NPM Package is @llmindset/mcp-hfspsace
.
Install a recent version of NodeJS for your platform, then add the following to the mcpServers
section of your claude_desktop_config.json
file:
"mcp-hfspace": {
"command": "npx",
"args": [
"-y",
"@llmindset/mcp-hfspace"
]
}
Please make sure you are using Claude Desktop 0.78 or greater.
This will get you started with an Image Generator.
Supply a list of HuggingFace spaces in the arguments. mcp-hfspace will find the most appropriate endpoint and automatically configure it for usage. An example claude_desktop_config.json
is supplied below.
By default the current working directory is used for file upload/download. On Windows this is a read/write folder at \users\<username>\AppData\Roaming\Claude\<version.number\
, and on MacOS it is the is the read-only root: /
.
It is recommended to override this and set a Working Directory for handling the upload and download of images and other file-based content. Specify either the --work-dir=/your_directory
argument or MCP_HF_WORK_DIR
environment variable.
An example configuration for using a modern image generator, vision model and text to speech is below with a working directory set is below:
"mcp-hfspace": {
"command": "npx",
"args": [
"-y",
"@llmindset/mcp-hfspace",
"--work-dir=/Users/evalstate/mcp-store",
"shuttleai/shuttle-jaguar",
"styletts2/styletts2",
"Qwen/QVQ-72B-preview"
]
}
To use private spaces, supply your Hugging Face Token with either the --hf-token=hf_...
argument or HF_TOKEN
environment variable.
It's possible to run multiple server instances to use different working directories and tokens if needed.
By default, the Server operates in Claude Desktop Mode. In this mode, Images are returned in the tool responses, while other files are saved in the working folder, their file path is returned as a message. This will usually give the best experience if using Claude Desktop as the client.
URLs can also be supplied as inputs: the content gets passed to the Space.
There is an "Available Resources" prompt that gives Claude the available files and mime types from your working directory. This is currently the best way to manage files.
We'll use Claude to compare images created by shuttleai/shuttle-3.1-aesthetic
and FLUX.1-schnell
. The images gets saved to the Work Directory, as well as included in Claude's context window - so Claude can use its vision capabilities.
We'll use merve/paligemma2-vqav2
space link to query an image. In this case, we specify the filename which is available in the Working Directory: we don't want to upload the Image directly to Claude's context window. So, we can prompt Claude:
use paligemma to find out who is in "test_gemma.jpg"
-> Text Output: david bowie
If you are uploading something to Claude's context use the Paperclip Attachment button, otherwise specify the filename for the Server to send directly.
We can also supply a URL. For example : use paligemma to detect humans in https://e3.365dm.com/24/12/1600x900/skynews-taylor-swift-eras-tour_6771083.jpg?20241209000914
-> One person is detected in the image - Taylor Swift on stage.
In Claude Desktop Mode, the audio file is saved in the WORK_DIR, and Claude is notified of the creation. If not in desktop mode, the file is returned as a base64 encoded resource to the Client (useful if it supports embedded Audio attachments).
Here, we use hf-audio/whisper-large-v3-turbo
to transcribe some audio, and make it available to Claude.
In this example, we specify the filename for microsoft/OmniParser
to use, and get returned an annotated Image and 2 separate pieces of text: descriptions and coordinates. The prompt used was use omniparser to analyse ./screenshot.png
and use the analysis to produce an artifact that reproduces that screen
. DawnC/Pawmatch
is also good at this.
In this example, Claude sets a number of reasoning puzzles for Qwen, and asks follow-up questions for clarification.
If you need, you can specify a specific API Endpoint by adding it to the spacename. So rather than passing in Qwen/Qwen2.5-72B-Instruct
you would use Qwen/Qwen2.5-72B-Instruct/model_chat
.
This can be disabled with the option --desktop-mode=false or the environment variable CLAUDE_DESKTOP_MODE=false. In this case, content as returned as an embedded Base64 encoded Resource.
Some recommended spaces to try:
Prompts for each Space are generated, and provide an opportunity to input. Bear in mind that often Spaces aren't configured with particularly helpful labels etc. Claude is actually very good at figuring this out, and the Tool description is quite rich (but not visible in Claude Desktop).
A list of files in the WORK_DIR is returned, and as a convenience returns the name as "Use the file..." text. If you want to add something to Claude's context, use the paperclip - otherwise specify the filename for the MCP Server. Claude does not support transmitting resources from within Context.
Private Spaces are supported with a HuggingFace token. The Token is used to download and save generated content.
To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-hfspace": {
"command": "npx"
"args:" [
"-y",
"@llmindset/mcp-hfspace",
"--work-dir=~/mcp-files/ or x:/temp/mcp-files/",
"--HF_TOKEN=HF_{optional token}"
"Qwen/Qwen2-72B-Instruct",
"black-forest-labs/FLUX.1-schnell",
"space/example/specific-endpint"
(... and so on)
]
}
}
}
@spaces.GPU(duration=20)
in app.py
to request less quota when running the job.Location services, directions, and place details
The only platform you need to get paid - all payments in one place, invoicing and accounting reconciliations with Adfin.
Navigate your Aiven projects and interact with the PostgreSQL®, Apache Kafka®, ClickHouse® and OpenSearch® services
Marketing insights and audience analysis from Audiense reports, covering demographic, cultural, influencer, and content engagement analysis.
Query Amazon Bedrock Knowledge Bases using natural language to retrieve relevant information from your data sources.
Get prescriptive CDK advice, explain CDK Nag rules, check suppressions, generate Bedrock Agent schemas, and discover AWS Solutions Constructs patterns.
Core AWS MCP server providing prompt understanding and server management capabilities.
Analyze CDK projects to identify AWS services used and get pricing information from AWS pricing webpages and API.
Fetch, convert, and search AWS documentation pages, with recommendations for related content.
Generate images using Amazon Nova Canvas with text prompts and color guidance.