MA

md-adnan70/mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

5 stars 0 forks 质量 55 趋势 13

Step-by-step guide for setting up GitHub MCP server with Claude Desktop

概览

This guide provides step-by-step instructions for setting up the GitHub MCP (Model Context Protocol) server with Claude Desktop, enabling seamless integration between Claude and your GitHub repositories. The Model Context Protocol (MCP) is an open protocol that enables AI assistants to securely connect to local and remote resources. The GitHub MCP server allows Claude Desktop to interact with GitHub repositories, enabling features like reading files, creating repositories, managing issues, and more. Before starting, ensure you have: - Claude Desktop installed on your computer - Node.js (version 16 or higher) installed - A GitHub account - Git installed on your system 1. Open your terminal or command prompt 2. Install the GitHub MCP server globally using npm: 1. Go to GitHub and sign in to your account 2. Click on your profile picture in the top right corner 3. Select "Settings" from the dropdown menu 4. In the left sidebar, click on "Developer settings" 5.

README

以下为原文 README 节选,完整内容请查看原文。

GitHub MCP Server Setup Guide

This guide provides step-by-step instructions for setting up the GitHub MCP (Model Context Protocol) server with Claude Desktop, enabling seamless integration between Claude and your GitHub repositories.

What is MCP?

The Model Context Protocol (MCP) is an open protocol that enables AI assistants to securely connect to local and remote resources. The GitHub MCP server allows Claude Desktop to interact with GitHub repositories, enabling features like reading files, creating repositories, managing issues, and more.

Prerequisites

Before starting, ensure you have:

  • Claude Desktop installed on your computer
  • Node.js (version 16 or higher) installed
  • A GitHub account
  • Git installed on your system

Step 1: Install the GitHub MCP Server

  1. Open your terminal or command prompt

  2. Install the GitHub MCP server globally using npm:

    npm install -g @modelcontextprotocol/server-github
    
  3. Verify the installation:

    mcp-server-github --version
    

Step 2: Create a GitHub Personal Access Token

  1. Go to GitHub and sign in to your account
  2. Click on your profile picture in the top right corner
  3. Select “Settings” from the dropdown menu
  4. In the left sidebar, click on “Developer settings”
  5. Click on “Personal access tokens” → “Tokens (classic)”
  6. Click “Generate new token” → “Generate new token (classic)”
  7. Give your token a descriptive name (e.g., “Claude Desktop MCP”)
  8. Select the following scopes:
    • repo (Full control of private repositories)
    • user:email (Access to user email addresses)
    • read:user (Read access to user profile info)
    • workflow (Update GitHub Action workflows)
  9. Click “Generate token”
  10. Important: Copy the token immediately and save it securely. You won’t be able to see it again.

Step 3: Configure Claude Desktop

For macOS:

  1. Open Finder and navigate to ~/Library/Application Support/Claude/
  2. Create or edit the claude_desktop_config.json file
  3. Add the following configuration:
{
  "mcpServers": {
    "github": {
      "command": "mcp-server-github",
      "args": [],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_token_here"
      }
    }
  }
}

For Windows:

  1. Navigate to %APPDATA%\Claude\
  2. Create or edit the claude_desktop_config.json file
  3. Add the same configuration as above

For Linux:

  1. Navigate to ~/.config/Claude/
  2. Create or edit the claude_desktop_config.json file
  3. Add the same configuration as above

Step 4: Replace the Token

In the configuration file, replace your_github_token_here with the actual token you generated in Step 2.

Example:

{
  "mcpServers": {
    "github": {
      "command": "mcp-server-github",
      "args": [],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Step 5: Restart Claude Desktop

  1. Completely quit Claude Desktop
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "github": { "command": "mcp-server-github", "args": [], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_token_here" } } } }