Skip to main content
Glama
nhevers

mcp-github

by nhevers
README.md
# mcp-github

MCP server for GitHub operations. Provides tools for repository management, issues, pull requests and code search.

## Installation

```bash
pip install -r requirements.txt
```

## Quick Start

```python
from mcpgithub import GitHubServer

server = GitHubServer(token="ghp_...")
server.run()
```

## Features

- Repository listing and management
- Issue and PR operations
- Code and repository search
- File read and write operations
- Branch management

## MCP Tools

### list_repos

List repositories for a user or organization.

```json
{
  "name": "list_repos",
  "arguments": {
    "owner": "username",
    "type": "all"
  }
}
```

### get_file

Get contents of a file from a repository.

```json
{
  "name": "get_file",
  "arguments": {
    "owner": "username",
    "repo": "repo-name",
    "path": "src/main.py"
  }
}
```

### create_issue

Create a new issue.

```json
{
  "name": "create_issue",
  "arguments": {
    "owner": "username",
    "repo": "repo-name",
    "title": "Bug report",
    "body": "Description..."
  }
}
```

### search_code

Search for code across repositories.

```json
{
  "name": "search_code",
  "arguments": {
    "query": "function authenticate",
    "language": "python"
  }
}
```

### create_pr

Create a pull request.

```json
{
  "name": "create_pr",
  "arguments": {
    "owner": "username",
    "repo": "repo-name",
    "title": "Add feature",
    "head": "feature-branch",
    "base": "main"
  }
}
```

## Configuration

```python
server = GitHubServer(
    token="ghp_...",
    default_owner="myorg"
)
```

Environment variables:
```bash
GITHUB_TOKEN=ghp_...
GITHUB_DEFAULT_OWNER=myorg
```

## Examples

### Claude Desktop configuration

```json
{
  "mcpServers": {
    "github": {
      "command": "python",
      "args": ["-m", "mcpgithub"],
      "env": {
        "GITHUB_TOKEN": "ghp_..."
      }
    }
  }
}
```

## License

MIT