hf_hub_community / README.md
evalstate's picture
evalstate HF Staff
Deploy HF Hub Community agent with OAuth token passthrough
a60a605 verified
metadata
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 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