Purpose
mcp-hfspace is an MCP (Model Context Protocol) server used to let MCP clients (such as Claude Desktop) conveniently access and configure Hugging Face Spaces, including Gradio Spaces. The project itself states that it has been superseded by the official Hugging Face MCP Server and Gradio MCP Endpoints, but it can still be run locally as a STDIO server, or use SSE, Streaming HTTP, and Streaming HTTP JSON modes. In addition, it can run a local UI for selecting tools and endpoints, and supports ToolListChangedNotifications.
Main capabilities
- Connect to Hugging Face Spaces, with simple configuration: add a Space and it is ready to use.
- By default, connects to black-forest-labs/FLUX.1-schnell to provide image generation capabilities for Claude Desktop.
- Supports multiple task types, including image generation, vision models, text-to-speech, speech-to-text, image-to-image, and chat.
- Automatically finds the most suitable endpoint for the listed Hugging Face Space and completes the configuration.
- Supports private Spaces, and a Hugging Face Token can be provided via the --hf-token parameter or the HF_TOKEN environment variable.
- Supports URLs as input, and the content will be passed to the Space.
- Provides an "Available Resources" prompt to show Claude the available files and MIME types in the working directory.
- Supports MCP support for Gradio 5.28 and above through SSE integration.
- Multiple server instances can be run to use different working directories and Tokens.
Usage
A relatively new version of NodeJS needs to be installed, then add the configuration in the mcpServers section of claude_desktop_config.json. Claude Desktop 0.78 or higher is required. The NPM package name is @llmindset/mcp-hfspace.
Provide in the parameters Hugging Face Spaces list, mcp-hfspace will automatically find and configure suitable endpoints. By default, the current working directory is used for file uploads and downloads. On Windows this directory is \users<username>\AppData\Roaming\Claude<version.number, and on MacOS it is the read-only root directory /. It is recommended to override it via the --work-dir=/your_directory parameter or the MCP_HF_WORK_DIR environment variable, setting up a dedicated working directory to handle uploads and downloads of images and other files.
When using a private Space, you can provide a token via the --hf-token=hf_... parameter or the HF_TOKEN environment variable, used for downloading and saving generated content.
If you need to specify a particular API endpoint, you can append the endpoint to the Space name, for example using Qwen/Qwen2.5-72B-Instruct/model_chat instead of Qwen/Qwen2.5-72B-Instruct.
File handling and Claude Desktop mode
By default it runs in Claude Desktop mode: images are returned in the tool response, other files are saved to the working folder, and their file paths are returned as messages. This mode can be disabled via the --desktop-mode=false option or the CLAUDE_DESKTOP_MODE=false environment variable; once disabled, content is returned as embedded Base64-encoded resources.
The list of files in the working directory is returned, and file names are given in the convenient "Use the file..." text form. If you want to add content to the Claude context, use the paperclip attachment button; otherwise specify the file name and the MCP server will send it directly. Claude does not support transferring resources from within the context.
Applicable scenarios
The project documentation provides several example scenarios:
- Image generation: use shuttleai/shuttle-3.1-aesthetic and FLUX.1-schnell to generate images, save them in the working directory and include them in the Claude context to leverage visual capabilities.
- Vision models: use merve/paligemma2-vqav2 to query images, you can specify a file name in the working directory, or pass in an image URL.
- Text to speech: audio files are saved to WORK_DIR and Claude is notified; in non-desktop mode they are returned as Base64-encoded resources.
- Speech to text: use hf-audio/whisper-large-v3-turbo to transcribe audio and provide it to Claude.
- Image to image: use microsoft/OmniParser to analyze images, returning annotated images along with description and coordinate text.
- Chat: have Claude pose reasoning puzzles to Qwen and ask follow-up questions.
Recommended Spaces cover categories such as image generation, background removal, pencil sketch, text to speech, audio generation, speech to text, vision models, and more.
Limitations
- Endpoints with unnamed parameters are not currently supported.
- Full conversion of complex Python types to suitable MCP formats is still limited.
- Claude Desktop 0.75 appears not to respond to MCP server errors, but instead times out; for persistent issues, use MCP Inspector to diagnose. If it suddenly stops working, it may be that the HuggingFace ZeroGPU quota is exhausted; you can retry later or host your own Space.
- Claude Desktop appears to use a hard 60-second timeout and does not use progress notifications to manage user experience or keep the connection alive. When using ZeroGPU Space, large or heavy tasks may time out; however, results may still be saved in WORK_DIR.
- Claude Desktop reports poorly on server status, logs, etc.; it is recommended to use @modelcontextprotocol/inspector to diagnose.
- If the ZeroGPU quota or queue is too long, you can try duplicating the Space; if the task completes within 60 seconds, you can usually change the function decorator @spaces.GPU(duration=20) in app.py to request less quota.
- Passing in HF_TOKEN will apply the ZeroGPU quota to your (Pro) HF account.
- If you have a private Space and dedicated hardware, HF_TOKEN gives you direct access without quota limits, recommended for production tasks.
Configuration location
When using Claude Desktop, add the server configuration in the following locations:
- MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
- Windows: %APPDATA%/Claude/claude_desktop_config.json
The project also mentions that you can access and configure the Hugging Face MCP service directly through https://hf.co/mcp , including Gradio Spaces; you can also run hf-mcp-server locally as a STDIO server.