View as Markdown
Gmail icon IMAP icon

MULTI-APP TOOLKIT

Build with Gmail + IMAP

Connect a user's Gmail and IMAP accounts and expose tools for both apps directly in your product or your agent.
  • Multi-app
  • One MCP session
  • 22 actions
  • 6 triggers
  • Managed auth

MCP

One MCP session, both toolsets

One session gives your product or agent every Gmail and IMAP tool at once — connect once, list tools, and call them like any single-app session.

// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": "{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": "gmail,imap",
      },
    },
  },
)

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

const { tools } = await mcp.listTools()

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

// e.g. run Add Label to Email:
const result = await mcp.callTool({
  name: "gmail-add-label-to-email",
  arguments: {
    message: "Message",
    addLabelIds: ["Labels"],
  },
})

ARCHITECTURE

One user, two connected accounts

Your user connects each account once, under whatever ID they already have in your product. The two stay independent — either can be revoked on its own — and your code reaches both through that one user.

Your product

external_user_id

{external_user_id}

Pipedream Connect

Managed identity

Auth · tools · routing

Gmail

Connected account

IMAP

Connected account

TOOLS

Gmail tools

The Gmail tools this pairing puts in reach, each one running on your user's own connected account.

View all 26 Gmail tools →

Actions top 8 of 21

Triggers top 4 of 5

x-pd-app-slug
gmail,imap
Primary app
Gmail (gmail)
Second app
IMAP (imap)
Authentication
OAuth + API key
Available actions
22
Available triggers
6