---
title: "Installation"
description: "Install the SDK and its AI SDK peers, then give it a GitHub token."
canonical_url: "https://github-tools.com/start/installation"
---
# Installation

> Install the SDK and its AI SDK peers, then give it a GitHub token.

## Install the packages

Install `@github-tools/sdk` with its two peer dependencies, the [AI SDK](https://ai-sdk.dev) (`ai` 6 or 7) and [Zod](https://zod.dev):

<code-group>

```bash [pnpm]
pnpm add @github-tools/sdk ai zod
```

```bash [npm]
npm install @github-tools/sdk ai zod
```

```bash [yarn]
yarn add @github-tools/sdk ai zod
```

```bash [bun]
bun add @github-tools/sdk ai zod
```

</code-group>

eve, TanStack AI, Vercel Workflow and Chat SDK need more packages. Each [integration page](https://github-tools.com/integrations) lists its own.

## Set a token

The SDK reads `GITHUB_TOKEN` from the environment:

```bash [.env]
GITHUB_TOKEN=github_pat_xxxxxxxxxxxx
```

Create a [fine-grained personal access token](https://github.com/settings/personal-access-tokens/new) limited to the repositories the agent works on. Give it read access to start, and add write permissions only for the writes you plan to allow. [Auth](https://github-tools.com/auth) lists the permissions each preset needs, and how to replace the token with Vercel Connect in production.

## Check it

```ts [check.ts]
import { createGithubTools } from '@github-tools/sdk'

const tools = createGithubTools({ preset: 'repo-explorer' })
const repo = await tools.getRepository.execute!(
  { owner: 'vercel', repo: 'ai' },
  { toolCallId: 'check', messages: [] },
)

console.log(repo.fullName, repo.stars)
```

The script prints the repository name and its star count. `github_tools.TOKEN_REQUIRED` means the variable isn't loaded, and `github_tools.UNAUTHORIZED` means GitHub rejected the token. [Errors](https://github-tools.com/errors) lists the others.

## Next

[Quick start](https://github-tools.com/start/quick-start): give the tools to a model.


## Sitemap

See the full [sitemap](https://github-tools.com/sitemap.md) for all pages.
