GitHub MCP Server: Complete Setup and Usage Guide 2026

Let AI access and manage your GitHub repositories - step-by-step guide to GitHub MCP Server

返回教程列表
进阶15 分钟

GitHub MCP Server: Complete Setup and Usage Guide 2026

Let AI access and manage your GitHub repositories - step-by-step guide to GitHub MCP Server

GitHub MCP Server: Complete Guide 2026 What is GitHub MCP Server? **GitHub MCP Server** is an MCP (Model Context Protocol) server that enables AI assistants to Let AI access and manage your GitHub repositories. MCP is an open protocol that standard

GitHub MCP Server: Complete Guide 2026

What is GitHub MCP Server?

GitHub MCP Server is an MCP (Model Context Protocol) server that enables AI assistants to Let AI access and manage your GitHub repositories. MCP is an open protocol that standardizes how AI models interact with external tools and data sources.

Prerequisites

  • Claude Desktop (or any MCP-compatible client)
  • Node.js 18+ or Python 3.10+
  • Access to GitHub account/credentials
  • Installation

    Option 1: NPM (Recommended)

    bash
    npm install -g @development/github-mcp-server-mcp
    

    Option 2: From Source

    bash
    git clone https://github.com/modelcontextprotocol/github-mcp-server-mcp
    cd github-mcp-server-mcp
    npm install
    npm run build
    

    Configuration

    Claude Desktop Setup

    Edit your Claude Desktop config file:

    macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

    json
    {
      "mcpServers": {
        "github-mcp-server": {
          "command": "npx",
          "args": [
            "-y",
            "@development/github-mcp-server-mcp"
          ],
          "env": {
            "GITHUB_MCP_SERVER_API_KEY": "your-api-key-here",
            "DEBUG": "false"
          }
        }
      }
    }
    

    Environment Variables

    bash
    

    Required

    export GITHUB_MCP_SERVER_API_KEY=your_key_here

    Optional

    export GITHUB_MCP_SERVER_TIMEOUT=30 export GITHUB_MCP_SERVER_MAX_RESULTS=50

    Available Tools

    After installation, Claude has access to these tools:

    Core Tools

    
    
  • github_mcp_server_list
  • Description: List available resources Parameters: { limit: number, filter: string }

  • github_mcp_server_get
  • Description: Get specific resource by ID or name Parameters: { id: string }

  • github_mcp_server_create
  • Description: Create a new resource Parameters: { name: string, content: any }

  • github_mcp_server_update
  • Description: Update existing resource Parameters: { id: string, updates: any }

  • github_mcp_server_delete
  • Description: Delete a resource Parameters: { id: string, confirm: boolean }

    Usage Examples

    Example 1: Basic Usage in Claude

    Once configured, you can ask Claude naturally:

    
    You: "Use GitHub MCP Server to help me with Let AI access and manage your GitHub repositories"

    Claude: "I'll use the GitHub MCP Server MCP server to help you. [Uses github_mcp_server_list tool] Here's what I found..."

    Example 2: Complex Workflow

    
    You: "Please analyze my development setup and suggest improvements"

    Claude will:

  • List all resources using GitHub MCP Server
  • Analyze the current configuration
  • Identify opportunities for improvement
  • Suggest specific changes with reasoning
  • Building a Custom MCP Server

    You can also build your own MCP server:

    typescript
    import { Server } from "@modelcontextprotocol/sdk/server/index.js";
    import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
    import {
      CallToolRequestSchema,
      ListToolsRequestSchema,
    } from "@modelcontextprotocol/sdk/types.js";

    const server = new Server( { name: "my-development-server", version: "0.1.0", }, { capabilities: { tools: {}, }, } );

    // Define available tools server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "development_query", description: "Let AI access and manage your GitHub repositories", inputSchema: { type: "object", properties: { query: { type: "string", description: "Your query" } }, required: ["query"] } } ] }; });

    // Handle tool calls server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name === "development_query") { const { query } = request.params.arguments as { query: string }; // Your implementation here const result = await performQuery(query); return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } throw new Error(Unknown tool: ${request.params.name}); });

    // Start server const transport = new StdioServerTransport(); await server.connect(transport);

    Troubleshooting

    Common Issues

    Issue: Server not starting

    bash
    

    Check if node is properly installed

    node --version # Should be 18+

    Reinstall the package

    npm install -g @development/github-mcp-server-mcp --force

    Issue: Authentication failing

    bash
    

    Verify your API key

    echo $GITHUB_MCP_SERVER_API_KEY

    Test API key validity

    curl -H "Authorization: Bearer $GITHUB_MCP_SERVER_API_KEY" https://api.github.com/v1/test

    Issue: Claude Desktop not recognizing server

  • Restart Claude Desktop completely
  • Check JSON config syntax is valid
  • Verify file path is correct
  • Check server logs in Console.app (macOS)
  • Security Considerations

    bash
    

    Use environment-specific keys (never hardcode)

    In production, use a secrets manager

    export GITHUB_MCP_SERVER_API_KEY=$(aws secretsmanager get-secret-value --secret-id mcp-keys --query SecretString --output text | jq -r '.development_key')

    Limit MCP server permissions to minimum required

    Use read-only tokens when possible

    Conclusion

    GitHub MCP Server unlocks the ability to Let AI access and manage your GitHub repositories directly through your AI assistant. This makes complex development tasks dramatically faster and more intuitive.

    As MCP becomes the standard for AI tool integration, mastering these servers gives you a significant productivity advantage.


    *GitHub MCP Server MCP setup guide | May 2026*

    相关工具

    Claude DesktopMCPGitHub MCP Server