# Cloudflare OS Gatekeepers: Complete Guide to Third-Party Service Integrations

> Explore Cloudflare OS Gatekeepers and their integrations with Slack, GitHub, Google Workspace, and more. Discover how to connect third-party services seamlessly.

- Repository: [Cloudflare/cloudflare-os](https://github.com/cloudflare/cloudflare-os)
- Tags: deep-dive
- Published: 2026-09-04

---

**Cloudflare OS Gatekeepers integrate with ten distinct third-party services—including Slack, GitHub, Google Workspace, Linear, Home Assistant, and the Model Context Protocol (MCP)—exposing them to Gadgets through a uniform typed RPC API that auto-discovers capabilities from `GATEKEEPER_*` environment bindings.**

The `cloudflare/cloudflare-os` repository implements **Gatekeepers** as isolated Cloudflare Workers that act as secure bridges between external APIs and internal Gadgets. Each Gatekeeper handles its own OAuth 2.0 flow and exposes service-specific RPC methods, allowing Gadgets to query Slack workspaces, GitHub repositories, or Linear projects without managing separate authentication logic.

## Available Gatekeeper Service Integrations

Cloudflare OS ships with ten production-ready Gatekeepers, each residing in the `packages/gatekeeper-*` directory structure. The backend auto-registers these workers by scanning for `GATEKEEPER_*` service bindings at deployment time.

### Slack Workspace Integration

The **Slack Gatekeeper** ([`packages/gatekeeper-slack/src/slack.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-slack/src/slack.ts)) connects to Slack workspaces using user-level OAuth tokens (`xoxp-…`). It exposes read-only access to channels, direct messages, threads, members, and search functionality via the Slack Web API.

Session objects implement the `SlackWorkspaceSession` interface defined in [`packages/gatekeeper-slack/src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-slack/src/types.d.ts), providing typed methods like `listChannels()` and `searchMessages()`.

### GitHub Repository Management

Located in [`packages/gatekeeper-github/src/github.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-github/src/github.ts), the **GitHub Gatekeeper** authenticates via OAuth App scopes including `repo`, `read:user`, and `user:email`. It exposes repository data, issues, and pull requests through the GitHub REST API.

The `GitHubRepoSession` type provides methods such as `getIssue()` and `listPullRequests()`, wrapping the underlying REST endpoints with typed RPC signatures.

### Google Workspace Services

The **Google Gatekeeper** ([`packages/gatekeeper-google/src/google.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-google/src/google.ts)) supports Gmail, Drive, Calendar, and other Google services based on configurable OAuth 2.0 scopes defined in [`deploy-inputs.json`](https://github.com/cloudflare/cloudflare-os/blob/main/deploy-inputs.json). RPC session methods wrap the official Google client libraries, exposing interfaces like `GoogleGmailSession` with `listMessages()` and `sendMessage()` capabilities.

### Model Context Protocol (MCP) Servers

**MCP Gatekeepers** ([`packages/gatekeeper-mcp/src/mcp.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-mcp/src/mcp.ts) and [`packages/gatekeeper-mcp/src/server-id.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-mcp/src/server-id.ts)) dynamically integrate any Model Context Protocol server. They auto-generate session methods from the MCP server's `inputSchema`, supporting both **full-server** grants (access to all tools) and **named-tool** grants (restricted to specific tools).

The `Mcp<Name>Session` interface is generated at runtime based on the remote server's capabilities.

### Linear Project Management

Found in [`packages/gatekeeper-linear/src/linear.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-linear/src/linear.ts), the **Linear Gatekeeper** uses the Linear GraphQL API to expose read-only session methods such as `listIssues()`, `listProjects()`, and `searchIssues()`. The `LinearSession` type provides typed access to issue-tracking data without exposing write operations directly.

### Home Assistant Smart Home Integration

The **Home Assistant Gatekeeper** ([`packages/gatekeeper-homeassistant/src/homeassistant.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-homeassistant/src/homeassistant.ts)) binds to Home Assistant servers via REST API. It exposes entity read/write methods and event streaming capabilities, allowing Gadgets to query sensor states or trigger automations through the `HomeAssistantSession` interface.

### Email (SMTP/IMAP)

Located in [`packages/gatekeeper-email/src/email.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-email/src/email.ts), the **Email Gatekeeper** provides a generic email interface built on Cloudflare Workers Email or external SMTP relays. Session methods include `send()`, `list()`, and `search()`, abstracting protocol details behind a unified RPC API.

### Cloudflare Observability

The **Cloudflare Gatekeeper** ([`packages/gatekeeper-cloudflare/src/observability-api.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-cloudflare/src/observability-api.ts) and [`src/observability-session.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/src/observability-session.ts)) reads account-wide or worker-scoped telemetry data. It exposes read-only access to billing and performance metrics through the internal observability APIs.

### MCP Portal (Admin-Configured)

**MCP Portal** ([`packages/gatekeeper-mcp-portal/src/portal.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-mcp-portal/src/portal.ts)) functions identically to the standard MCP Gatekeeper but connects to a pre-configured, admin-provided MCP server endpoint. Only administrators can add the `GATEKEEPER_MCP_PORTAL` binding, enforcing centralized control over sensitive tool access.

