Hugging Face Gradio MCP Servers Integration
Hugging Face has integrated the Model Context Protocol (MCP) into Gradio version 5.28.0, transforming Hugging Face Spaces into a functional "app store" for LLM tools. This integration allows developers and users to connect Large Language Models (LLMs) to specialized AI applications hosted on Spaces, granting them new functional abilities such as image editing, OCR, and text-to-speech synthesis.
The Model Context Protocol (MCP) Standard
The Model Context Protocol (MCP) is an open standard designed to create secure, two-way connections between an LLM and a set of external tools. By implementing an MCP server, developers can expose specific tools—such as a video transcription service—to an LLM client (e.g., Cursor, Claude Code, or Cline). The LLM then recognizes these tools and can invoke them autonomously based on the user's request.
Hugging Face Spaces as an MCP Tool Repository
Hugging Face Spaces is a collection of AI applications, many of which are built using Gradio, an open-source Python package for AI web servers. With the release of Gradio 5.28.0, Gradio apps now support the MCP protocol.
This update effectively turns Hugging Face Spaces into a centralized directory of MCP servers. Users can discover MCP-compatible tools by filtering for "MCP Compatible" on the Hugging Face Spaces page or using a dedicated filter link. Examples of available specialized tasks include:
- Image Background Removal
- Multimodal OCR
- Text-to-Speech Synthesis
Implementation Example: Image Editing with Flux.1 Kontext[dev]
To grant an LLM the ability to edit images via plain text instructions, users can connect the black-forest-labs/Flux.1-Kontext-Dev space as an MCP server. The process involves the following steps:
- Account Setup: Create a Hugging Face account and navigate to the MCP section in the profile settings.
- Tool Selection: Search for and select
Flux.1-Kontext-Devwithin the "Spaces Tools" section of the MCP settings. - Client Configuration: Copy the provided configuration code snippet from the Hugging Face MCP settings page and paste it into the settings file of an MCP-compatible client, such as Cursor.
- Execution: Once configured, the LLM can edit images provided via public URLs.
Performance and Privacy Considerations
Users utilizing popular public spaces as tools may experience longer wait times. To mitigate this, Hugging Face suggests duplicating the space to create a private version. Note that duplicating spaces using "ZeroGPU" may require a Hugging Face PRO account.
Expanding LLM Capabilities via MCP Search
Beyond adding specific tools, users can utilize the Hugging Face MCP server itself to search for other MCP-compatible spaces. This allows the LLM to autonomously find and suggest spaces that can accomplish specific tasks requested by the user.