# Grain + Rev.ai — Pipedream Connect

> Connect a user's Grain and Rev.ai accounts and expose tools for both apps directly in your product or your agent.

- Apps: Grain (`grain`) + Rev.ai (`rev_ai`)
- This page (HTML): https://pipedream.com/apps/grain/integrations/rev-ai
- 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: grain,rev_ai`
- `x-pd-app-slug` takes a comma-separated list, so `grain,rev_ai` 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": "grain,rev_ai",
      },
    },
  },
)

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

const { tools } = await mcp.listTools()

// One list, both toolsets: Grain and Rev.ai tools arrive
// together, each keyed by its own app's slug.

// e.g. run Download Recording:
const result = await mcp.callTool({
  name: "grain-download-recording",
  arguments: {
    recordingId: "Recording ID",
    syncDir: "SyncDir",
  },
})
```

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 [grainTools, revAiTools] =
  await Promise.all([
    pd.components.list({ app: "grain" }),
    pd.components.list({ app: "rev_ai" }),
  ])

// 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)

## Grain

- API slug: `grain` (use in MCP headers and tool keys)
- Auth: OAuth (Pipedream-managed)
- Categories: Productivity
- Website: https://grain.com/
- App page (HTML): https://pipedream.com/apps/grain
- Tools: 9 actions · 9 triggers

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

### Actions (top 8 of 9)

- [Download Recording](https://pipedream.com/apps/grain/actions/download-recording.md) — `grain-download-recording`
- [Get Recording](https://pipedream.com/apps/grain/actions/get-recording.md) — `grain-get-recording`
- [Get Transcript](https://pipedream.com/apps/grain/actions/get-transcript.md) — `grain-get-transcript`
- [List Meeting Types](https://pipedream.com/apps/grain/actions/list-meeting-types.md) — `grain-list-meeting-types`
- [List Recordings](https://pipedream.com/apps/grain/actions/list-recordings.md) — `grain-list-recordings`
- [List Teams](https://pipedream.com/apps/grain/actions/list-teams.md) — `grain-list-teams`
- [List Users](https://pipedream.com/apps/grain/actions/list-users.md) — `grain-list-users`
- [Manage Recording Sharing](https://pipedream.com/apps/grain/actions/manage-recording-sharing.md) — `grain-manage-recording-sharing`

### Triggers (top 4 of 9)

- [New Highlight (Instant)](https://pipedream.com/apps/grain/triggers/new-highlight-instant.md) — `grain-new-highlight-instant`
- [New Highlight Removed (Instant)](https://pipedream.com/apps/grain/triggers/removed-highlight-instant.md) — `grain-removed-highlight-instant`
- [New Highlight Updated (Instant)](https://pipedream.com/apps/grain/triggers/updated-highlight-instant.md) — `grain-updated-highlight-instant`
- [New Recording (Instant)](https://pipedream.com/apps/grain/triggers/new-recording-instant.md) — `grain-new-recording-instant`

## Rev.ai

- API slug: `rev_ai` (use in MCP headers and tool keys)
- Auth: API key (Pipedream-managed)
- Categories: Artificial Intelligence (AI)
- Website: https://www.rev.ai/
- App page (HTML): https://pipedream.com/apps/rev-ai
- Tools: 2 actions · 0 triggers

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

### Actions (2)

- [Get Transcript By Id](https://pipedream.com/apps/rev-ai/actions/get-transcript.md) — `rev_ai-get-transcript`
- [Submit Transcription Job](https://pipedream.com/apps/rev-ai/actions/submit-transcription-job.md) — `rev_ai-submit-transcription-job`

---

- Grain: https://pipedream.com/apps/grain.md · Rev.ai: https://pipedream.com/apps/rev-ai.md
- All apps: https://pipedream.com/apps — index: https://pipedream.com/llms.txt
- Pipedream docs for agents: https://pipedream.com/docs/llms.txt
