# Home Assistant + Twitch — Pipedream Connect

> Connect a user's Home Assistant and Twitch accounts and expose tools for both apps directly in your product or your agent.

- Apps: Home Assistant (`home_assistant`) + Twitch (`twitch`)
- This page (HTML): https://pipedream.com/apps/home-assistant/integrations/twitch
- One `external_user_id` owns both connected accounts, and each account stays independently revocable.

## One session, both toolsets (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: home_assistant,twitch`
- `x-pd-app-slug` takes a comma-separated list, so `home_assistant,twitch` is one session on one transport. Both toolsets arrive from a single `listTools()`, and a tool is called exactly as it would be in a single-app session.

```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": "home_assistant,twitch",
      },
    },
  },
)

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

const { tools } = await mcp.listTools()

// One list, both toolsets: Home Assistant and Twitch tools arrive
// together, each keyed by its own app's slug.

// e.g. run Block User:
const result = await mcp.callTool({
  name: "twitch-block-user",
  arguments: {
    user: "User",
    sourceContext: "Source Context",
  },
})
```

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

## Both apps from your backend

```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 externalUserId = "{external_user_id}" // any stable ID for this user in your system

const [homeAssistantTools, twitchTools] =
  await Promise.all([
    pd.components.list({ app: "home_assistant" }),
    pd.components.list({ app: "twitch" }),
  ])

// One external user owns both connected accounts, so either app's tools
// run on their behalf with the same externalUserId.
```

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

## Home Assistant

- API slug: `home_assistant` (use in MCP headers and tool keys)
- Auth: API key (Pipedream-managed)
- Categories: Smart Home Automation
- Website: https://home-assistant.io
- App page (HTML): https://pipedream.com/apps/home-assistant
- Tools: 0 actions · 0 triggers

Full tool list, API proxy, and SDK quickstart: https://pipedream.com/apps/home-assistant.md

## Twitch

- API slug: `twitch` (use in MCP headers and tool keys)
- Auth: OAuth (Pipedream-managed)
- Categories: Entertainment
- Website: https://www.twitch.tv/
- Managed OAuth scopes: `analytics:read:extensions` · `analytics:read:games` · `bits:read` · `channel:read:subscriptions` · `clips:edit` · `user:edit` · `user:edit:broadcast` · `user:read:broadcast` · `user:read:email` · `user:read:follows` · `user:read:blocked_users` · `user:manage:blocked_users` · `moderator:read:followers` · `channel:read:editors` · `channel:manage:videos` · `user:read:subscriptions`
- App page (HTML): https://pipedream.com/apps/twitch
- Tools: 17 actions · 8 triggers

Full tool list, API proxy, and SDK quickstart: https://pipedream.com/apps/twitch.md

### Actions (top 8 of 17)

- [Block User](https://pipedream.com/apps/twitch/actions/block-user.md) — `twitch-block-user`
- [Check Channel Subscription](https://pipedream.com/apps/twitch/actions/check-channel-subscription.md) — `twitch-check-channel-subscription`
- [Delete Video](https://pipedream.com/apps/twitch/actions/delete-video.md) — `twitch-delete-video`
- [Get Channel Editors](https://pipedream.com/apps/twitch/actions/get-channel-editors.md) — `twitch-get-channel-editors`
- [Get Channel Followers](https://pipedream.com/apps/twitch/actions/get-channel-followers.md) — `twitch-get-channel-followers`
- [Get Channel Information](https://pipedream.com/apps/twitch/actions/get-channel-information.md) — `twitch-get-channel-information`
- [Get Channel Teams](https://pipedream.com/apps/twitch/actions/get-channel-teams.md) — `twitch-get-channel-teams`
- [Get Clips](https://pipedream.com/apps/twitch/actions/get-clips.md) — `twitch-get-clips`

### Triggers (top 4 of 8)

- [New Clip By Streamer](https://pipedream.com/apps/twitch/triggers/new-clip-by-streamer.md) — `twitch-new-clip-by-streamer`
- [New Clips](https://pipedream.com/apps/twitch/triggers/new-clips.md) — `twitch-new-clips`
- [New Followed Streams](https://pipedream.com/apps/twitch/triggers/followed-streams.md) — `twitch-followed-streams`
- [New Follower](https://pipedream.com/apps/twitch/triggers/new-follower.md) — `twitch-new-follower`

---

- Home Assistant: https://pipedream.com/apps/home-assistant.md · Twitch: https://pipedream.com/apps/twitch.md
- All apps: https://pipedream.com/apps — index: https://pipedream.com/llms.txt
- Pipedream docs for agents: https://pipedream.com/docs/llms.txt
