huggingface-mcp-server

bui21x/huggingface-mcp-server

3.1

If you are the rightful owner of huggingface-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server that provides HuggingFace model integration for AI agents.

HuggingFace MCP Server

A Model Context Protocol (MCP) server that provides HuggingFace model integration for AI agents.

Features

  • Model inference with GPU support
  • Model caching for improved performance
  • Multiple task support
  • Custom parameter configuration
  • Health monitoring with GPU status

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Set environment variables:
HUGGINGFACE_TOKEN=your_token_here  # Optional
  1. Run server:
uvicorn src.mcp_server:app --reload

API Endpoints

  • POST /inference - Run model inference
  • GET /models - List loaded models
  • GET /health - Check server health

Example Usage

# Run inference
POST /inference
{
    "model_id": "gpt2",
    "task": "text-generation",
    "inputs": "Once upon a time",
    "parameters": {
        "max_length": 50,
        "temperature": 0.7
    }
}

MCP Integration

This server follows the MCP specification for tool integration with AI agents.