mcp-huggingface mcp

v1.0.0 · MCP Tool · ai · registry.pascalai.org

HuggingFace Inference API — ML models for text, vision and NLP. Operations: generate (text generation), classify (text classification), ner (named entity recognition), summarize, translate, embed (feature extraction), qa (question answering), zero_shot (zero-shot classification), image_classify, search_models. API key optional for some models.

huggingfacenlptransformersinferenceai

Input Parameters

ParameterTypeDescription
operationrequired string Operation to perform. One of: generate, classify, ner, summarize, translate, embed, qa, zero_shot, image_classify, search_models.
apiKeyoptional string HuggingFace API token (required for gated models).
modeloptional string Model ID (e.g. gpt2, facebook/bart-large-cnn). Each operation has a default.
textoptional string Input text for generate, classify, ner, summarize, qa, zero_shot.
textsoptional string JSON array of strings for batch embed or classify.
contextoptional string Context text for qa (question answering) operation.
questionoptional string Question for qa operation.
labelsoptional string Comma-separated candidate labels for zero_shot classification.
srcLangoptional string Source language code for translate (e.g. en).
tgtLangoptional string Target language code for translate (e.g. fr, de, es).
maxTokensoptional integer Max new tokens to generate. Default: 200.
minTokensoptional integer Min new tokens to generate. Default: 0.
temperatureoptional number Sampling temperature (default: 1.0). Default: 1.0.
searchoptional string Search query for search_models.
taskoptional string Task filter for search_models (e.g. text-generation, translation).
limitoptional integer Max models to return for search_models (default: 10). Default: 10.
imageUrloptional string Image URL for image_classify operation.

Output Fields

FieldTypeDescription
generated_text string
results array[object]
answer string
embeddings array[any]
error string

Examples

Text generation

// Input
{
  "operation": "generate",
  "model": "gpt2",
  "text": "The future of AI is",
  "maxTokens": 50
}

// Output
{
  "generated_text": "The future of AI is bright and..."
}

Install & Discovery

Install

ppm install mcp-huggingface

Get JSON Schema

GET /v1/packages/mcp-huggingface/1.0.0/schema

Discover by keyword

GET /v1/mcp/discover?q=huggingface
Discovery hint: Install with ppm install mcp-huggingface or invoke remotely via POST /v1/invoke/mcp-huggingface on the MCP Service.

PascalAI Usage

uses toolslib;
var Tool := LoadTool('mcp-huggingface');
var R := Tool.Call(JsonObj(['operation','generate','model','gpt2','text','Hello world','maxTokens',50]));
Writeln(R.ToJSON);