File size: 2,178 Bytes
7833b5a
a60a605
 
 
 
7833b5a
a60a605
 
 
7833b5a
 
a60a605
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: HF Hub Community Agent
emoji: 🤗
colorFrom: yellow
colorTo: red
sdk: docker
app_port: 7860
license: apache-2.0
short_description: Query HF users, orgs, discussions, PRs, and more
---

# HF Hub Community Agent

This Space runs a [fast-agent](https://fast-agent.ai/) agent specialized in querying Hugging Face Hub community features.

## Capabilities

This agent can help you with:

- **User & Organization Data**: Get user profiles, overview info, followers, and following lists
- **Discussions & Pull Requests**: Browse, create, and manage discussions and PRs on repos
- **Access Requests**: Manage access requests for gated repositories  
- **Collections**: List, view, and manage HF collections
- **Likes & Interactions**: Query liked repositories and user activity

## Configuration

The agent uses the HuggingFace API with:
- `hf_api_tool.py`: Secure API tool with endpoint allowlist
- `hf_hub_community.md`: Agent card with detailed method documentation

## OAuth Token Passthrough

This Space is configured for **user-pays** inference:
- Users provide their own HuggingFace token via `Authorization: Bearer <token>` header
- Inference costs are billed to the user's HF account
- Supports HF Inference API models

## Environment Variables

Configure in Space Settings:

- `HF_TOKEN`: Fallback token for unauthenticated requests (optional)
- `HF_ENDPOINT`: Override HF endpoint (default: https://huggingface.co)
- `HF_MAX_RESULTS`: Max results for list responses (default: 20)

## Usage

This Space exposes a fast-agent MCP server. You can interact with it using:

1. **MCP Clients**: Connect using the Space URL with your HF token
2. **HTTP API**: Send requests with `Authorization: Bearer <your-hf-token>` header
3. **Claude Desktop**: Configure as an MCP server

## Security

The `hf_api_tool.py` includes:
- Endpoint allowlist for security
- Token validation and path traversal protection
- Request-scoped token passthrough for OAuth

## Model

Uses `gpt-oss` model (configurable via agent card frontmatter).

## More Info

- [Fast Agent Documentation](https://fast-agent.ai/)
- [Hugging Face API Documentation](https://huggingface.co/docs/huggingface_hub)