diff --git a/docs-v2/pages/connect/mcp/openai.mdx b/docs-v2/pages/connect/mcp/openai.mdx index 0368d486d2179..b857977e928a2 100644 --- a/docs-v2/pages/connect/mcp/openai.mdx +++ b/docs-v2/pages/connect/mcp/openai.mdx @@ -143,3 +143,82 @@ curl -X POST https://api.openai.com/v1/chat/completions \ + +## Testing in OpenAI's API Playground + +OpenAI provides an API playground for developers to test prompts and tool calling: +[https://platform.openai.com/playground/prompts](https://platform.openai.com/playground/prompts?models=gpt-4.1) + +1. Navigate to [OpenAI's playground](https://platform.openai.com/playground/prompts?models=gpt-4.1) and sign in with your OpenAI account +2. Click the **Create** button in the **Tools** section, then select **Pipedream** +3. You'll need these inputs to get set up: + +- [Pipedream project ID](#copy-your-project-id) +- [Pipedream environment](#define-the-environment) +- [Developer access token](#generate-an-access-token) + + + +### Copy your project ID + +1. Open an existing Pipedream project or create a new one at [pipedream.com/projects](https://pipedream.com/projects) +2. Click the **Settings** tab, then copy your **Project ID** + +### Define the environment + +- Since you're testing for yourself, you should use `development` +- Use `production` when you're ready to ship your app to users + +### Generate an access token + +**First, create an OAuth client in Pipedream:** + +1. Visit the [API settings](https://pipedream.com/settings/api) for your workspace +2. Click the **New OAuth Client** button and give it a name +3. Copy the client ID and secret + +**Next, get an access token:** + +In the client credentials model, as a developer, you exchange your OAuth client ID and secret for a short-lived access token to make API requests. + + + +```javascript +import { createBackendClient } from "@pipedream/sdk/server"; + +// Initialize the Pipedream SDK client +const pd = createBackendClient({ + environment: PIPEDREAM_ENVIRONMENT, + credentials: { + clientId: PIPEDREAM_CLIENT_ID, + clientSecret: PIPEDREAM_CLIENT_SECRET, + }, + projectId: PIPEDREAM_PROJECT_ID +}); + +const accessToken = await pd.rawAccessToken(); + +console.log(accessToken); +``` + + +```bash +curl https://api.pipedream.com/v1/oauth/token \ + -H 'Content-Type: application/json' \ + -d '{ + "grant_type": "client_credentials", + "client_id": "", + "client_secret": "" + }' +``` + + + + + +### Playground limitations + +- The server URL that's defined in OpenAI's playground uses two static fields. In practice, you'll define those dynamically in your app: + - `external_user_id`: `demo-openai-user-123` + - `app_slug`: `google_calendar` +- You'll also define the `PIPEDREAM_PROJECT_ID` and `PIPEDREAM_ENVIRONMENT` in your environment once, then use the Pipedream SDK or REST API to get a fresh access token. \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04caccdb3f1e9..b68571f6d6bd3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11468,8 +11468,7 @@ importers: specifier: ^1.4.1 version: 1.6.6 - components/scrapecreators: - specifiers: {} + components/scrapecreators: {} components/scrapegraphai: dependencies: @@ -15455,6 +15454,14 @@ importers: specifier: ^6.0.0 version: 6.2.0 + modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/cjs: {} + + modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/esm: {} + + modelcontextprotocol/node_modules2/zod-to-json-schema/dist/cjs: {} + + modelcontextprotocol/node_modules2/zod-to-json-schema/dist/esm: {} + packages/ai: dependencies: '@pipedream/sdk':