Skip to main content

GitHub REST API Integration

Automation your GitHub workflows directly from your LLM using the GitHub REST API - create issues, list pull requests, and manage repositories without leaving your AI assistant.

What It Does

The GitHub integration allows your LLM to:
  • Create issues - Open new issues with title and description
  • List pull requests - Get open, closed, or all PRs
  • Filter by state - Target specific PR states
  • Support Markdown - Rich formatting in issue descriptions

Setup

1. Generate a GitHub Token

2

Generate New Token

Click “Generate new token (classic)”
3

Select Scopes

For basic operations, select:
  • repo (full control of private repositories)
  • public_repo (access public repositories only, if preferred)
4

Copy Token

Save the token securely - you won’t see it again!

2. Import the Configuration

The GitHub configuration is included in NUEVOS_HITOS.json:
{
  "name": "GitHub REST API",
  "code": "github",
  "baseUrl": "https://api.github.com",
  "authenticationType": "BEARER_TOKEN",
  "apiKeyLocation": "HEADER",
  "apiKeyName": "Authorization",
  "apiKeyValue": "<YOUR_API_KEY>",
  "customHeaders": {
    "Accept": "application/vnd.github+json",
    "X-GitHub-Api-Version": "2022-11-28",
    "User-Agent": "HandsAI/1.0"
  },
  "tools": [
    {
      "name": "Crear Issue Github",
      "code": "github-create-issue",
      "description": "Crea un 'issue' o tarea nueva en un repositorio de GitHub.",
      "endpointPath": "/repos/{owner}/{repo}/issues",
      "httpMethod": "POST",
      "enabled": true,
      "isExportable": true,
      "parameters": [
        {
          "name": "owner",
          "type": "STRING",
          "description": "Dueño del repositorio (usuario u organización, ej. 'facebook').",
          "required": true
        },
        {
          "name": "repo",
          "type": "STRING",
          "description": "Nombre del repositorio (ej. 'react').",
          "required": true
        },
        {
          "name": "title",
          "type": "STRING",
          "description": "Título del Issue.",
          "required": true
        },
        {
          "name": "body",
          "type": "STRING",
          "description": "Cuerpo/Descripción del issue (acepta Markdown).",
          "required": false
        }
      ]
    },
    {
      "name": "Listar Pull Requests",
      "code": "github-list-pulls",
      "description": "Obtiene la lista de Pull Requests (PR) abiertas para un repositorio.",
      "endpointPath": "/repos/{owner}/{repo}/pulls",
      "httpMethod": "GET",
      "enabled": true,
      "isExportable": true,
      "parameters": [
        {
          "name": "owner",
          "type": "STRING",
          "description": "Dueño del repositorio.",
          "required": true
        },
        {
          "name": "repo",
          "type": "STRING",
          "description": "Nombre del repositorio.",
          "required": true
        },
        {
          "name": "state",
          "type": "STRING",
          "description": "Estado de la PR a filtrar (open, closed, all).",
          "required": false,
          "defaultValue": "open"
        }
      ]
    }
  ]
}
Import via API:
curl -X POST http://localhost:8080/api/import/providers \
  -H "Content-Type: application/json" \
  -d @NUEVOS_HITOS.json
Replace <YOUR_API_KEY> with your GitHub personal access token. Format: Bearer ghp_xxxxxxxxxxxx

Example Operations

Create an Issue

User request:
“Create an issue in the HandsAI repository titled ‘Add OpenAPI import support’”
LLM tool call:
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "Crear Issue Github",
    "arguments": {
      "owner": "Vrivaans",
      "repo": "HandsAI",
      "title": "Add OpenAPI import support",
      "body": "## Feature Request\n\nWould be great to import OpenAPI/Swagger specs directly.\n\n### Benefits\n- Faster tool registration\n- Automatic parameter detection\n- Better documentation"
    }
  },
  "id": "msg_github_1"
}
HandsAI executes:
POST https://api.github.com/repos/Vrivaans/HandsAI/issues
Authorization: Bearer YOUR_GITHUB_TOKEN
Accept: application/vnd.github+json
X-GitHub-Api-Version: 2022-11-28

{
  "title": "Add OpenAPI import support",
  "body": "## Feature Request\n\nWould be great to import OpenAPI/Swagger specs directly..."
}
Response:
{
  "id": 1234567890,
  "number": 42,
  "title": "Add OpenAPI import support",
  "state": "open",
  "html_url": "https://github.com/Vrivaans/HandsAI/issues/42",
  "created_at": "2026-03-03T15:45:00Z"
}

List Pull Requests

User request:
“Show me all open PRs in the react repository”
LLM tool call:
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "Listar Pull Requests",
    "arguments": {
      "owner": "facebook",
      "repo": "react",
      "state": "open"
    }
  },
  "id": "msg_github_2"
}
Response:
[
  {
    "number": 28945,
    "title": "Fix: Handle edge case in useEffect cleanup",
    "state": "open",
    "html_url": "https://github.com/facebook/react/pull/28945",
    "user": {
      "login": "developer123"
    },
    "created_at": "2026-03-01T10:00:00Z"
  },
  {
    "number": 28944,
    "title": "Add new concurrent rendering feature",
    "state": "open",
    "html_url": "https://github.com/facebook/react/pull/28944",
    "user": {
      "login": "reactdev"
    },
    "created_at": "2026-02-28T14:30:00Z"
  }
]

Path Parameters

Notice how HandsAI handles path parameters like {owner} and {repo}:
Endpoint Template: /repos/{owner}/{repo}/issues
Parameters: owner=Vrivaans, repo=HandsAI
Final URL: /repos/Vrivaans/HandsAI/issues
HandsAI automatically replaces path parameter placeholders with the provided values.

Use Cases

Bug Tracking

Auto-create issues from error logs or user reports

PR Monitoring

Track review status and merge readiness

Project Management

Automate task creation and assignment

CI/CD Integration

Trigger workflows based on repo activity

Advanced: Adding More Tools

You can extend the GitHub integration with additional tools:
{
  "name": "Comentar Issue",
  "code": "github-comment-issue",
  "endpointPath": "/repos/{owner}/{repo}/issues/{issue_number}/comments",
  "httpMethod": "POST"
}
{
  "name": "Cerrar Issue",
  "code": "github-close-issue",
  "endpointPath": "/repos/{owner}/{repo}/issues/{issue_number}",
  "httpMethod": "PATCH"
}
{
  "name": "Crear Pull Request",
  "code": "github-create-pr",
  "endpointPath": "/repos/{owner}/{repo}/pulls",
  "httpMethod": "POST"
}

Security Best Practices

Never commit your GitHub token to version control. Store it securely in environment variables or a secrets manager.
1

Use Fine-Grained Tokens

Prefer fine-grained tokens with minimal scopes over classic tokens
2

Set Expiration

Configure token expiration to limit exposure window
3

Rotate Regularly

Rotate tokens periodically, especially after team changes
4

Audit Access

Review token usage in GitHub settings regularly

Next Steps

Jules Agent

Automate code tasks with Google’s Jules

API Reference

Explore the MCP API endpoints

Build docs developers (and LLMs) love