Skip to content

Commit eda9fad

Browse files
authored
Update install-cursor.md
1 parent 254b4a3 commit eda9fad

1 file changed

Lines changed: 120 additions & 31 deletions

File tree

Lines changed: 120 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
# Install GitHub MCP Server in Cursor
22

33
## Prerequisites
4+
1. Cursor IDE installed (latest version)
5+
2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) with appropriate scopes
6+
3. For local installation: [Docker](https://www.docker.com/) installed and running
47

5-
1. Cursor IDE installed
6-
2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new)
7-
3. [Docker](https://www.docker.com/) installed and running
8+
## Remote Server Setup (Recommended)
89

9-
## Installation Steps
10+
The remote GitHub MCP server is hosted by GitHub at `https://api.githubcopilot.com/mcp/` and supports both HTTP and SSE protocols. Cursor currently supports remote servers with PAT authentication.
11+
12+
### SSE Configuration
13+
As of Cursor v0.48.0, Cursor supports SSE servers directly:
14+
15+
```json
16+
{
17+
"mcpServers": {
18+
"github": {
19+
"url": "https://api.githubcopilot.com/mcp/",
20+
"headers": {
21+
"Authorization": "Bearer YOUR_GITHUB_PAT"
22+
}
23+
}
24+
}
25+
}
26+
```
27+
28+
**Note**: If your Cursor version doesn't support direct SSE, you may need to use a proxy tool like `mcp-remote`.
1029

11-
1. Go to `Cursor Settings``Tools & Integrations` → Click `Add Custom MCP` or `New MCP Server`
12-
2. Use the following `mcp.json` structure:
30+
## Local Server Setup
1331

32+
### Option 1: Docker (Recommended)
1433
```json
1534
{
1635
"mcpServers": {
@@ -25,44 +44,114 @@
2544
"ghcr.io/github/github-mcp-server"
2645
],
2746
"env": {
28-
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_pat"
47+
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"
2948
}
3049
}
3150
}
3251
}
3352
```
3453

35-
3. Replace `your_github_pat` with your actual GitHub PAT
36-
4. Restart Cursor for changes to apply
54+
### Option 2: NPX
55+
```json
56+
{
57+
"mcpServers": {
58+
"github": {
59+
"command": "npx",
60+
"args": ["-y", "@modelcontextprotocol/server-github"],
61+
"env": {
62+
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"
63+
}
64+
}
65+
}
66+
}
67+
```
3768

38-
## Important Security Notes
69+
**Note**: The npm package has a deprecation notice but remains functional.
3970

40-
⚠️ **Environment Variable Limitations**: Environment-variable interpolation (using a `$GITHUB_PAT` variable) is not supported in Cursor.
71+
## Installation Steps
4172

42-
### Security Best Practices
73+
### Via Cursor Settings UI
74+
1. Open Cursor
75+
2. Navigate to **Settings****Tools & Integrations****MCP**
76+
3. Click **"+ Add new global MCP server"**
77+
4. This opens `~/.cursor/mcp.json` in the editor
78+
5. Add your chosen configuration from above
79+
6. Save the file
80+
7. Restart Cursor
81+
82+
### Manual Configuration
83+
1. Create or edit the configuration file:
84+
- **Global (all projects)**: `~/.cursor/mcp.json`
85+
- **Project-specific**: `.cursor/mcp.json` in project root
86+
2. Add your chosen configuration
87+
3. Save the file
88+
4. Restart Cursor completely
89+
90+
## Security Best Practices
91+
92+
### Configuration Note
93+
Cursor's current MCP implementation requires tokens to be specified directly in the configuration file. We recommend taking extra security precautions:
94+
95+
### File Protection
96+
```bash
97+
# Secure the configuration file
98+
chmod 600 ~/.cursor/mcp.json
99+
100+
# For project-specific config
101+
chmod 600 .cursor/mcp.json
102+
103+
# Verify permissions
104+
ls -la ~/.cursor/mcp.json
105+
```
43106

44-
- **File Permissions**: Lock down file permissions for the configuration file:
45-
```bash
46-
chmod 600 ~/.codeium/windsurf/mcp.json
47-
```
48-
- **Version Control**: Avoid committing configuration files with tokens to version control
49-
- **Token Scope**: Limit PAT scopes to necessary repositories and tools only
50-
- **Token Rotation**: Regularly rotate your GitHub Personal Access Tokens
107+
### Token Security
108+
- Create PATs with minimum required scopes:
109+
- `repo` - For repository operations
110+
- `read:packages` - For Docker image pull (local setup)
111+
- Additional scopes based on tools you need
112+
- Use separate PATs for different projects
113+
- Regularly rotate tokens
114+
- Never commit configuration files to version control
51115

52-
## Configuration File Location
116+
## Configuration Details
53117

54-
The MCP configuration is typically stored at:
55-
- `~/.codeium/windsurf/mcp.json`
118+
- **File paths**:
119+
- Global: `~/.cursor/mcp.json`
120+
- Project: `.cursor/mcp.json`
121+
- **Scope**: Both global and project-specific configurations supported
122+
- **Format**: Must be valid JSON (use a linter to verify)
56123

57-
## Troubleshooting
124+
## Verification
58125

59-
- Ensure Docker is running and accessible
60-
- Verify your GitHub PAT is valid and has required permissions
61-
- Check that the JSON configuration is valid
62-
- Restart Cursor after making configuration changes
63-
- Review Cursor logs for any MCP server startup errors
64-
- Ensure the GitHub MCP Server Docker image is accessible (`ghcr.io/github/github-mcp-server`)
126+
After installation:
127+
1. Restart Cursor completely
128+
2. Open Settings → Tools & Integrations → MCP
129+
3. Look for green dot next to your server name
130+
4. In chat/composer, check "Available Tools"
131+
5. Test with: "List my GitHub repositories"
65132

66-
## Alternative Setup
133+
## Troubleshooting
67134

68-
If you prefer to manually edit the configuration file, you can directly edit the `mcp.json` file at the location mentioned above with the same JSON structure.
135+
### Remote Server Issues
136+
- **SSE not working**: Ensure you're using Cursor v0.48.0 or later
137+
- **Authentication failures**: Verify PAT has correct scopes
138+
- **Connection errors**: Check firewall/proxy settings
139+
140+
### Local Server Issues
141+
- **Docker errors**: Ensure Docker Desktop is running
142+
- **Image pull failures**: Try `docker logout ghcr.io` then retry
143+
- **NPX failures**: Clear npm cache with `npm cache clean --force`
144+
145+
### General Issues
146+
- **MCP not loading**: Restart Cursor completely after configuration
147+
- **Invalid JSON**: Validate with [jsonlint.com](https://jsonlint.com)
148+
- **Tools not appearing**: Check server shows green dot in MCP settings
149+
- **Check logs**: Look for MCP-related errors in Cursor logs
150+
151+
## Important Notes
152+
153+
- **Official repository**: [github/github-mcp-server](https://github.com/github/github-mcp-server)
154+
- **Remote server URL**: `https://api.githubcopilot.com/mcp/`
155+
- **Docker image**: `ghcr.io/github/github-mcp-server`
156+
- **npm package**: `@modelcontextprotocol/server-github` (deprecated but functional)
157+
- **Cursor specifics**: Supports both project and global configurations, uses `mcpServers` key

0 commit comments

Comments
 (0)