HuggingFaceDoc / README.md
ABDALLALSWAITI's picture
Update README.md
64dbf78 verified
---
title: Hugging Face Information Server
emoji: πŸ“š
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: '5.33.1'
app_file: app.py
pinned: false
license: apache-2.0
short_description: A research assistant for the Hugging Face ecosystem.
tags: ["mcp-server-track"]
---
# Hugging Face Information Server πŸ“š
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
The **Hugging Face Information Server** is a research assistant designed to accelerate development and learning within the AI ecosystem. It acts as an intelligent bridge to the vast resources on Hugging Face, transforming simple queries into structured, actionable intelligence.
Instead of just returning links, this tool provides comprehensive, formatted summaries directly, allowing developers and researchers to find practical answers without leaving their workflow.
## πŸš€ Demo Video
<video controls width="100%">
<source src="https://cdn-uploads.huggingface.co/production/uploads/642aff56556ab448a074397e/EnfOC_CDV3Pr7bZi9B5lY.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
---
## Key Features
- **Comprehensive Documentation Search:** Delivers structured summaries of official documentation.
- **In-Depth Model & Dataset Analysis:** Provides rich profiles of models and datasets with code snippets.
- **Task-Oriented Model Discovery:** Helps you find the right tool for the job by searching for models based on a task.
- **Live & Relevant Data:** Utilizes live API calls and intelligent web scraping to ensure information is always up-to-date.
---
## How to Use the Web Interface
The user interface is organized into clear tabs for different functions:
1. **Select a tab** at the top (e.g., "Model Information", "Documentation Search").
2. **Enter your query** into the textbox.
3. **Click the button** to get a detailed, formatted response.
---
## Integrating with MCP Clients
This application is a fully compliant **Model Context Protocol (MCP)** server, allowing AI agents and other clients to use its functions as tools.
### Connection Endpoint
The server's public endpoint is:
`https://agents-mcp-hackathon-huggingfacedoc.hf.space/gradio_api/mcp/sse`
### Method 1: Test with Public Clients
You can test this server immediately using these public MCP Client Spaces. Just paste the server URL above into the client's URL input field.
**[➑️ Test with Hugging Face Client](https://huggingface.co/spaces/ABDALLALSWAITI/MCPclient)**
A special thank you to **Modal Labs** for providing credits and resources during the hackathon. You can also test with this client deployed on **Modal**.
**[➑️ Test with Modal Client](https://abedalswaity7--huggingface-research-agent-ui.modal.run/)**
*For those interested, here is a guide on deploying Gradio applications on Modal: [How to run Gradio apps on Modal](https://modal.com/blog/how_to_run_gradio_on_modal_article).*
### Method 2: Integrate with UI Clients (e.g., Cursor IDE)
MCP hosts often use a configuration file, typically named `mcp.json`, to manage server connections. For a remote server using HTTP+SSE transport, the configuration points to the server's URL. You would create an `mcp.json` file with the following structure:
```json
{
"servers": [
{
"name": "HF Info Server",
"transport": {
"type": "sse",
"url": "https://agents-mcp-hackathon-huggingfacedoc.hf.space/gradio_api/mcp/sse"
}
}
]
}
````
#### Configuring Cursor IDE
To connect this server in Cursor, you can use the `mcp-remote` tool, which acts as a bridge.
1. Open Cursor settings (`Ctrl + Shift + J` / `Cmd + Shift + J`).
2. Go to the `MCP` tab and click `Add new global MCP server`.
3. Paste the appropriate configuration below.
**For macOS/Linux:**
```json
{
"mcpServers": {
"hf-info-server": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://agents-mcp-hackathon-huggingfacedoc.hf.space/gradio_api/mcp/sse",
"--transport",
"sse-only"
]
}
}
}
```
**For Windows:**
```json
{
"mcpServers": {
"hf-info-server": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"mcp-remote",
"https://agents-mcp-hackathon-huggingfacedoc.hf.space/gradio_api/mcp/sse",
"--transport",
"sse-only"
]
}
}
}
```
### Method 3: Build a Python Client with `smol-agents`
You can also run your own agent locally.
**1. Setup Your Environment**
Create a `requirements.txt` file:
```text
gradio[mcp]
smolagents[mcp]
smolagents[litellm]
```
Then, install the dependencies:
```bash
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt
```
**2. Set Your API Key**
This client uses an LLM for reasoning. Export your API key as an environment variable. For example, for Google Gemini:
```bash
export GOOGLE_API_KEY="YOUR_API_KEY_HERE"
```
**3. Create and Run the Client Script**
Save the client code as `client_app.py` and run it from your terminal:
```bash
python client_app.py
```
-----
## Advanced: Using `LiteLLMModel` Directly
The `smol-agents` library uses `LiteLLMModel` to interact with various language models. To use a model like Anthropic's Claude 3.5 Sonnet directly, ensure your API key is set (`export ANTHROPIC_API_KEY="YOUR_KEY"`) and use the following pattern:
```python
from smolagents import LiteLLMModel
messages = [
{"role": "user", "content": [{"type": "text", "text": "Hello, how are you?"}]}
]
model = LiteLLMModel(
model_id="anthropic/claude-3-5-sonnet-latest",
temperature=0.2,
max_tokens=1024
)
response = model(messages)
print(response)
```
-----
## Available Tools
The server exposes the following tools to any connected MCP client:
- `search_documentation(query, max_results)`
- `get_model_info(model_name)`
- `get_dataset_info(dataset_name)`
- `search_models(task, limit)`
- `get_transformers_docs(topic)`
- `get_trending_models(limit)`
-----
## References & Further Reading
- **[Building an MCP Server with Gradio](https://huggingface.co/learn/mcp-course/unit2/gradio-server)** - A tutorial on the concepts used to build this server.
- **[Building MCP Clients (JS & Python)](https://huggingface.co/learn/mcp-course/unit2/clients)** - A guide on creating clients to interact with an MCP server.
-----
## License
This project is licensed under the Apache 2.0 License.
```
```