CONNECT APP
Build with Mode
Answer any question, fast. Mode brings SQL, Python, Rstats and custom visualizations together in one analytics platform.
Data Analytics
- API key
MCP
Give your agent Mode tools
Every Mode action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Mode account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "mode",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Create Query:
const result = await mcp.callTool({
name: "mode-create-query",
arguments: {
reportToken: "Report Token",
dataSourceId: 10,
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", # any stable ID for this user in your system
"x-pd-app-slug": "mode",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Create Query:
result = await session.call_tool("mode-create-query", {
"reportToken": "Report Token",
"dataSourceId": 10,
})API PROXY
Call the Mode API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Mode API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://api.example.com/v1/me",
})
// Any allowed Mode endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://api.example.com/v1/me
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkuZXhhbXBsZS5jb20vdjEvbWU?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Mode actions from your backend
Connect a user's Mode account once, then run Create Query on their behalf from your own code — TypeScript, Python, or plain HTTP.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "mode-create-query",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
mode: { authProvisionId: "apn_xxxxxxx" },
reportToken: "Report Token",
dataSourceId: 10,
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="mode-create-query",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"mode": {"authProvisionId": "apn_xxxxxxx"},
"reportToken": "Report Token",
"dataSourceId": 10,
},
)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "mode-create-query",
"configured_props": {
"mode": { "authProvisionId": "apn_xxxxxxx" },
"reportToken": "Report Token",
"dataSourceId": 10
}
}'TOOLS
Mode actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Create Query
actionCreate a new query in a report. See the documentationWritev0.0.1 -
Delete Query
actionPermanently delete a query from a report. See the documentationWritev0.0.1 -
Delete Report
actionPermanently delete a report. See the documentationWritev0.0.1 -
Get Account
actionRetrieve the Mode workspace/account object for the connected organization. Call this to confirm the authenticated organization and inspect its plan and counts. See the documentationRead-onlyv0.0.1 -
Get Data Source
actionRetrieve a single data source by its token. See the documentationRead-onlyv0.0.2 -
Get Query
actionRetrieve a single query within a report. See the documentationRead-onlyv0.0.1 -
Get Report
actionRetrieve a single report by its token. See the documentationRead-onlyv0.0.1 -
Get Report Run
actionRetrieve a single report run, including itsstate(pending, enqueued, running_notebook, succeeded, failed, cancelled, completed). Use this to poll a run triggered by Run Report. See the documentationRead-onlyv0.0.2 -
List Data Sources
actionList the data sources in the organization. Each object contains an integerid(used by Create Query / Update Query) and a stringtoken(used by Get Data Source). See the documentationRead-onlyv0.0.2 -
List Queries
actionList all queries belonging to a report. Use List Reports to find the report token, then use this to findquerytokens for Get Query, Update Query, and Delete Query. See the documentationRead-onlyv0.0.2 -
List Report Runs
actionList the runs for a given report. See the documentationRead-onlyv0.0.1 -
List Reports
actionList the reports belonging to a specific space. See the documentationRead-onlyv0.0.1 -
List Spaces
actionList the spaces (called Collections in the Mode UI) visible to the authenticated user. See the documentationRead-onlyv0.0.1 -
Run Report
actionTrigger a new run of a report. Returns a run object whosetokencan be passed to Get Report Run to poll the run state. See the documentationWritev0.0.2 -
Update Query
actionUpdate an existing query in a report. See the documentationWritev0.0.1 -
Update Report
actionUpdate a report's name, description, or move it to a different space. See the documentationWritev0.0.2
No Mode triggers are available yet.
- App slug
- mode
- Authentication
- API key
- Categories
- Data Analytics
- Actions
- 16
- Triggers
- 0
- API proxy
- Available