Skip to main content

Overview

Vercel Connect holds the credentials for third-party services at the Vercel team level. Your deployed code asks it for a short-lived token whenever it needs one. With Brew connected, no Brew API key or OAuth token ever lives in your project’s environment variables. There are two ways to connect Brew:
OAuth tokens work only with the MCP server. To call the REST API, use an API-key connection.

Prerequisites

Brew Account

Sign up at brew.new and set up your brand.

Vercel Project

Link your directory with vercel link, then run vercel env pull to get a development OIDC token for Vercel Connect.

MCP Server with OAuth

Vercel Connect registers its own OAuth client with Brew, so you don’t create an app or copy a client secret.
1

Create the connector

In the Vercel dashboard, open Connect → Browse Connectors, choose Brew, and pick OAuth. From the CLI, create it by the MCP server URL, which works whether or not Brew is in the catalog yet:
Vercel reads Brew’s OAuth discovery documents and registers the client automatically. Note the connector’s UID; the examples below use brew.
2

Attach it to your project

This allows Production, Preview, and Development to request tokens. Pass -e to limit it to particular environments.
3

Install the packages

4

Connect an AI SDK route to Brew

connectAuthProvider asks Vercel Connect for a current Brew token on every MCP request:
app/api/chat/route.ts
5

Approve access in Brew

The first request for a user throws ConsentRequiredError, and the route redirects them to Brew. They sign in and choose what to connect: one brand, or All brands if they’re an organization admin. The consent page shows Returns to connect.vercel.com. After Allow access, the user starts a new chat turn, and the tools load.
The connection acts with that person’s current Brew access, and Brew re-checks it on every request. On a brand connection, every tool works on that brand. On an organization connection, brand tools need a brand_id, which the agent finds with list_brands. See MCP Authentication & Scoping.
OAuth connections pause before real sends. send_email and audience-wide run_automation return confirmation_required until the agent calls again with confirmed: true. Have your chat UI collect the person’s approval before that second call.

REST API with an API Key

1

Create a Brew API key

Create a key at brew.new/settings/api. Anyone with access to a brand can create a key for it while that brand is active. An organization key, which reaches every brand, needs an organization admin.
2

Create the connector

In the Vercel dashboard, open Connect → Browse Connectors, choose Brew, pick API key, and paste the key. If Brew isn’t in the catalog yet, create a generic API key connector instead. Once the connector exists, the key lives only in Vercel Connect. Then attach the connector to your project:
3

Call the API

getToken returns the stored key. Send it as a bearer token:
app/lib/brew.ts
With an organization key, also send X-Brand-Id on brand-scoped calls. See Authentication.

Disconnect

  • OAuth: each user’s connection appears in Brew under Settings → MCP, in the “Connected via OAuth” list, where they can disconnect it. Revoking from Vercel (revokeToken, the dashboard, or the CLI) also ends the grant in Brew. Deleting the connector revokes every grant it holds.
  • API key: delete the key at brew.new/settings/api. Removing the connector in Vercel only deletes Vercel’s copy.

Troubleshooting

The authorization request asked for something Brew doesn’t offer. Brew has one scope, brew:all, so leave the connector’s default scopes as they are. A resource other than https://brew.new/api/mcp is refused too.
An OAuth token was sent to /api/v1. OAuth tokens only work with the MCP server. Use an API-key connection for REST calls.
The connection covers the whole organization. Have the agent call list_brands and pass brand_id, or reconnect and pick one brand.
The calling project or environment isn’t attached to the connector. Run vercel connect attach <uid> for that environment, and run vercel env pull again locally if your OIDC token is older than about 12 hours.

Need Help?

Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:

Search Documentation

Type in the “Ask any question” search bar at the top left to instantly find relevant documentation pages.

ChatGPT/Claude Integration

Click “Open in ChatGPT” at the top right of any page to explore it further with ChatGPT or Claude.