# GitHub search API for agents

Use the glim.sh GitHub search API to find code in public repositories, look up an issue or follow a discussion. When you have a match, pass its URL to the get tool to read the source file or conversation.

## GitHub API pricing

- `POST /api/v1/github/search` or `glim_github_search` costs $0.002 per search.
- `POST /api/v1/github/get` or `glim_github_get` costs $0.002 per read.

The REST examples use a glim.sh API key. You can also [pay per call with a wallet](https://glim.sh/docs/payments.md). Neither option requires a GitHub personal access token.

## Search public GitHub code, repositories and issues

For code search, give `query` a literal from the file and use `repo` to narrow the search. The example looks for calls to `useState` within one repository.

**REST request**

```
curl -X POST https://glim.sh/api/v1/github/search \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"useState(","kind":"code","repo":"facebook/react"}'
```

**MCP tools/call parameters**

```
{
  "name": "glim_github_search",
  "arguments": {
    "query": "useState(",
    "kind": "code",
    "repo": "facebook/react"
  }
}
```

Use `kind: "repos"` with a project name and qualifiers such as `stars:>500`. Choose `conversations` for issues and pull requests, or `discussions` to search discussion threads. For example, `is:issue label:bug` searches issues with the bug label.

## Read a file, commit or conversation by URL

A repository URL returns metadata and the README. A file URL returns that file's contents. You can also pass an issue, pull request, discussion or commit URL.

**REST request**

```
curl -X POST https://glim.sh/api/v1/github/get \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"https://github.com/facebook/react/blob/main/README.md"}'
```

**MCP tools/call parameters**

```
{
  "name": "glim_github_get",
  "arguments": {
    "ref": "https://github.com/facebook/react/blob/main/README.md"
  }
}
```

## GitHub MCP server

Connect your MCP client to `https://glim.sh/mcp`. To load just the GitHub tools, use `https://glim.sh/mcp?tools=glim_github_search,glim_github_get`.

- **Claude Code**: `claude mcp add -s user -t http glim https://glim.sh/mcp`
- **Codex**: `codex mcp add glim --url https://glim.sh/mcp`
- **OpenCode**: `opencode mcp add`
  Interactive: choose remote, paste https://glim.sh/mcp
- **Wallet**: `npx x402-proxy mcp add glim https://glim.sh/mcp`
  No account: your agent pays per call in USDC (x402) from a local wallet, auto-generated on first run.

## Compared with GitHub's official MCP server

[GitHub's official MCP server](https://github.com/github/github-mcp-server) can create and update issues and pull requests. Use glim.sh for read-only research across public repositories.

## Good to know

- Code search accepts quoted strings, `/regex/` patterns and `symbol:` queries. Narrow a broad search with `repo:`, `language:` or `path:`.
- `kind` is optional and is inferred from the query when you leave it out. The get tool also accepts `owner/repo` shorthand in place of a repository URL.
- A search can return partial results. When `incomplete_results` is true or a code search times out, narrow it with `repo:`, `org:` or `language:` before you treat an empty result as proof that a pattern is absent.

## FAQ

### Can my agent search private repositories or edit files?

No. Both tools read public GitHub data. They cannot access private repositories, push changes or open pull requests.

### Does glim.sh bypass the GitHub API rate limit?

No. glim.sh retries requests that GitHub rate-limits, and a search or read can still fail if the limit persists. Your agent does not supply a GitHub token, so its own GitHub quota is not used.

---

## All docs pages


**Get started**

- [Introduction](https://glim.sh/docs.md)
- [MCP quickstart](https://glim.sh/docs/quickstart.md)
- [REST API quickstart](https://glim.sh/docs/quickstart-rest.md)
- [JavaScript quickstart](https://glim.sh/docs/quickstart-javascript.md)
- [Python quickstart](https://glim.sh/docs/quickstart-python.md)
- [Payments & auth](https://glim.sh/docs/payments.md)
- [MPP (Tempo)](https://glim.sh/docs/mpp.md)

**Tools**

- [Twitter / X](https://glim.sh/docs/twitter.md)
- [Reddit](https://glim.sh/docs/reddit.md)
- [Web](https://glim.sh/docs/web.md)
- [GitHub](https://glim.sh/docs/github.md)
- [Amazon](https://glim.sh/docs/amazon.md)
- [YouTube](https://glim.sh/docs/youtube.md)
- [Telegram](https://glim.sh/docs/telegram.md)

**Reference**

- [Changelog](https://glim.sh/docs/changelog.md)
- [API reference](https://glim.sh/docs/api-reference)
- [OpenAPI spec](https://glim.sh/openapi.json)
