GitHub
GitHub
By the end of this guide, you will have a GitHub repository — or a Projects v2 board — indexed into a semantic collection, refreshed incrementally, and searchable from the CLI or any MCP-connected AI agent.
The connector talks to GitHub's GraphQL v4 API and supports GitHub Cloud, GitHub Enterprise Cloud (SUBDOMAIN.ghe.com), and GitHub Enterprise Server.
Prerequisites
- Indexed installed and initialized with
indexed init(see Quick Start) - A repository in
owner/repoform, or a Projects v2 board inowner/numberform - A GitHub token that can read them (step 1)
Provide a Token
Indexed resolves the token in this order:
--tokenon the command linetokenin the config (sources.github.token, settable with anINDEXED__*environment variable)- the
GITHUB_TOKENenvironment variable gh auth tokenfrom the local GitHub CLI- otherwise it fails with
No GitHub token found, namingINDEXED__sources__github__token,GITHUB_TOKEN, andgh auth loginas the ways to fix it
The simplest setup, if you already use the GitHub CLI:
gh auth loginOr set a token explicitly:
export GITHUB_TOKEN=ghp_your_token_hereKeep tokens out of version control
Store credentials in a .env file and add it to .gitignore. Never put a GitHub token in a repository.
On scopes: the connector does not request or validate any particular OAuth scope — it sends your token as a bearer token to the GraphQL endpoint and lets GitHub decide. Practically, the token must be able to read the issues (and pull requests, if enabled) of every repo you pass to --repo, and read the Projects v2 board you pass to --project. Private repositories need a token with access to them. If the token cannot read a target, GitHub answers 403 and Indexed reports it as a permission error rather than a rate limit.
Index a Repository
Minimal example — indexes every issue in one repository:
indexed index create github -c platform-issues --repo octo/helloThe collection name defaults to github if you omit -c.
Pull requests are not included by default. Add them explicitly:
indexed index create github \
-c platform-issues \
--repo octo/hello \
--repo octo/api \
--include-pull-requestsNarrow the crawl with --state and --label (both optional, both repeatable in the case of --label):
indexed index create github \
-c open-bugs \
--repo octo/hello \
--state open \
--label bug \
--label "needs triage"Repos and a board together
--repo and --project can be combined. At least one of them is required — with neither, the connector refuses to start: GitHub source needs at least one of 'repos' or 'project' configured. Items reachable from both a repo and a board are deduplicated by their ID, and the board's custom field values are merged onto the repo-sourced copy.
Verify what landed:
indexed index inspect platform-issues
indexed index search "retry storm on webhook delivery" -c platform-issuesIndex a Projects v2 Board
Pass the board as owner/number. owner is an organization or a user login; number is the numeric project number from the board URL (.../projects/12 → octo/12):
indexed index create github -c roadmap --project octo/12The connector detects whether the owner is an organization or a user and reads the board accordingly. Each item becomes a document: issues and pull requests keep their owner/repo#number identity, while draft issues become project:<node-id> documents with state DRAFT and no URL. Custom field values on the board are stored as metadata and are searchable alongside the item text.
What Gets Indexed
| Entity | Included when |
|---|---|
| Issues | Always, for every --repo you pass |
| Pull requests | Only with --include-pull-requests |
| Issue and PR comments | Yes, by default (include_comments defaults to true) |
| Projects v2 items (issues, PRs, draft issues) | When --project is set |
| Board custom field values | When the item came from a --project board |
Each document is chunked into: a header chunk (# <title> plus state, labels, and author), chunks from the issue or PR body, and one chunk per comment. Labels, state, author, and project field values travel with the chunks as metadata.
Flags
indexed index create github accepts:
| Flag | Meaning |
|---|---|
-c, --collection | Collection name (default github) |
--repo owner/repo | Repository to index; repeat for more than one |
--project owner/number | Projects v2 board to index across its linked repos |
--include-pull-requests / --no-include-pull-requests | Include pull request threads |
--state open|closed|all | Issue/PR state filter (default all) |
--label <name> | Restrict to items carrying this label; repeatable |
--token <token> | Token for this run, overriding the env var and gh auth token |
--host <host> | github.com (default), SUBDOMAIN.ghe.com, or a GHES hostname |
--state applies to both entities, with one wrinkle: issues use OPEN/CLOSED, while pull requests map closed to both CLOSED and MERGED. So --state closed --include-pull-requests includes merged PRs.
--label is repeatable. The names are passed straight to GitHub's GraphQL labels: filter, which is conjunctive — an issue or pull request must carry all of the listed labels to be indexed.
GitHub Enterprise
Pass the host without a protocol — --host ghe.example.com — or rely on the config value. The GraphQL endpoint is derived from it: https://api.github.com/graphql for github.com, https://api.<host>/graphql for *.ghe.com data-residency hosts, and https://<host>/api/graphql for GitHub Enterprise Server. gh auth token is queried with --hostname <host> for non-Cloud hosts, so an Enterprise collection picks up that host's CLI token rather than github.com's.
For a GHES instance with a self-signed CA, disable TLS verification via config (there is no CLI flag for it):
export INDEXED__sources__github__verify_ssl=falseIndexed logs a warning when verification is disabled, because the token is then exposed to a man-in-the-middle.
Keep the Index Fresh
indexed index update platform-issuesOmit the collection name to update every collection.
What an update re-reads depends on the entity, because GitHub's API does not offer the same filters everywhere:
- Issues are pulled incrementally. Indexed stores the newest
updatedAtit saw and re-queries with asincefilter set 60 seconds before that cutoff, so an item edited mid-crawl is not skipped. - Pull requests have no
sincefilter in the GraphQL query, so they are listed in full on each update. - Projects v2 boards are likewise re-read in full.
To automate it:
# Refresh every 6 hours
0 */6 * * * /path/to/indexed index update platform-issuesTroubleshooting
No GitHub token found — none of --token, the config token, GITHUB_TOKEN, or gh auth token produced a value. Run gh auth status to confirm the CLI is logged in, or export GITHUB_TOKEN.
permission denied (insufficient token scope, SAML enforcement, or repo access denied) — GitHub returned 403 without rate-limit headers. The token cannot read one of the repos or the board. Check the token's access to that specific repository, and whether your organization enforces SAML SSO — a token must be authorized for the org before it can read private repos there. Indexed deliberately does not retry this.
Invalid repo selector 'foo'; expected 'owner/repo' — --repo takes exactly owner/name, with no URL, no .git suffix, and no extra slash.
Invalid project selector ...; expected 'owner/number' — the part after the slash must be the numeric project number, not the project title.
Projects v2 board owner/number was not found or is not accessible with the configured token — the board is private, belongs to another org, or the number is wrong. Open the board in a browser while signed in as the token's owner to confirm the number.
A repo indexed but nothing useful came back — pull requests are off unless you pass --include-pull-requests, and an empty repo with --state open yields nothing if every issue is closed.
Rate limiting — the GraphQL API is rate-limited per token. Indexed retries on 429, on 403 with rate-limit headers saying exhausted, and on 5xx, using Retry-After or X-RateLimit-Reset when present, with exponential backoff capped at 60 seconds. For large organizations, index repos in separate collections rather than one giant crawl.
TLS errors on Enterprise Server — install the CA in your trust store rather than setting verify_ssl=false; if you must disable it, scope the setting to that collection's environment.