OpenAI provides an API playground for developers to test prompts and tool calling, which provides an easy way to test Pipedream MCP. Get started below.
Send a prompt to OpenAI with the MCP server as a tool call
Copy
Ask AI
import OpenAI from 'openai';import { PipedreamClient } from "@pipedream/sdk";// Initialize the Pipedream SDK clientconst pd = new PipedreamClient({ projectEnvironment: PIPEDREAM_ENVIRONMENT, clientId: PIPEDREAM_CLIENT_ID, clientSecret: PIPEDREAM_CLIENT_SECRET, projectId: PIPEDREAM_PROJECT_ID});// Find the app to use for the MCP server// For this example, we'll use Notionconst apps = await pd.apps.list({ q: "notion" });const appSlug = apps.data[0].name_slug; // e.g., "notion"// Get access token for MCP server authconst accessToken = await pd.rawAccessToken;// Send the unique ID that you use to identify this user in your systemconst externalUserId = 'abc-123'; // Used in MCP URL to identify the user// Initialize OpenAI clientconst openaiClient = new OpenAI();// Make the OpenAI request with the MCP serverconst response = await openaiClient.responses.create({ model: 'gpt-4.1', tools: [ { type: 'mcp', server_label: appSlug, server_url: `https://remote.mcp.pipedream.net`, headers: { Authorization: `Bearer ${accessToken}`, "x-pd-project-id": PIPEDREAM_PROJECT_ID, "x-pd-environment": PIPEDREAM_ENVIRONMENT, "x-pd-external-user-id": externalUserId, "x-pd-app-slug": appSlug, }, require_approval: 'never' } ], input: 'Summarize my most recently created Notion doc for me and help draft an email to our customers'});console.log(response);