@@ -10,48 +10,57 @@ Claude Code CLI provides command-line access to Claude with MCP server integrati
1010
11111 . Claude Code CLI installed
12122 . [ GitHub Personal Access Token] ( https://github.com/settings/personal-access-tokens/new )
13+ 3 . Node.js/npm or Docker (depending on installation method)
1314
14- ### Installation
15+ ### Installation Methods
1516
16- Run the following command in the Claude Code CLI, referencing your GitHub PAT:
17+ #### Method 1: Using Docker (Recommended)
18+ ``` bash
19+ claude mcp add-json github ' {"command": "docker", "args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_pat"}}'
20+ ```
1721
22+ #### Method 2: Using NPX (Legacy)
23+ Note: The npm package has moved to GitHub's official repository but remains functional.
1824``` bash
19- claude mcp add-json github ' {"command": "github-mcp-server ", "args": ["stdio "], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_pat"}}'
25+ claude mcp add-json github ' {"command": "npx ", "args": ["-y", "@modelcontextprotocol/server-github "], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_pat"}}'
2026```
2127
22- ### Configuration Steps
28+ ### Configuration Options
2329
24- 1 . Replace ` your_github_pat ` with your actual GitHub Personal Access Token
25- 2 . Ensure you have the necessary permissions on your GitHub PAT for the operations you want to perform
26- 3 . The command will add the GitHub MCP Server to your Claude Code configuration
30+ - Use ` -s user ` to add the server to your user configuration (available across all projects)
31+ - Use ` -s project ` to add the server to project-specific configuration (shared via ` .mcp.json ` )
32+ - Default scope is ` local ` (available only to you in the current project)
2733
28- ### Troubleshooting Claude Code
34+ ### Verification
2935
30- - Verify the Claude Code CLI is properly installed and accessible
31- - Check that your GitHub PAT is valid and has the required permissions
32- - Ensure the command syntax is correct (note the single quotes around the JSON)
33- - Review Claude Code documentation for any specific MCP server requirements
36+ Run the following command to verify the installation:
37+ ``` bash
38+ claude mcp list
39+ ```
3440
3541---
3642
3743## Claude Desktop
3844
39- Claude Desktop provides a user-friendly interface for interacting with the GitHub MCP Server.
45+ Claude Desktop provides a graphical interface for interacting with the GitHub MCP Server.
4046
4147### Prerequisites
4248
43491 . Claude Desktop installed
44502 . [ GitHub Personal Access Token] ( https://github.com/settings/personal-access-tokens/new )
45- 3 . [ Docker ] ( https://www.docker.com/ ) installed and running
51+ 3 . Node.js/npm or Docker (depending on installation method)
4652
47- ### Installation Steps
53+ ### Configuration File Location
54+
55+ - ** macOS** : ` ~/Library/Application Support/Claude/claude_desktop_config.json `
56+ - ** Windows** : ` %APPDATA%\Claude\claude_desktop_config.json `
57+ - ** Linux** : ` ~/.config/Claude/claude_desktop_config.json ` (unofficial support)
4858
49- 1 . Follow the Claude Desktop [ MCP install guide] ( https://modelcontextprotocol.io/quickstart/user )
50- 2 . Add the following configuration to your Claude Desktop configuration file
59+ ### Installation Methods
5160
52- ### Configuration
61+ #### Method 1: Using Docker (Recommended)
5362
54- Add the following JSON to your Claude Desktop configuration file, replacing ` your_github_pat ` with your actual GitHub Personal Access Token :
63+ Add the following to your ` claude_desktop_config.json ` :
5564
5665``` json
5766{
@@ -74,9 +83,27 @@ Add the following JSON to your Claude Desktop configuration file, replacing `you
7483}
7584```
7685
86+ #### Method 2: Using NPX (Legacy)
87+
88+ Note: The npm package has moved to GitHub's official repository but remains functional.
89+
90+ ``` json
91+ {
92+ "mcpServers" : {
93+ "github" : {
94+ "command" : " npx" ,
95+ "args" : [" -y" , " @modelcontextprotocol/server-github" ],
96+ "env" : {
97+ "GITHUB_PERSONAL_ACCESS_TOKEN" : " your_github_pat"
98+ }
99+ }
100+ }
101+ }
102+ ```
103+
77104### Using Environment Variables
78105
79- You can also use environment variables for better security. Replace ` your_github_pat ` with a variable reference like ` $GITHUB_PAT ` :
106+ Claude Desktop supports environment variable references. You can use :
80107
81108``` json
82109{
@@ -99,77 +126,59 @@ You can also use environment variables for better security. Replace `your_github
99126}
100127```
101128
102- ### Configuration File Location
103-
104- The Claude Desktop configuration file is typically located at:
105- - ** macOS** : ` ~/Library/Application Support/Claude/claude_desktop_config.json `
106- - ** Windows** : ` %APPDATA%/Claude/claude_desktop_config.json `
107- - ** Linux** : ` ~/.config/claude/claude_desktop_config.json `
108-
109- ### Troubleshooting Claude Desktop
129+ Then set the environment variable in your system before starting Claude Desktop.
110130
111- - Verify Docker is running and accessible
112- - Check that your GitHub PAT is valid and has the required permissions
113- - Ensure the configuration file is valid JSON
114- - Restart Claude Desktop after making configuration changes
115- - Check Claude Desktop logs for any error messages
131+ ### Installation Steps
116132
117- ### Prerequisites
133+ 1 . Open Claude Desktop
134+ 2 . Go to Settings (from the Claude menu) → Developer → Edit Config
135+ 3 . Add your chosen configuration
136+ 4 . Save the file
137+ 5 . Restart Claude Desktop
118138
119- 1 . Claude Code CLI installed
120- 2 . [ GitHub Personal Access Token] ( https://github.com/settings/personal-access-tokens/new )
139+ ### Verification
121140
122- ### Installation
141+ After restarting, you should see:
142+ - An MCP icon in the Claude Desktop interface
143+ - The GitHub server listed as "running" in Developer settings
123144
124- Run the following command in the Claude Code CLI, referencing your GitHub PAT:
125-
126- ``` bash
127- claude mcp add-json github ' {"command": "github-mcp-server", "args": ["stdio"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_pat"}}'
128- ```
145+ ---
129146
130- ### Configuration Steps
147+ ## Troubleshooting
131148
132- 1 . Replace ` your_github_pat ` with your actual GitHub Personal Access Token
133- 2 . Ensure you have the necessary permissions on your GitHub PAT for the operations you want to perform
134- 3 . The command will add the GitHub MCP Server to your Claude Code configuration
149+ ### Claude Code CLI
150+ - Verify the command syntax is correct (note the single quotes around the JSON)
151+ - Check that Node.js/npm is installed: ` node --version `
152+ - For Docker method, ensure Docker is running
153+ - Use ` /mcp ` command within Claude Code to check server status
135154
136- ### Troubleshooting Claude Code
155+ ### Claude Desktop
156+ - Check logs at:
157+ - ** macOS** : ` ~/Library/Logs/Claude/ `
158+ - ** Windows** : ` %APPDATA%\Claude\logs\ `
159+ - Look for ` mcp-server-github.log ` for server-specific errors
160+ - Ensure configuration file is valid JSON
161+ - Try running the command manually in terminal to diagnose issues
137162
138- - Verify the Claude Code CLI is properly installed and accessible
139- - Check that your GitHub PAT is valid and has the required permissions
140- - Ensure the command syntax is correct (note the single quotes around the JSON)
141- - Review Claude Code documentation for any specific MCP server requirements
163+ ### Common Issues
164+ - ** Invalid JSON** : Validate your configuration at [ jsonlint.com] ( https://jsonlint.com )
165+ - ** PAT issues** : Ensure your GitHub PAT has required scopes
166+ - ** Docker not found** : Install Docker Desktop and ensure it's running
167+ - ** NPX not found** : Install Node.js from [ nodejs.org] ( https://nodejs.org )
142168
143169---
144170
145171## Security Best Practices
146172
147- Regardless of which Claude application you're using, follow these security guidelines:
148-
149- - ** Keep your GitHub PAT secure** and never commit it to version control
150- - ** Limit the scope** of your GitHub PAT to only the permissions you need
151- - ** Consider using environment variables** for token storage when supported by your setup
173+ - ** Protect configuration files** : Set appropriate file permissions
174+ - ** Use environment variables** when possible instead of hardcoding tokens
175+ - ** Limit PAT scope** to only necessary permissions
152176- ** Regularly rotate** your GitHub Personal Access Tokens
153- - ** Ensure Docker environment is secure ** (for Claude Desktop installations)
177+ - ** Never commit ** configuration files containing tokens to version control
154178
155- ## Installation Methods
156-
157- The GitHub MCP Server supports multiple installation approaches:
158-
159- ### Docker (Recommended for Claude Desktop)
160- - ** Pros** : No local build required, consistent environment, easy updates
161- - ** Cons** : Requires Docker installed and running
162- - ** Used by** : Claude Desktop configuration above
163-
164- ### Direct Binary (Used by Claude Code)
165- - ** Pros** : No Docker required, direct execution via stdio
166- - ** Cons** : Requires the ` github-mcp-server ` binary to be available in PATH
167- - ** Used by** : Claude Code CLI configuration above
179+ ---
168180
169- ### Build from Source (Alternative)
170- - ** Pros** : Latest features, customizable, no Docker dependency
171- - ** Cons** : Requires Go development environment
172- - ** Prerequisites** : [ Go 1.24+] ( https://go.dev/doc/install )
173- - ** Build command** : ` go build -o github-mcp-server cmd/github-mcp-server/main.go `
181+ ## Additional Resources
174182
175- Choose the method that best fits your environment and requirements.
183+ - [ Model Context Protocol Documentation] ( https://modelcontextprotocol.io )
184+ - [ Claude Code MCP Documentation] ( https://docs.anthropic.com/en/docs/claude-code/mcp )
0 commit comments