Skip to content

Commit fc58edb

Browse files
Tools Mode
1 parent be1b409 commit fc58edb

File tree

2 files changed

+134
-24
lines changed

2 files changed

+134
-24
lines changed

docs-v2/pages/connect/mcp/developers.mdx

Lines changed: 126 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { Callout, Steps, Tabs } from 'nextra/components'
44

55
Add Pipedream's MCP server to your application or agent to make tool calls on behalf of your users to {process.env.PUBLIC_APPS}+ APIs and 10,000+ tools.
66

7+
<Callout type="info">
8+
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).
9+
</Callout>
10+
711
## Overview
812

913
Pipedream's MCP server code is [publicly available on GitHub](https://github.com/PipedreamHQ/pipedream/blob/master/modelcontextprotocol/README.md), and you have two options for using Pipedream's MCP server in your app:
@@ -126,39 +130,130 @@ const slackApps = await pd.getApps({ q: "slack" });
126130
</Tabs.Tab>
127131
</Tabs>
128132

129-
### Supported Tool Modes
133+
134+
### Use Pipedream's remote MCP server
135+
136+
<Callout type="info">
137+
The remote MCP server is in beta, and we're looking for feedback. During the beta, the API is subject to change.
138+
</Callout>
139+
140+
#### Supported transport types
141+
142+
The Pipedream MCP server supports both SSE and streamable HTTP transport types dynamically, with no configuration required by the developer or MCP client.
143+
144+
#### Tool modes
130145

131146
Pipedream MCP supports two methods for interacting with tools:
132147

