> For the complete documentation index, see [llms.txt](https://docs.ilert.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ilert.com/ai-and-agents/mcp/hosted/github.md).

# GitHub

Give an agent access to GitHub with a personal access token.

#### Required permissions

<table><thead><tr><th width="135.80859375">Tool</th><th width="180.70703125">Required Permission</th><th>Description</th></tr></thead><tbody><tr><td>Pull Requests</td><td><code>Pull requests</code></td><td>Pull requests and related comments, assignees, labels, milestones, and merges.<a href="https://docs.github.com/rest/overview/permissions-required-for-fine-grained-personal-access-tokens#repository-permissions-for-pull-requests">Learn more.</a></td></tr><tr><td>Commits</td><td><code>Content</code></td><td>Repository contents, commits, branches, downloads, releases, and merges. <a href="https://docs.github.com/rest/overview/permissions-required-for-fine-grained-personal-access-tokens#repository-permissions-for-contents">Learn more.</a></td></tr></tbody></table>

#### Create Personal Access Token

Using the GitHub MCP server requires a personal access token

{% stepper %}
{% step %}
Navigate to your [GitHub settings](https://github.com/settings/profile) and click on [Developer settings](https://github.com/settings/apps)

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FyOdoys1QKPlNSjEaxLDH%2FGitHub%20Settings.png?alt=media&amp;token=e09eca89-b21d-4bbf-9882-2c92ac155734" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Got to **Fine-grained tokens** and click on the **Generate new token** button

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F4l9iOcFc1sWGqWWjXwjI%2FDeveoper%20settings.png?alt=media&amp;token=91d66cbd-0880-4cc3-8f13-e89f63dd9fed" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Enter the details for your personal access token:

* **Name, description** and **Expiration**
* **Resource owner** - we recommend setting your GitHub org as the owner
* **Repository access** - select the repositories to which the agent should have access
* **Permissions -** chose the permissions based on your enabled tools in ilert. In the screenshot below, the agent will have read access to code, metadata, and pull requests.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2F8c6uYaQreb1bCCIzx3rW%2Ffine%20grained%20access%20token.png?alt=media&amp;token=0149f69e-12a5-42d3-86cc-7e3871b6ab60" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Click on **Generate token**
{% endstep %}

{% step %}
Copy your token and temporarily paste it somewhere secure (e.g. a private note). You will later need the token when setting up the GitHub MCP server in ilert.

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2Fo62rdDbzn99OYCqFH2B4%2Fimage.png?alt=media&amp;token=93879e4a-e564-4151-be37-98f158f99bde" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

#### **Connect GitHub with agent**

To connect GitHub with your AI SRE agent:

{% stepper %}
{% step %}
Navigate to **Agents** in the ilert navigation menu
{% endstep %}

{% step %}
Open the agent detail view for the agent you want to configure
{% endstep %}

{% step %}
Go to the **Tools** tab
{% endstep %}

{% step %}
Under the **ilert hosted MCP servers** section, locate the **GitHub** card
{% endstep %}

{% step %}
Click **Connect** on the GitHub card
{% endstep %}

{% step %}
In the connection dialog that appears:

* **Select connector:** Choose "Create new connector" (or select an existing connector if you have one)
* **Type:** Select **Bearer Token** from the dropdown
* **Secret name:** Enter a name for your connector (e.g., "GitHub Production" or "GitHub Main")
* **Secret value:** Paste the personal access token you created earlier
* **Host URL:** Leave this field empty

<figure><img src="https://3394882078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M76ygPnS4HUcFSX8ulm%2Fuploads%2FkqqFCX3SA6hWYySIHZFo%2Fimage.png?alt=media&amp;token=b4dd616c-6202-4ff4-ab13-e4c3606a5bb0" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Click **Connect** to complete the connection
{% endstep %}

{% step %}
After connecting, you can enable or disable specific tools needed for alert investigation, such as:

* `get_pull_request` - Retrieve pull request information
* `get_pull_request_diff` - Get pull request diff details
* `get_commit_diff` - Get commit diff information
* `search_pull_requests` - Search merged pull requests by title across an owner's or organization's repositories
  {% endstep %}
  {% endstepper %}

The GitHub integration is now connected and ready to use for root cause analysis.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ilert.com/ai-and-agents/mcp/hosted/github.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
