Guide

Vercel Connect

Use @github-tools/sdk/connect to mint scoped GitHub tokens from a Vercel Connect connector, preset-derived scopes, zero boilerplate.

For agents deployed on Vercel, Vercel Connect replaces long-lived PATs. Attach a GitHub connector to your project and mint short-lived, scoped tokens at runtime, with no secret to store.

The @github-tools/sdk/connect subpath wraps Connect with preset-derived scopes so you only think about the connector and preset.

Quick start (AI SDK)

connect-tools.ts
import { connectGithubTools } from '@github-tools/sdk/connect'
import { generateText } from 'ai'

const tools = connectGithubTools('github/my-connector', {
  preset: 'code-review',
})

const { text } = await generateText({
  model: 'anthropic/claude-sonnet-4.6',
  tools,
  prompt: 'Summarize open PRs on my-org/my-repo.',
})

Scopes are derived automatically from the preset, see the preset → Connect scope matrix.

eve extension

The eve extension (recommended) takes a connector field directly in its mount config: no separate Connect import, and no build.externalDependencies workaround needed (the extension is pre-built via eve extension build, unlike the workspace-linked direct import below):

agent/agent.ts
import { defineAgent } from 'eve'

export default defineAgent({
  model: 'anthropic/claude-sonnet-5',
})
agent/extensions/github.ts
import githubExtension from '@github-tools/eve-extension'

export default githubExtension({
  connector: 'github/my-connector',
  preset: 'code-review',
})

See examples/eve-extension-agent for a runnable example.

eve agent

Deprecated. This pattern uses the deprecated direct @github-tools/sdk/eve import. Prefer the eve extension above for new agents.
agent/agent.ts
import { defineAgent } from 'eve'

export default defineAgent({
  model: 'anthropic/claude-sonnet-5',
  // TODO(eve-connect-bundle): remove when eve externalizes transitive @vercel/connect
  build: {
    externalDependencies: ['@vercel/connect'],
  },
})
agent/tools/github.ts
import { connectGithubTools } from '@github-tools/sdk/connect/eve'

export default connectGithubTools('github/my-connector', {
  preset: 'maintainer',
})

connectGithubTools mints the Connect token lazily (inside each tool execute). Do not await getToken(...) at module top level in agent/tools/, that runs at import/build time and fails without the Vercel OIDC header.

See examples/eve-agent for a runnable example.

Token provider only

When you need a lazy token for custom tool factories:

connect-token.ts
import { connectGithubToken } from '@github-tools/sdk/connect'
import { createGithubTools } from '@github-tools/sdk'

const tools = createGithubTools({
  preset: 'ci-ops',
  token: connectGithubToken('github/my-connector', { preset: 'ci-ops' }),
})

Pass the same preset (and the same include / exclude, when you use them) to both calls. connectGithubToken derives Connect scopes from its own selection options, independently of the ones you give createGithubTools. Omitting preset with no include mints a token scoped to the union of every preset. Passing include alone derives scopes from that tool set — it does not mint the full admin union.

Multi-tenant and repository scoping

Override Connect parameters when you need installation targeting or narrower repository access:

connect-override.ts
import { connectGithubTools } from '@github-tools/sdk/connect'

const tools = connectGithubTools('github/my-connector', {
  preset: 'issue-triage',
  connect: {
    installationId: 'inst_abc',
    repositories: ['vercel-labs/github-tools'],
    scopes: ['issues:write'], // replaces preset-derived scopes when provided
  },
})

subject is always { type: 'app' }, same as connectGitHubAdapter from @vercel/connect.

Dynamic connector selection

connector accepts a () => string | Promise<string> resolver instead of a static name, useful when the connector should vary by environment or tenant. It's re-resolved on every call, right alongside the token:

connect-dynamic.ts
import { connectGithubTools } from '@github-tools/sdk/connect'

const tools = connectGithubTools(
  () => (process.env.VERCEL_ENV === 'production' ? 'github/prod-connector' : 'github/preview-connector'),
  { preset: 'code-review' },
)

The same resolver works with connectGithubToken and the eve variant of connectGithubTools.

Setup checklist

Create a GitHub connector

Create a connector from the Vercel dashboard (or vercel connect in the CLI), then install it on the GitHub org or user account your agent needs.

Or jump straight to the GitHub connector creation form with this deeplink.

Link the connector to the Vercel project that runs your agent. On Vercel, the SDK authenticates automatically with the deployment OIDC token. For local development, run vercel link then vercel env pull.

Install the peer dependency

pnpm add @vercel/connect

@vercel/connect is an optional peer dependency of @github-tools/sdk, install it only when using the /connect subpath.

Manual getToken (escape hatch)

If you need full control over every ConnectTokenParams field, call getToken via a lazy token provider (not a top-level await). See Tokens & Auth.

API reference

External references