133148
1. [Sub-agent](#sub-agent-mode) (default)
134149
2. [Tools only](#tools-only-mode)
135150

136-
#### Sub-agent mode
151+
##### Sub-agent mode
137152

138-
When using Pipedream MCP with sub-agent mode enabled (default confiuration), all of the tools that you expose to your LLM take only a single input: **`instructions`**.
153+
When using Pipedream MCP with sub-agent mode enabled, all of the tools that you expose to your LLM take only a single input: **`instruction`**.
139154

140-
The Pipedream MCP server passes that **instructions** prompt to an LLM where we farm out the configuration of the main tool using a set of agents with narrowly scoped sets of instructions and additional tools to aid in the configuration and execution of the top-level tool.
155+
The Pipedream MCP server passes the **`instruction`** to an LLM to handle the configuration of the main tool using a set of agents with narrowly scoped sets of instructions and additional tools to aid in the configuration and execution of the top-level tool.
141156

142157
- The benefit with this approach is that sub-agent mode abstracts a lot of the complexity with handling things like [remote options](/connect/components/#configure-the-component) and [dynamic props](/connect/components/#configure-dynamic-props), especially for MCP clients that don't automatically [reload tools](https://modelcontextprotocol.io/docs/concepts/tools#tool-discovery-and-updates).
143158
- However, one downside is that you hand over some of the control and observability to Pipedream in this model.
144159

145160
<Callout type="warning">
146-
While Pipedream currently eats the costs of the LLM tokens in sub-agent mode while in Beta, we'll likely charge for the LLM usage in the future.
161+
While in Beta, Pipedream eats the costs of the LLM tokens in sub-agent mode. We'll likely charge for the LLM usage in the future.
147162
</Callout>
148163

149-
#### Tools only mode
164+
<details>
165+
<summary>View the schema for the `google_sheets-add-single-row` tool in **sub-agent mode**</summary>
166+
167+
```javascript
168+
{
169+
"name": "GOOGLE_SHEETS-ADD-SINGLE-ROW",
170+
"description": "Add a single row of data to Google Sheets. [See the documentation](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append)",
171+
"inputSchema": {
172+
"type": "object",
173+
"properties": {
174+
"instruction": {
175+
"type": "string"
176+
}
177+
},
178+
"required": [
179+
"instruction"
180+
],
181+
"additionalProperties": false,
182+
"$schema": "http://json-schema.org/draft-07/schema#"
183+
}
184+
}
185+
```
186+
187+
</details>
188+
189+
##### Tools-only mode
150190

151191
To handle all tool configuration and calling yourself, you should use `tools-only` mode.
152192

153-
### Use Pipedream's remote MCP server
193+
###### Configuring dynamic props
154194

155-
<Callout type="info">
156-
The remote MCP server is in beta, and we're looking for feedback. During the beta, the API is subject to change.
157-
</Callout>
195+
- Tools that use [dynamic props](/connect/api/#reload-component-props) aren't able to be configured in one-shot since the full prop definition isn't known until certain inputs are defined.
196+
- For example, the full set of props for `google_sheets-add-single-row` aren't known until you configure the `hasHeaders` prop. Once we know if there's a header row, we can retrieve the column names from the header row and make them available as props that can be configured.
197+
- As you call each tool, you should reload the available tools for the server, and we'll expose meta tools for configuration, such as `begin_configuration_google_sheets-add-single-row`, which causes the rest of the tools to be removed and only tools relevant to the configuration are exposed.
158198

159-
#### Supported transport types
199+
{/* Need to add info for devs to step through async options */}
200+
{/* Need to add more detailed info for devs to step through dynamic props */}
160201

161-
The Pipedream MCP server supports both SSE and streamable HTTP transport types dynamically, with no configuration required by the developer or MCP client.
202+
<details>
203+
<summary>View the schema for the `google_sheets-add-single-row` tool in **tools-only mode**</summary>
204+
205+
```javascript
206+
{
207+
"name": "google_sheets-add-single-row",
208+
"description": "Add a single row of data to Google Sheets. [See the documentation](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append)",
209+
"inputSchema": {
210+
"type": "object",
211+
"properties": {
212+
"drive": {
213+
"anyOf": [
214+
{
215+
"anyOf": [
216+
{
217+
"not": {}
218+
},
219+
{
220+
"type": "string"
221+
}
222+
]
223+
},
224+
{
225+
"type": "null"
226+
}
227+
],
228+
"description": "Defaults to `My Drive`. To select a [Shared Drive](https://support.google.com/a/users/answer/9310351) instead, select it from this list.\n\nYou can use the \"CONFIGURE_COMPONENT\" tool using these parameters to get the values. key: google_sheets-add-single-row, propName: drive"
229+
},
230+
"sheetId": {
231+
"type": "string",
232+
"description": "Select a spreadsheet or provide a spreadsheet ID\n\nYou can use the \"CONFIGURE_COMPONENT\" tool using these parameters to get the values. key: google_sheets-add-single-row, propName: sheetId"
233+
},
234+
"worksheetId": {
235+
"type": "string",
236+
"description": "Select a worksheet or enter a custom expression. When referencing a spreadsheet dynamically, you must provide a custom expression for the worksheet.\n\nYou can use the \"CONFIGURE_COMPONENT\" tool using these parameters to get the values. key: google_sheets-add-single-row, propName: worksheetId"
237+
},
238+
"hasHeaders": {
239+
"type": "boolean",
240+
"description": "If the first row of your document has headers, we'll retrieve them to make it easy to enter the value for each column. Note: When using a dynamic reference for the worksheet ID (e.g. `{{steps.foo.$return_value}}`), this setting is ignored."
241+
}
242+
},
243+
"required": [
244+
"sheetId",
245+
"worksheetId",
246+
"hasHeaders"
247+
],
248+
"additionalProperties": false,
249+
"$schema": "http://json-schema.org/draft-07/schema#"
250+
}
251+
}
252+
```
253+
254+
</details>
255+
256+
{/* ![Tools-only mode](https://res.cloudinary.com/pipedreamin/image/upload/v1748583198/slack-mcp-tools-only_d1veqw.png) */}
162257

163258
#### Base URL
164259

@@ -204,19 +299,24 @@ curl -s -X POST https://api.pipedream.com/v1/oauth/token \
204299
</Tabs.Tab>
205300
</Tabs>
206301

207-
#### Required headers
302+
#### Params
208303

209-
Include these headers in every HTTP request:
304+
- Below are params that you should send with every HTTP request to Pipedram's MCP server.
305+
- To enable broad support for various MCP clients, you can pass these params via HTTP headers **or** as query params on the URL.
210306

211-
```javascript
212-
{
213-
"Authorization": `Bearer ${accessToken}`,
214-
"x-pd-project-id": PIPEDREAM_PROJECT_ID, // proj_xxxxxxx
215-
"x-pd-environment": PIPEDREAM_ENVIRONMENT // development | production
216-
}
217-
```
307+
<br />
308+
309+
<div className="highlightHeaderRowTable">
310+
| Header | Query Param | Value | Required? |
311+
|--------|---------|------------------------------|--------|
312+
| `x-pd-project-id` | `projectId` | `proj_xxxxxxx` | Yes |
313+
| `x-pd-environment` | `environment` | `development`, `production` | Yes |
314+
| `x-pd-external-user-id` | `externalUserId` | `<your-users-id>` | Yes |
315+
| `x-pd-app-slug` | `app` | `linear`, `notion`, etc | Yes |
316+
| `x-pd-tool-mode` | `toolMode` | `sub-agent`, `tools-only` | No <br /> Defaults to `sub-agent` |
317+
</div>
218318

219-
Example request:
319+
#### Example request
220320

221321
```javascript
222322
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
@@ -234,14 +334,16 @@ const pd = createBackendClient({
234334

235335
// Retrieve your developer access token via the Pipedream SDK
236336
const accessToken = await pd.rawAccessToken();
237-
const serverUrl = MCP_SERVER_URL || `https://remote.mcp.pipedream.net/${externalUserId}/${appSlug}`;
337+
const serverUrl = MCP_SERVER_URL || `https://remote.mcp.pipedream.net`;
238338

239339
const transport = new StreamableHTTPClientTransport(new URL(serverUrl), {
240340
requestInit: {
241341
headers: {
242342
"Authorization": `Bearer ${accessToken}`,
243343
"x-pd-project-id": PIPEDREAM_PROJECT_ID, // proj_xxxxxxx
244-
"x-pd-environment": PIPEDREAM_ENVIRONMENT // development | production
344+
"x-pd-environment": PIPEDREAM_ENVIRONMENT, // development | production
345+
"x-pd-external-user-id": EXTERNAL_USER_ID, // the user's ID from your system
346+
"x-pd-app-slug": APP_SLUG, // notion, linear, gmaii, etc
245347
}
246348
}
247349
});

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)