diff --git a/docs-v2/pages/connect/components.mdx b/docs-v2/pages/connect/components.mdx index f7e8a860588a2..112b2a6f8a867 100644 --- a/docs-v2/pages/connect/components.mdx +++ b/docs-v2/pages/connect/components.mdx @@ -45,7 +45,7 @@ Before sending requests to the API, make sure to [authenticate using a Pipedream ```javascript -// Initialize the Pipedream client with the SDK +// Initialize the Pipedream SDK client import { createBackendClient } from "@pipedream/sdk/server"; diff --git a/docs-v2/pages/connect/mcp/developers.mdx b/docs-v2/pages/connect/mcp/developers.mdx index 66c0199fa2bfc..8ac112025e0a5 100644 --- a/docs-v2/pages/connect/mcp/developers.mdx +++ b/docs-v2/pages/connect/mcp/developers.mdx @@ -83,7 +83,7 @@ Pipedream provides [{process.env.PUBLIC_APPS}+ APIs as MCP servers](https://mcp. ```javascript import { createBackendClient } from "@pipedream/sdk/server"; -// Initialize the Pipedream client with the SDK +// Initialize the Pipedream SDK client const pd = createBackendClient({ environment: PIPEDREAM_ENVIRONMENT, credentials: { @@ -105,7 +105,7 @@ const apps = await pd.getApps(); ```javascript import { createBackendClient } from "@pipedream/sdk/server"; -// Initialize the Pipedream client with the SDK +// Initialize the Pipedream SDK client const pd = createBackendClient({ environment: PIPEDREAM_ENVIRONMENT, credentials: { @@ -148,7 +148,7 @@ To authenticate requests to Pipedream's MCP server, you need to include an acces ```javascript import { createBackendClient } from "@pipedream/sdk/server"; -// Initialize the Pipedream client with the SDK +// Initialize the Pipedream SDK client const pd = createBackendClient({ environment: PIPEDREAM_ENVIRONMENT, credentials: { @@ -182,19 +182,40 @@ curl -s -X POST https://api.pipedream.com/v1/oauth/token \ Include these headers in every HTTP request: ```javascript -{ - Authorization: `Bearer ${PIPEDREAM_ACCESS_TOKEN}`, - "x-pd-project-id": PIPEDREAM_PROJECT_ID, // proj_xxxxxxx - "x-pd-environment": PIPEDREAM_ENVIRONMENT // development | production -} +import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; +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 +}); + +// Retrieve your developer access token via the Pipedream SDK +const accessToken = await pd.rawAccessToken(); +const serverUrl = process.env.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 + } + } +}); ``` ### 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 +- `GET /:external_user_id/:app`: app-specific connection endpoint +- `POST /:external_user_id/:app/messages`: app-specific message handler #### Using the `Dockerfile` diff --git a/docs-v2/pages/connect/mcp/openai.mdx b/docs-v2/pages/connect/mcp/openai.mdx index 60e4eb2cf276f..0368d486d2179 100644 --- a/docs-v2/pages/connect/mcp/openai.mdx +++ b/docs-v2/pages/connect/mcp/openai.mdx @@ -2,7 +2,7 @@ import { Callout, Tabs, Steps } from 'nextra/components' # Using Pipedream MCP with OpenAI -Access {process.env.PUBLIC_APPS}+ APIs and 10,000+ tools in OpenAI using Pipedream Connect. MCP makes it easy to extend the capabilities of any LLM or agent, and Pipedream offers drop-in support for [calling tools in OpenAI](https://platform.openai.com/docs/guides/tools?api-mode=responses) . +Access {process.env.PUBLIC_APPS}+ APIs and 10,000+ tools in OpenAI using Pipedream Connect. MCP makes it easy to extend the capabilities of any LLM or agent, and Pipedream offers drop-in support for [calling tools in OpenAI](https://platform.openai.com/docs/guides/tools-remote-mcp). Pipedream Connect includes built-in user authentication for [every MCP server](https://mcp.pipedream.com), 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](/connect/mcp/developers/#user-account-connections). @@ -51,7 +51,7 @@ Below is an end to end example showing how to: import OpenAI from 'openai'; import { createBackendClient } from "@pipedream/sdk/server"; -// Initialize the Pipedream client with the SDK +// Initialize the Pipedream SDK client const pd = createBackendClient({ environment: PIPEDREAM_ENVIRONMENT, credentials: {