# Fauna — Pipedream Connect

> The distributed serverless database combining the flexibility of NoSQL with the relational querying capabilities of SQL systems.

- API slug: `faunadb` (use in MCP headers and tool keys)
- Auth: API key (Pipedream-managed)
- Categories: Databases
- Website: https://fauna.com/
- This page (HTML): https://pipedream.com/apps/faunadb
- Tools: 4 actions · 1 trigger

## 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: faunadb`

```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": "faunadb",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// e.g. run Execute GraphQL Query:
const result = await mcp.callTool({
  name: "faunadb-execute-graphql-query",
  arguments: {
    query: "Query",
  },
})
```

Docs: [MCP guide](https://pipedream.com/docs/connect/mcp/developers.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: "faunadb-execute-graphql-query",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    faunadb: { authProvisionId: "apn_xxxxxxx" },
    query: "Query",
  },
})
```

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

## Actions (4)

### `faunadb-execute-graphql-query` — Execute GraphQL Query (Write)

Performs an arbitrary authorized GraphQL query. See docs here

Full schema: https://pipedream.com/apps/faunadb/actions/execute-graphql-query.md

### `faunadb-import-graphql-schema` — Import GraphQL schema (Write)

Import graphQL schema to a database. See docs here

Full schema: https://pipedream.com/apps/faunadb/actions/import-graphql-schema.md

### `faunadb-list-collections-options` — List Collections Options (Read-only)

Retrieves available options for the Collections field.

Full schema: https://pipedream.com/apps/faunadb/actions/list-collections-options.md

### `faunadb-read-from-collection` — Read From Fauna Collection (Read-only)

Reads all documents from a given Fauna collection. See docs here

Full schema: https://pipedream.com/apps/faunadb/actions/read-from-collection.md

## Triggers (1)

### `faunadb-changes-to-collection` — New or Removed Documents in a Collection (Polling)

Emit new event each time you add or remove a document from a specific collection, with the details of the document.

Full schema: https://pipedream.com/apps/faunadb/triggers/changes-to-collection.md

---

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