Skip to content

Commit 1965d24

Browse files
authored
Merge pull request #72 from evalstate/feat/api-metrics-fix
Feat/api metrics fix
2 parents 04e8ef2 + 464215a commit 1965d24

File tree

4 files changed

+59
-28
lines changed

4 files changed

+59
-28
lines changed

README.md

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,86 @@
11
# Hugging Face Official MCP Server
22

3-
## Getting Started
3+
Welcome to the official Hugging Face MCP Server 🤗. Connect your LLM to the Hugging Face Hub and thousands of Gradio AI Applications.
44

5-
This repository contains the offical Hugging Face MCP Server source. The server supports multiple deployment and configuration options, and is deployable locally as well as on your own infrastructure.
5+
## Installing the MCP Server
66

7-
The easiest way to access Hugging Face MCP Services is via `https://hf.co/mcp` which offers a number of Tools, Prompts and access to Gradio Spaces which are configurable at `https://hf.co/settings/mcp`.
7+
Follow the instructions below to get started:
88

99
![hf_mcp_server_small](https://github.com/user-attachments/assets/d30f9f56-b08c-4dfc-a68f-a164a93db564)
1010

11-
Anonymous access is supported with a default set of Tools and Prompts, or use a Hugging Face READ token to customize your settings:
11+
<details>
12+
<summary>Install in <b>Claude Desktop</b> or <b>claude.ai</b></summary>
13+
<br />
14+
15+
Click [here](https://claude.ai/redirect/website.v1.67274164-23df-4883-8166-3c93ced276be/directory/37ed56d5-9d61-4fd4-ad00-b9134c694296) to add the Hugging Face connector to your account.
16+
17+
Alternatively, navigate to [https://claude.ai/settings/connectors](https://claude.ai/settings/connectors), and add "Hugging Face" from the gallery.
18+
19+
<img src='docs/claude-badge.png' />
20+
21+
</details>
1222

1323
<details>
14-
<summary>Install in <b>Claude Desktop</b></summary>
24+
<summary>Install in <b>Claude Code</b></summary>
1525
<br />
16-
For <b>Claude Desktop</b> (via MCP Remote) (in your `mcpServers` section):
26+
27+
Enter the command below to install in <b>Claude Code></b>:
28+
29+
```bash
30+
claude mcp add hf-mcp-server -t http https://huggingface.co/mcp?login
31+
```
32+
33+
```bash
34+
claude mcp add hf-mcp-server \
35+
-t http https://huggingface.co/mcp \
36+
-H "Authorization: Bearer <YOUR_HF_TOKEN>"
37+
```
38+
39+
40+
</details>
41+
42+
<details>
43+
44+
<summary>Install in <b>VSCode</b></summary>
45+
<br />
46+
47+
Click <a href="vscode:mcp/install?%7B%22name%22%3A%22huggingface%22%2C%22gallery%22%3Atrue%2C%22url%22%3A%22https%3A%2F%2Fhuggingface.co%2Fmcp%3Flogin%22%7D">here</a> to add the Hugging Face connector directly to VSCode. Alternatively, install from the gallery at [https://code.visualstudio.com/mcp](https://code.visualstudio.com/mcp):
48+
49+
Alternatively, navigate to the VSCode [MCP Servers for agent mode](https://code.visualstudio.com/mcp) directory, and <a href="foo">click</a> "Install Hugging Face".
50+
51+
If you prefer to use configure manually or prefer to use an auth token, use the snippet below in your mcp.json configuration:
52+
53+
<img src='docs/vscode-badge.png' />
1754

1855
```JSON
19-
"Hugging Face": {
20-
"command": "npx",
21-
"args": [
22-
"-y","mcp-remote",
23-
"https://hf.co/mcp",
24-
"--header", "Authorization:${AUTH_HEADER}"
25-
],
26-
"env": {
27-
"AUTH_HEADER": "Bearer <YOUR_HF_TOKEN>"
56+
"huggingface": {
57+
"url": "https://huggingface.co/mcp",
58+
"headers": {
59+
"Authorization": "Bearer <YOUR_HF_TOKEN>"
2860
}
29-
}
3061
```
62+
3163
</details>
3264

3365
<details>
34-
35-
<summary>Install in <b>VSCode</b> or <b>Cursor</b></summary>
66+
<summary>Install in <b>Cursor</b></summary>
3667
<br />
37-
For <b>VSCode</b> and <b>Cursor</b> (in your `mcp/servers`or `mcpServers` section respectively):
3868

39-
If you prefer to use OAuth, use `https://hf.co/mcp?login`
69+
Click <a href="https://cursor.com/en/install-mcp?name=Hugging%20Face&config=eyJ1cmwiOiJodHRwczovL2h1Z2dpbmdmYWNlLmNvL21jcD9sb2dpbiJ9">here</a> to install the Hugging Face MCP Server directly in <b>Cursor</b>.
70+
71+
If you prefer to use configure manually or specify an Authorization Token, use the snippet below:
4072

4173
```JSON
42-
"hf-mcp-server": {
43-
"url": "https://hf.co/mcp",
74+
"huggingface": {
75+
"url": "https://huggingface.co/mcp",
4476
"headers": {
4577
"Authorization": "Bearer <YOUR_HF_TOKEN>"
4678
}
4779
```
4880
</details>
4981

50-
For **claude.ai** enter `https://hf.co/mcp` from the "Add Integrations" dropdown menu. Claude does not currently support the MCP 2025-06-18 OAuth standard so is limited to anonymous access.
82+
83+
https://cursor.com/en/install-mcp?name=Hugging%20Face&config=eyJ1cmwiOiJodHRwczovL2h1Z2dpbmdmYWNlLmNvL21jcD9sb2dpbiJ9
5184

5285
## Quick Guide (Repository Packages)
5386

docs/claude-badge.png

10.5 KB
Loading

docs/vscode-badge.png

15.1 KB
Loading

packages/app/src/server/transport/stateless-http-transport.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,9 @@ export class StatelessHttpTransport extends BaseTransport {
465465
* Get all active sessions - returns empty array for stateless transport
466466
*/
467467
override getSessions(): SessionMetadata[] {
468-
// In analytics mode, return tracked sessions
469-
if (this.analyticsMode) {
470-
return Array.from(this.analyticsSessions.values()).map((session) => session.metadata);
471-
}
472-
// Stateless transport doesn't maintain sessions
468+
// Stateless transport doesn't maintain sessions for metrics display
469+
// Even in analytics mode, we track sessions internally but don't expose them
470+
// to avoid returning massive amounts of session data
473471
return [];
474472
}
475473

0 commit comments

Comments
 (0)