a# Connecting GitHub MCP Server to Cursor
This guide shows you how to connect your GitHub MCP server to Cursor IDE so you can use all GitHub tools directly within Cursor.
## ๐ Quick Setup
### Step 1: Find Your Cursor MCP Configuration
Cursor stores its MCP configuration in different locations depending on your OS:
**Windows:**
```
%APPDATA%\Cursor\User\globalStorage\cursor.mcp\config.json
```
**macOS:**
```
~/Library/Application Support/Cursor/User/globalStorage/cursor.mcp/config.json
```
**Linux:**
```
~/.config/Cursor/User/globalStorage/cursor.mcp/config.json
```
### Step 2: Create or Update Configuration
Create/edit the config file with your GitHub MCP server:
```json
{
"mcpServers": {
"github-mcp": {
"command": "node",
"args": ["E:/Github MCP Ts-SDK/dist/server.js"],
"env": {
"GITHUB_TOKEN": "your_github_token_here",
"GITHUB_USERNAME": "your_username_here"
}
}
}
}
```
### Step 3: Update with Your Actual Paths
Replace the paths with your actual values:
1. **Server Path**: Update `E:/Github MCP Ts-SDK/dist/server.js` to your actual server path
2. **GitHub Token**: Use the token from your `.env` file
3. **Username**: Use your GitHub username
### Step 4: Restart Cursor
After updating the configuration, restart Cursor for the changes to take effect.
## ๐ง Alternative: Using Environment File
If you prefer to use your `.env` file instead of hardcoding values:
```json
{
"mcpServers": {
"github-mcp": {
"command": "node",
"args": ["E:/Github MCP Ts-SDK/dist/server.js"],
"cwd": "E:/Github MCP Ts-SDK"
}
}
}
```
This will automatically load your `.env` file since we added dotenv support.
## ๐ฏ Using GitHub Tools in Cursor
Once connected, you can use GitHub tools in Cursor:
### Available Commands:
- `@github get my info` - Get your GitHub profile
- `@github get repo info microsoft/vscode` - Get repository details
- `@github search repositories language:typescript` - Search repositories
- `@github list issues facebook/react` - List repository issues
- `@github get user stats octocat` - Get user statistics
### Natural Language Queries:
- "Show me information about the VS Code repository"
- "What are the open issues in the React repository?"
- "Search for TypeScript repositories with more than 1000 stars"
- "Get my GitHub statistics"
## ๐ ๏ธ Troubleshooting
### Server Not Found
If Cursor can't find your server:
1. Make sure the path to `dist/server.js` is correct
2. Ensure you've run `npm run build` to create the dist folder
3. Check that Node.js is in your PATH
### Authentication Errors
If you get authentication errors:
1. Verify your GitHub token is valid
2. Make sure the token has the required scopes (repo, user, read:org)
3. Check that the token is properly set in the config
### Server Won't Start
If the server fails to start:
1. Run `npm run simple-test` to verify the server works
2. Check the Cursor developer console for error messages
3. Ensure all dependencies are installed (`npm install`)
## ๐ Complete Configuration Example
Here's a complete example configuration file:
```json
{
"mcpServers": {
"github-mcp": {
"command": "node",
"args": ["E:/Github MCP Ts-SDK/dist/server.js"],
"cwd": "E:/Github MCP Ts-SDK",
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITHUB_USERNAME": "your_username"
}
}
}
}
```
## ๐ You're Ready!
After following these steps, you'll have access to all 10 GitHub tools directly in Cursor:
1. โ
get_my_info
2. โ
get_repo_info
3. โ
list_repo_issues
4. โ
list_repo_prs
5. โ
list_repo_commits
6. โ
search_repositories
7. โ
get_user_info
8. โ
list_user_repos
9. โ
get_my_repos
10. โ
get_github_stats
Plus resources and natural language prompts!
**Happy coding with GitHub integration in Cursor! ๐**