File size: 6,560 Bytes
9366462
ccee463
edca24f
 
ccee463
edca24f
ccee463
edca24f
ccee463
 
 
edca24f
 
ccee463
 
edca24f
 
 
 
 
 
 
 
 
51981ac
 
 
 
edca24f
 
 
ebe2155
 
edca24f
 
ebe2155
 
 
 
 
 
edca24f
 
 
 
 
 
 
ebe2155
 
 
edca24f
f375499
edca24f
f375499
edca24f
 
 
ebe2155
 
 
9366462
ebe2155
9366462
ebe2155
9366462
ebe2155
9366462
ebe2155
9366462
f375499
9366462
f375499
9366462
 
 
f375499
 
 
 
 
 
 
 
b37bf77
f375499
 
 
 
 
 
 
 
9366462
f375499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b37bf77
f375499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b37bf77
f375499
 
 
 
 
 
 
 
 
 
 
ebe2155
 
 
f375499
ebe2155
 
cb56648
 
 
f375499
ebe2155
f375499
ebe2155
 
 
 
 
 
 
 
 
f375499
ebe2155
f375499
 
 
ebe2155
f375499
ebe2155
9366462
ebe2155
f375499
 
ebe2155
 
f375499
 
 
 
9366462
f375499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ebe2155
 
 
 
 
f375499
ebe2155
 
 
 
 
 
 
 
 
 
 
 
 
f375499
ebe2155
 
 
 
 
9366462
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228

---
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.

```
```