mcp-hfspace MCP Server logo

mcp-hfspace MCP Server

by evalstate/llmindset

Connect to Hugging Face Spaces with minimal setup. Simply add your spaces to the configuration and the server will find the most appropriate endpoint and automatically configure it for usage with Claude Desktop.

View on GitHub

Last updated: N/A

What is mcp-hfspace MCP Server?

mcp-hfspace is an MCP (Model Context Protocol) server that allows you to easily connect to and utilize Hugging Face Spaces within Claude Desktop. It simplifies the process of integrating various AI models and functionalities offered by Hugging Face Spaces into your Claude workflows.

How to use mcp-hfspace MCP Server?

  1. Install NodeJS. 2. Install the NPM package @llmindset/mcp-hfspace. 3. Add the server configuration to your claude_desktop_config.json file, specifying the command, arguments (including Hugging Face spaces), and optional working directory and Hugging Face token. 4. Ensure you are using Claude Desktop 0.78 or greater. 5. Use Claude to interact with the configured Hugging Face Spaces by specifying the filename or URL for file-based content or using the paperclip attachment button for direct context uploads.

Key features of mcp-hfspace MCP Server

  • Easy integration with Hugging Face Spaces

  • Automatic endpoint configuration

  • Support for image generation, vision models, text-to-speech, and other AI functionalities

  • File handling with working directory support

  • Claude Desktop Mode for optimized interaction

  • Support for private spaces with Hugging Face token

  • Prompt generation for each space

  • Resource listing from the working directory

Use cases of mcp-hfspace MCP Server

  • Image generation and comparison

  • Vision model queries with file uploads or URLs

  • Text-to-speech and audio generation

  • Speech-to-text transcription

  • Image-to-image processing and analysis

  • Chat with AI models

FAQ from mcp-hfspace MCP Server

How do I specify a specific API endpoint?

Add the endpoint to the spacename, e.g., Qwen/Qwen2.5-72B-Instruct/model_chat.

What is Claude Desktop Mode?

In Claude Desktop Mode, images are returned in tool responses, while other files are saved in the working folder, and their file path is returned as a message.

How do I use private spaces?

Supply your Hugging Face Token with either the --hf-token=hf_... argument or HF_TOKEN environment variable.

How do I set a working directory?

Specify either the --work-dir=/your_directory argument or MCP_HF_WORK_DIR environment variable.

What do I do if I encounter timeouts with ZeroGPU spaces?

Check the WORK_DIR for results. The MCP Server will still capture and save the result if it was produced. If ZeroGPU quotas or queues are too long, try duplicating the space. If your job takes less than sixty seconds, you can usually change the function decorator @spaces.GPU(duration=20) in app.py to request less quota when running the job.