# Hugging Face — Pipedream Connect

> Build, train and deploy state of the art models powered by the reference open source in machine learning.

- API slug: `hugging_face` (use in MCP headers and tool keys)
- Auth: API key (Pipedream-managed)
- Categories: Artificial Intelligence (AI)
- Website: https://huggingface.co/
- This page (HTML): https://pipedream.com/apps/hugging-face
- Tools: 6 actions · 0 triggers

## Connect via MCP (recommended)

- Endpoint: `https://remote.mcp.pipedream.net/v3`
- Headers: `Authorization: Bearer <token>` · `x-pd-project-id` · `x-pd-environment` · `x-pd-external-user-id` · `x-pd-app-slug: hugging_face`

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "hugging_face",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// e.g. run Document Question Answering:
const result = await mcp.callTool({
  name: "hugging_face-document-question-answering",
  arguments: {
    modelId: "Model ID",
    imageUrl: "Image URL",
  },
})
```

Docs: [MCP guide](https://pipedream.com/docs/connect/mcp/developers.md)

## API proxy

For a Hugging Face endpoint with no pre-built tool, the proxy forwards your request with the connected user's credentials attached.

```bash
# The path segment is the target URL, URL-safe base64 encoded:
# https://huggingface.co/api/whoami-v2

curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9odWdnaW5nZmFjZS5jby9hcGkvd2hvYW1pLXYy?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
  -H "Authorization: Bearer {access_token}" \
  -H "x-pd-environment: production"
```

Docs: [API proxy guide](https://pipedream.com/docs/connect/api-proxy.md)

## SDK

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "hugging_face-document-question-answering",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    hugging_face: { authProvisionId: "apn_xxxxxxx" },
    modelId: "Model ID",
    imageUrl: "Image URL",
  },
})
```

Docs: [Managed auth guide](https://pipedream.com/docs/connect/managed-auth/quickstart.md) · [Tools guide](https://pipedream.com/docs/connect/components.md)

## Actions (6)

### `hugging_face-document-question-answering` — Document Question Answering (Read-only)

Want to have a nice know-it-all bot that can answer any question?. This action allows you to ask a question and get an answer from a trained model. See the docs.

Full schema: https://pipedream.com/apps/hugging-face/actions/document-question-answering.md

### `hugging_face-image-classification` — Image Classification (Read-only)

This task reads some image input and outputs the likelihood of classes. This action allows you to classify images into categories. See the docs.

Full schema: https://pipedream.com/apps/hugging-face/actions/image-classification.md

### `hugging_face-language-translation` — Language Translation (Read-only)

This task is well known to translate text from one language to another. See the docs.

Full schema: https://pipedream.com/apps/hugging-face/actions/language-translation.md

### `hugging_face-object-detection` — Object Detection (Write)

This task reads some image input and outputs the likelihood of classes and bounding boxes of detected objects. See the docs.

Full schema: https://pipedream.com/apps/hugging-face/actions/object-detection.md

### `hugging_face-text-classification` — Text Classification (Write)

Usually used for sentiment-analysis this will output the likelihood of classes of an input. This action allows you to classify text into categories. See the docs.

Full schema: https://pipedream.com/apps/hugging-face/actions/text-classification.md

### `hugging_face-text-summarization` — Text Summarization (Read-only)

This task is well known to summarize longer text into shorter text. Be careful, some models have a maximum length of input. That means that the summary cannot handle full books for instance. Be careful when choosing your model. See the docs.

Full schema: https://pipedream.com/apps/hugging-face/actions/text-summarization.md

---

- All apps: https://pipedream.com/apps — index: https://pipedream.com/llms.txt
- Pipedream docs for agents: https://pipedream.com/docs/llms.txt
