# Mode — Pipedream Connect

> Answer any question, fast. Mode brings SQL, Python, Rstats and custom visualizations together in one analytics platform.

- API slug: `mode` (use in MCP headers and tool keys)
- Auth: API key (Pipedream-managed)
- Categories: Data Analytics
- Website: https://mode.com/
- This page (HTML): https://pipedream.com/apps/mode
- Tools: 16 actions · 0 triggers

## Connect via MCP (recommended)

- Endpoint: `https://remote.mcp.pipedream.net/v3`
- Headers: `Authorization: Bearer <token>` · `x-pd-project-id` · `x-pd-environment` · `x-pd-external-user-id` · `x-pd-app-slug: mode`

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
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 accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_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,
  },
})
```

Docs: [MCP guide](https://pipedream.com/docs/connect/mcp/developers.md)

## API proxy

For a Mode endpoint with no pre-built tool, the proxy forwards your request with the connected user's credentials attached.

```bash
# 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"
```

Docs: [API proxy guide](https://pipedream.com/docs/connect/api-proxy.md)

## SDK

```ts
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,
  },
})
```

Docs: [Managed auth guide](https://pipedream.com/docs/connect/managed-auth/quickstart.md) · [Tools guide](https://pipedream.com/docs/connect/components.md)

## Actions (16)

### `mode-create-query` — Create Query (Write)

Create a new query in a report. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/create-query.md

### `mode-delete-query` — Delete Query (Write)

Permanently delete a query from a report. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/delete-query.md

### `mode-delete-report` — Delete Report (Write)

Permanently delete a report. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/delete-report.md

### `mode-get-account` — Get Account (Read-only)

Retrieve the Mode workspace/account object for the connected organization. Call this to confirm the authenticated organization and inspect its plan and counts. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/get-account.md

### `mode-get-data-source` — Get Data Source (Read-only)

Retrieve a single data source by its token. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/get-data-source.md

### `mode-get-query` — Get Query (Read-only)

Retrieve a single query within a report. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/get-query.md

### `mode-get-report` — Get Report (Read-only)

Retrieve a single report by its token. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/get-report.md

### `mode-get-report-run` — Get Report Run (Read-only)

Retrieve a single report run, including its state (pending, enqueued, running_notebook, succeeded, failed, cancelled, completed). Use this to poll a run triggered by Run Report. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/get-report-run.md

### `mode-list-data-sources` — List Data Sources (Read-only)

List the data sources in the organization. Each object contains an integer id (used by Create Query / Update Query) and a string token (used by Get Data Source). See the documentation

Full schema: https://pipedream.com/apps/mode/actions/list-data-sources.md

### `mode-list-queries` — List Queries (Read-only)

List all queries belonging to a report. Use List Reports to find the report token, then use this to find query tokens for Get Query, Update Query, and Delete Query. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/list-queries.md

### `mode-list-report-runs` — List Report Runs (Read-only)

List the runs for a given report. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/list-report-runs.md

### `mode-list-reports` — List Reports (Read-only)

List the reports belonging to a specific space. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/list-reports.md

### `mode-list-spaces` — List Spaces (Read-only)

List the spaces (called Collections in the Mode UI) visible to the authenticated user. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/list-spaces.md

### `mode-run-report` — Run Report (Write)

Trigger a new run of a report. Returns a run object whose token can be passed to Get Report Run to poll the run state. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/run-report.md

### `mode-update-query` — Update Query (Write)

Update an existing query in a report. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/update-query.md

### `mode-update-report` — Update Report (Write)

Update a report's name, description, or move it to a different space. See the documentation

Full schema: https://pipedream.com/apps/mode/actions/update-report.md

---

- All apps: https://pipedream.com/apps — index: https://pipedream.com/llms.txt
- Pipedream docs for agents: https://pipedream.com/docs/llms.txt