### Scheduler and Persistent Callbacks

The **Scheduler Gatekeeper** ([`packages/gatekeeper-scheduler/src/driver.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-scheduler/src/driver.ts)) integrates with Cloudflare Workers Observability Scheduler. It provides a singleton `ScheduleDriver` Durable Object for registering periodic workspace callbacks, enabling Gadgets to schedule recurring tasks without external cron services.

## Gatekeeper Architecture and Session Lifecycle

Understanding how Cloudflare OS Gatekeepers manage service integrations requires examining four architectural phases defined in the source code:

1. **Binding Discovery** – The backend scans environment bindings matching `GATEKEEPER_*` and registers each as a capability that Gadgets can request during the grant flow.

2. **OAuth Flow** – Each Gatekeeper initializes its own OAuth 2.0 handler (or dynamic client registration for MCP) using `CLIENT_ID` and `CLIENT_SECRET` variables. The Slack Gatekeeper, for example, redirects to Slack's OAuth endpoint and exchanges codes for `xoxp` tokens.

3. **Session Creation** – Upon successful authentication, Gatekeepers instantiate typed session objects (e.g., `SlackWorkspaceSession`, `GitHubRepoSession`) that implement the RPC contracts defined in [`src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/src/types.d.ts) files.

4. **Capability Enforcement** – Sessions respect granularity constraints: Slack differentiates between workspace, conversation, and thread grants, while MCP supports full-server versus named-tool restrictions. The system logs all calls via `@gadgets/backend-utils/logger` and disposes stubs to prevent resource leaks.

## Implementing Gatekeeper Integrations in Code

Gadgets access Gatekeeper sessions through environment bindings. Below are minimal implementations for the most common service integrations.

### Querying Slack Channels

```typescript
// Access the Slack workspace session
const slack = await env.GATEKEEPER_SLACK as SlackWorkspaceSession;
const channels = await slack.listChannels({ cursor: undefined });

for (const ch of channels.items) {
  console.log(`Channel: ${ch.name}`);
}

```

*Source*: [`packages/gatekeeper-slack/src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-slack/src/types.d.ts)

### Fetching GitHub Issues

```typescript
const gh = await env.GATEKEEPER_GITHUB as GitHubRepoSession;
const issue = await gh.getIssue({ 
  owner: "cloudflare", 
  repo: "cloudflare-os", 
  number: 123 
});

console.log(issue.title, issue.body);

```

*Source*: [`packages/gatekeeper-github/src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-github/src/types.d.ts)

### Calling MCP Tools

```typescript
// Access a Linear MCP server session
const linear = await env.MCP_LINEAR as McpLinearSession;
const resp = await linear.searchIssues({ query: "status:open" });

if (resp.status === "ok") {
  console.log(resp.text);
}

```

*Source*: [`packages/gatekeeper-mcp/src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-mcp/src/types.d.ts)

### Listing Gmail Messages

```typescript
const google = await env.GATEKEEPER_GOOGLE as GoogleGmailSession;
const msgs = await google.listMessages({ maxResults: 10 });

console.log(`Retrieved ${msgs.items.length} recent emails`);

```

*Source*: [`packages/gatekeeper-google/src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-google/src/types.d.ts)

### Accessing Linear Projects

```typescript
const linear = await env.GATEKEEPER_LINEAR as LinearSession;
const projects = await linear.listProjects({});

for (const p of projects.items) {
  console.log(p.name);
}

```

*Source*: [`packages/gatekeeper-linear/src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/packages/gatekeeper-linear/src/types.d.ts)

## Security Model and Write Operations

All Cloudflare OS Gatekeepers operate **read-only by default**. When a service requires write operations—such as creating a GitHub issue or posting to Slack—the Gatekeeper enqueues the mutation for explicit user approval rather than executing immediately. Approved writes are recorded as actions in the backend audit log.

This security model applies uniformly across integrations, from the `GitHubRepoSession` creating pull request comments to the `EmailSession` sending messages via SMTP.

## Summary

- **Cloudflare OS Gatekeepers** integrate with ten services: Slack, GitHub, Google Workspace, Linear, Home Assistant, Email, MCP servers, MCP Portal, Scheduler, and Cloudflare Observability.
- Each Gatekeeper resides in `packages/gatekeeper-<service>/` and implements service-specific OAuth in files like [`src/slack.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/src/slack.ts), [`src/github.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/src/github.ts), or [`src/google.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/src/google.ts).
- **RPC sessions** (e.g., `SlackWorkspaceSession`, `GitHubRepoSession`) provide typed methods that abstract underlying REST, GraphQL, or SMTP protocols.
- **Auto-discovery** occurs via `GATEKEEPER_*` environment bindings scanned at deployment.
- **Read-only by default**: Write operations require explicit user approval and audit logging.

## Frequently Asked Questions

### What services do Cloudflare OS Gatekeepers integrate with?

Cloudflare OS Gatekeepers integrate with Slack, GitHub, Google Workspace (Gmail, Drive, Calendar), Linear, Home Assistant, generic email (SMTP/IMAP), Model Context Protocol (MCP) servers, MCP Portal, Cloudflare Observability, and the internal Scheduler service. Each integration exposes service-specific APIs through typed RPC sessions.

### How do Gatekeepers handle authentication with third-party services?

Each Gatekeeper implements its own OAuth 2.0 flow using `CLIENT_ID` and `CLIENT_SECRET` environment variables. The Slack Gatekeeper uses user-level `xoxp` tokens, GitHub uses OAuth App scopes (`repo`, `read:user`), and Google uses configurable OAuth 2.0 scopes. MCP Gatekeepers support dynamic client registration for server-to-server authentication.

### Are Gatekeeper operations read-only or can they write data?

Gatekeepers operate read-only by default. Write operations—such as creating GitHub issues, sending emails, or posting Slack messages—are intercepted and queued for explicit user approval. Once approved, these mutations execute and are recorded as actions in the backend audit log.

### How do I access a Gatekeeper session in my Gadget code?

Access Gatekeeper sessions through the environment object using the binding name (e.g., `env.GATEKEEPER_SLACK`). Cast the binding to the appropriate session type (such as `SlackWorkspaceSession` or `GitHubRepoSession`) to gain autocomplete and type safety for RPC methods. All session types are defined in their respective [`src/types.d.ts`](https://github.com/cloudflare/cloudflare-os/blob/main/src/types.d.ts) files.