Skip to content
jamie edited this page May 2, 2025 · 2 revisions

Usage Guide

This page explains how to use GitHub CLI MCP to enable AI assistants to interact with GitHub.

Starting the Server

Start the GitHub CLI MCP server:

gh-cli-mcp

This starts the server using stdio transport.

Command Line Options

GitHub CLI MCP supports the following command line options:

OPTIONS:
  -h, --help                 Show this help message
  -v, --version              Show version information
  -c, --config <path>        Path to configuration file
  --session-timeout <ms>     Session timeout in milliseconds

Examples

Show help:

gh-cli-mcp --help

Start with a custom configuration file:

gh-cli-mcp --config ./my-config.json

Set a custom session timeout:

gh-cli-mcp --session-timeout 3600000

Integration with AI Assistants

GitHub CLI MCP can be used with any AI assistant that supports the Model Context Protocol. Here's how to integrate it with your assistant:

  1. Start the GitHub CLI MCP server
  2. Configure your AI assistant to communicate with the server via stdio
  3. Use the Model Context Protocol to invoke GitHub CLI tools

Using with Claude

Claude Code (CLI)

  1. Start the GitHub CLI MCP server in one terminal:

    gh-cli-mcp
  2. In another terminal, start Claude Code with the MCP flag:

    claude --mcp "gh-cli-mcp:github-cli:stdio:http://localhost:8888"
  3. Now you can ask Claude to interact with GitHub. Examples:

    • "List my open pull requests"
    • "Create a new issue titled 'Fix navbar styling'"
    • "Show me the details of PR #123"

Claude Desktop App

  1. Start the GitHub CLI MCP server:

    gh-cli-mcp
  2. In Claude Desktop, ensure you've added the MCP integration in Settings.

  3. Then you can ask Claude to perform GitHub tasks similar to the examples above.

Tool Invocation Examples

Here are some examples of how to invoke GitHub CLI MCP tools:

Listing Pull Requests

{
  "name": "gh_pr_list",
  "input": {
    "state": "open"
  }
}

Viewing a Pull Request

{
  "name": "gh_pr_view",
  "input": {
    "number": 123,
    "repo": "owner/repo"
  }
}

Creating an Issue

{
  "name": "gh_issue_create",
  "input": {
    "title": "Bug: Application crashes on startup",
    "body": "When starting the application, it crashes with the following error...",
    "repo": "owner/repo"
  }
}

Next Steps

Clone this wiki locally