---
ref: tool:github/search-repositories
name: Search repositories
company: company:github
workflows: []
access: [mcp, cli, api]
tags: [capability:research-accounts, category:code, has:api, has:cli, has:mcp]
docs: https://docs.github.com/en/rest/search/search#search-repositories
updated: 2026-09-26
---

# Search repositories

Returns repositories that match a query on name, topic, language, stars or owner.

## Set up

Use the first option your agent supports.

### MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

```json
{ "mcpServers": { "github": { "url": "https://api.githubcopilot.com/mcp/" } } }
```

Call the MCP tool `search_repositories`.

Server URL: https://api.githubcopilot.com/mcp/

### CLI (official)

Install the command, then confirm it runs.

```sh
brew install gh
gh --version
```

Run `gh search repos`.

### API (official)

- Base URL: https://api.github.com
- Endpoint: `GET /search/repositories`
- Auth: send the header `Authorization: Bearer $GITHUB_TOKEN`
- Get a key: https://github.com/settings/personal-access-tokens/new
- Docs: https://docs.github.com/en/rest

Before doing anything else, make one read-only call to confirm access.

## Rules

- Ask the user before anything that sends messages, costs money, or changes data.
- Never print API keys.
