# GitHub MCP Server

An MCP server implementation that enables Claude to interact with GitHub repositories through the GitHub API.

## Installation

```bash
npm install @microagents/server-github
# or
yarn add @microagents/server-github
```

## Usage

### Direct Execution

```bash
# Set your API token and run
GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here npx @microagents/server-github
```

### With Claude Desktop

Add this to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["@microagents/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
      }
    }
  }
}
```

## Setup

### Personal Access Token

Create a GitHub Personal Access Token with appropriate permissions:

1. Go to Personal access tokens (in GitHub Settings > Developer settings)
2. Select which repositories you'd like this token to have access to (Public, All, or Select)
3. Create a token with the `repo` scope ("Full control of private repositories")
   * Alternatively, if working only with public repositories, select only the `public_repo` scope
4. Copy the generated token

## Features

* **File Operations**: Create, read, update, and delete files
* **Repository Management**: Create repositories, list branches, manage issues and PRs
* **Search Functionality**: Search code, repositories, issues, and users
* **Git Operations**: Commit changes, create branches, and more

## Tools

### File Operations
- `create_or_update_file`: Create or update a single file in a repository
- `push_files`: Push multiple files in a single commit
- `get_file_contents`: Get contents of a file or directory

### Repository Management
- `create_repository`: Create a new GitHub repository
- `search_repositories`: Search for GitHub repositories
- `list_branches`: List branches in a repository
- `create_branch`: Create a new branch in a repository

### Issues and Pull Requests
- `create_issue`: Create a new issue
- `get_issue`: Get details of a specific issue
- `create_issue_comment`: Add a comment to an issue
- `create_pull_request`: Create a new pull request
- `get_pull_request`: Get details of a specific pull request
- `merge_pull_request`: Merge a pull request

### Search
- `search_code`: Search for code across GitHub repositories
- `search_issues`: Search for issues and pull requests
- `search_users`: Search for GitHub users

## License

MIT

## Credits

Based on the original MCP server by the Model Context Protocol team.
