Pipedream Connect includes built-in user authentication for every MCP server, which means you don’t need to build any authorization flows or deal with token storage and refresh in order to make authenticated requests on behalf of your users. Learn more here.

Overview

Pipedream’s MCP server code is publicly available on GitHub, and you have two options for using Pipedream’s MCP server in your app:
  1. Use Pipedream’s remote MCP server (most common)
  2. Self-host Pipedream’s MCP server
Try out Pipedream MCP in our chat app at chat.pipedream.com and explore the code here.

Key Pipedream concepts to understand

external_user_id
  • This is your user’s ID, in your system: whatever you use to uniquely identify them
  • Requests made for that user ID are coupled to that end user and their connected accounts (learn more)
app
  • The app’s “name slug” (the unique identifier for the app)
  • Check out the app discovery docs to learn how to discover and use available apps

Tool modes

Pipedream MCP supports different methods for interacting with tools. Learn about the available modes in the Tool Modes section of the docs.

Getting started

Prerequisites

To use either the remote or self-hosted MCP server, you’ll need:
  1. A Pipedream account
  2. A Pipedream project. Accounts connected via MCP will be stored here.
  3. Pipedream OAuth credentials

Set up your environment

Set the following environment variables:
PIPEDREAM_CLIENT_ID=your_client_id
PIPEDREAM_CLIENT_SECRET=your_client_secret
PIPEDREAM_PROJECT_ID=your_project_id # proj_xxxxxxx
PIPEDREAM_ENVIRONMENT=development # development | production
Learn more about environments in Pipedream Connect.

Authentication

Developer authentication

Your application authenticates with Pipedream using client credential OAuth. See below for details.

User account connections

One of the core features of Pipedream Connect and the MCP server is the ability for your users to easily connect their accounts without having to build any of the authorization flow or handle token storage. You can handle account connections in one of two ways in your app:
Add a button in your UI
  • Use Pipedream’s frontend SDK to let users connect their account directly in your UI
  • You can see an example of this when you connect any account in mcp.pipedream.com
Return a link
  • Use Connect Link to let your users connect their account in a new browser tab
  • This is handled automatically by Pipedream’s MCP server and there’s no additional implementation required
  • If a user doesn’t have a connected account that’s required for a given tool call, the server will return a URL in the tool call response:
https://pipedream.com/_static/connect.html?token=ctok_xxxxxxx&connectLink=true&app={appSlug}

Discover available MCP servers

Pipedream provides + APIs as MCP servers. Each server corresponds to an app integration (like Notion, Gmail, or Slack) and has its own specific set of tools. For detailed information on discovering apps and enabling automatic app discovery, check out app discovery section.

Use Pipedream’s remote MCP server

The remote MCP server is in beta, and we’re looking for feedback. During the beta, the API is subject to change.

Supported transport types

The Pipedream MCP server supports both SSE and streamable HTTP transport types dynamically, with no configuration required by the developer or MCP client.

Base URL

https://remote.mcp.pipedream.net

API Authentication

To authenticate requests to Pipedream’s MCP server, you need to include an access token with every HTTP request. Here’s how to get it:
import { PipedreamClient } from "@pipedream/sdk";
 
// Initialize the Pipedream SDK client
const client = new PipedreamClient({
  projectEnvironment: PIPEDREAM_ENVIRONMENT,
  clientId: PIPEDREAM_CLIENT_ID,
  clientSecret: PIPEDREAM_CLIENT_SECRET,
  projectId: PIPEDREAM_PROJECT_ID
});
 
// Get access token for MCP server auth
const response = await client.oauthTokens.create({
  clientId: PIPEDREAM_CLIENT_ID,
  clientSecret: PIPEDREAM_CLIENT_SECRET,
});
const accessToken = response.access_token;
 
console.log(accessToken);

Params

  • Below are params that you should send with every HTTP request to Pipedream’s MCP server.
  • To enable broad support for various MCP clients, you can pass these params via HTTP headers or as query params on the URL.
HeaderQuery ParamValueRequired?
x-pd-project-idprojectIdproj_xxxxxxxYes
x-pd-environmentenvironmentdevelopment, productionYes
x-pd-external-user-idexternalUserId<your-users-id>Yes
x-pd-app-slugapplinear, notion, etcYes*
x-pd-tool-modetoolModesub-agent, tools-only, full-configNo Defaults to sub-agent
x-pd-app-discoveryappDiscoverytrueNo
*Required unless using appDiscovery=true

Example request

import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import { PipedreamClient } from "@pipedream/sdk";
 
// Initialize the Pipedream SDK client
const client = new PipedreamClient({
  projectEnvironment: PIPEDREAM_ENVIRONMENT,
  clientId: PIPEDREAM_CLIENT_ID,
  clientSecret: PIPEDREAM_CLIENT_SECRET,
  projectId: PIPEDREAM_PROJECT_ID
});
 
// Retrieve your developer access token via the Pipedream SDK
const accessToken = await client.rawAccessToken;
const serverUrl = MCP_SERVER_URL || `https://remote.mcp.pipedream.net`;
 
const transport = new StreamableHTTPClientTransport(new URL(serverUrl), {
  requestInit: {
    headers: {
      "Authorization": `Bearer ${accessToken}`,
      "x-pd-project-id": PIPEDREAM_PROJECT_ID, // proj_xxxxxxx
      "x-pd-environment": PIPEDREAM_ENVIRONMENT, // development | production
      "x-pd-external-user-id": EXTERNAL_USER_ID, // the user's ID from your system
      "x-pd-app-slug": APP_SLUG, // notion, linear, gmail, etc
    }
  }
});

Self-host Pipedream’s MCP server

Hosting the MCP server locally or in your app will expose these routes:
  • GET /:external_user_id/:app: app-specific connection endpoint
  • POST /:external_user_id/:app/messages: app-specific message handler

Using the Dockerfile

You can build and run the container from the reference implementation:
> docker build -t pipedream-connect .
> docker run -d --name pd-mcp -p 3010:3010 --env-file .env pipedream-connect:latest

Running the server using npx

npx @pipedream/mcp sse
The current npx package only supports the sse transport type, http is coming soon.

Running the server locally

You can also run the server locally and even customize the MCP server for your specific requirements:
# Clone the repo
git clone https://github.com/PipedreamHQ/pipedream
cd pipedream/modelcontextprotocol
 
# Install dependencies
pnpm install
 
# Start the server
pnpm dev:http
See the MCP server README for detailed instructions on customization options.

Debugging

You can use the optional env var PD_SDK_DEBUG to print out all the requests and responses going to the Connect API:
PD_SDK_DEBUG=true pnpm dev:http

Using the MCP inspector

The MCP inspector can be helpful when debugging tool calls.
npx @modelcontextprotocol/inspector
Enter the server URL: If using Pipedream’s remote server:
https://remote.mcp.pipedream.net/{external_user_id}/{app_slug}
If running locally:
http://localhost:3010/{external_user_id}/{app_slug}

Using custom tools

Publish custom tools to your workspace to use them in the Pipedream MCP server for the relevant app. This lets you add custom and unique functionality that may not be available in the public registry.