Skip to content

Commit 3560393

Browse files
committed
feat: add beginner and intermediate guides for MCP servers integration with GitHub Copilot
1 parent d9af306 commit 3560393

2 files changed

Lines changed: 549 additions & 0 deletions

File tree

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
---
2+
title: "Getting Started with MCP Servers for Copilot"
3+
description: "A beginner's guide to installing and using MCP servers with GitHub Copilot, featuring the GitHub MCP server as a practical example"
4+
category: "GitHub Copilot"
5+
tags: ["github-copilot", "mcp", "mcp-servers", "beginner", "github-api"]
6+
difficulty: "Beginner"
7+
author: "GitHub Copilot"
8+
publishedDate: "2025-06-11"
9+
lastModified: "2025-06-13"
10+
---
11+
12+
# Getting Started with MCP Servers for Copilot
13+
14+
Model Context Protocol (MCP) servers are pre-built tools that extend GitHub Copilot's capabilities by connecting it to external services and data sources. Instead of building these integrations from scratch, you can install existing MCP servers to instantly give Copilot new superpowers.
15+
16+
## What are MCP Servers?
17+
18+
MCP servers are like plugins that allow Copilot to:
19+
20+
- Access live data from APIs and services
21+
- Perform real-world actions (create issues, search repositories, etc.)
22+
- Use external tools and databases
23+
- Get up-to-date information beyond its training data
24+
25+
Think of MCP servers as giving Copilot the ability to "phone a friend" - connecting it to specialized services that can help answer questions and perform tasks.
26+
27+
## Example: Installing the GitHub MCP Server
28+
29+
The GitHub MCP server is perfect for beginners because it connects Copilot to GitHub's API, allowing you to work with repositories, issues, and pull requests directly in your conversations.
30+
31+
### Prerequisites
32+
33+
Before installing any MCP server, you'll need:
34+
35+
- A GitHub personal access token (for the GitHub MCP server)
36+
- Node.js installed on your system
37+
- Visual Studio Code with the GitHub Copilot extension
38+
39+
### Step 1: Install the GitHub MCP Server
40+
41+
```bash
42+
# Install the GitHub MCP server globally
43+
npm install -g @modelcontextprotocol/server-github
44+
45+
# Or install it locally in your project
46+
npm install @modelcontextprotocol/server-github
47+
```
48+
49+
### Step 2: Configure Your GitHub Token
50+
51+
Create a `.env` file in your project root:
52+
53+
```env
54+
GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here
55+
```
56+
57+
To create a GitHub token:
58+
59+
1. Go to GitHub Settings → Developer settings → Personal access tokens
60+
2. Generate a new token with `repo` and `read:org` permissions
61+
3. Copy the token to your `.env` file
62+
63+
### Step 3: Configure Visual Studio Code Settings
64+
65+
Visual Studio Code users need to configure the MCP server in their settings. You have two options:
66+
67+
#### Option A: User Settings (Recommended for beginners)
68+
69+
Open Visual Studio Code Settings (Ctrl+, or Cmd+,) and add this to your `settings.json`:
70+
71+
```json
72+
{
73+
"github.copilot.advanced": {
74+
"debug": true
75+
},
76+
"mcp.servers": {
77+
"github": {
78+
"command": "node",
79+
"args": ["./node_modules/@modelcontextprotocol/server-github/dist/index.js"],
80+
"env": {
81+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${env:GITHUB_PERSONAL_ACCESS_TOKEN}"
82+
}
83+
}
84+
}
85+
}
86+
```
87+
88+
**💡 Visual Studio Code Tip**: Access your settings.json quickly by pressing `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac), then type "Preferences: Open User Settings (JSON)"
89+
90+
#### Option B: Workspace Settings (For project-specific setup)
91+
92+
Create a `.vscode/settings.json` file in your project root with the same configuration. This keeps the MCP server configuration tied to your specific project.
93+
94+
**⚠️ Visual Studio Code Security Note**: Visual Studio Code may show a security prompt when first loading MCP servers. This is normal - click "Allow" to enable the server functionality.
95+
96+
### Step 4: Verify Installation in Visual Studio Code
97+
98+
After configuration, verify everything is working:
99+
100+
1. **Check the Output Panel**:
101+
- Open View → Output (or `Ctrl+Shift+U`)
102+
- Select "GitHub Copilot" from the dropdown
103+
- Look for MCP server connection messages
104+
105+
2. **Test with Copilot Chat**:
106+
- Open Copilot Chat (Ctrl+Alt+I or click the chat icon)
107+
- Try asking: "What repositories do I have access to?"
108+
109+
3. **Enable Debug Mode** (if needed):
110+
- The `"debug": true` setting in your configuration will show detailed logs
111+
- Check the Visual Studio Code Developer Console (Help → Toggle Developer Tools) for detailed MCP messages
112+
113+
## Using the GitHub MCP Server in Visual Studio Code
114+
115+
Once configured, you can leverage the GitHub MCP server directly within your Visual Studio Code workflow:
116+
117+
### Visual Studio Code Copilot Chat Integration
118+
119+
The GitHub MCP server works seamlessly with Visual Studio Code's Copilot Chat panel:
120+
121+
**🎯 Visual Studio Code Pro Tip**: Use the `#github` context in your Copilot Chat to explicitly reference GitHub data:
122+
123+
```copilot-prompt
124+
"#github What are the recent issues in the microsoft/vscode repository?"
125+
"#github Show me the latest pull requests for my organization's main project"
126+
"#github What's the current status of issue #1234 in my repository?"
127+
```
128+
129+
### Inline Chat with GitHub Context
130+
131+
Visual Studio Code's inline chat (Ctrl+I) can also use GitHub MCP server data:
132+
133+
```copilot-prompt
134+
"Help me write a commit message based on the current GitHub issue I'm working on"
135+
"Generate code comments that reference the GitHub issue this fixes"
136+
"Create a PR description template for this type of change"
137+
```
138+
139+
### Sidebar Integration
140+
141+
Access GitHub functionality through Visual Studio Code's sidebar:
142+
143+
- **Source Control Panel**: Copilot can now suggest commit messages based on related GitHub issues
144+
- **Explorer Panel**: Right-click files and ask Copilot about their GitHub history
145+
- **Problems Panel**: Get suggestions for creating GitHub issues from error patterns
146+
147+
### 1. Repository Information
148+
149+
```copilot-prompt
150+
"What are the recent issues in the microsoft/vscode repository?"
151+
"Show me the latest pull requests for my organization's main project"
152+
"What's the current status of issue #1234 in my repository?"
153+
```
154+
155+
### 2. Creating Issues and PRs
156+
157+
```copilot-prompt
158+
"Create a new issue in my repository about fixing the login bug"
159+
"Draft a pull request description for my authentication improvements"
160+
"Help me find similar issues to the one I'm working on"
161+
```
162+
163+
### 3. Repository Analysis
164+
165+
```copilot-prompt
166+
"What are the most active contributors to this repository?"
167+
"Show me the commit history for the last week"
168+
"What files have been changed most frequently?"
169+
```
170+
171+
## What Makes This Powerful
172+
173+
With the GitHub MCP server connected, Copilot can:
174+
175+
- **Get Real-time Data**: Access current repository state, not just training data
176+
- **Perform Actions**: Create issues, comment on PRs, and update repositories
177+
- **Contextual Suggestions**: Understand your project's GitHub history and patterns
178+
- **Cross-reference**: Link code suggestions to actual issues and discussions
179+
180+
## Other Beginner-Friendly MCP Servers
181+
182+
Once you're comfortable with the GitHub MCP server, try these:
183+
184+
### Database Servers
185+
186+
- **SQLite MCP Server**: Query local databases
187+
- **PostgreSQL MCP Server**: Connect to PostgreSQL databases
188+
- **MongoDB MCP Server**: Work with MongoDB collections
189+
190+
### File System Servers
191+
192+
- **File System MCP Server**: Read and write files
193+
- **Search MCP Server**: Search through project files
194+
- **Git MCP Server**: Perform Git operations
195+
196+
### API Servers
197+
198+
- **REST API MCP Server**: Make HTTP requests to APIs
199+
- **Weather MCP Server**: Get weather data for location-based apps
200+
- **News MCP Server**: Fetch current news for content applications
201+
202+
## Best Practices for Beginners
203+
204+
1. **Start Simple**
205+
206+
- Begin with one MCP server (like GitHub)
207+
- Test basic functionality before adding complexity
208+
- Read the server documentation thoroughly
209+
210+
2. **Secure Your Tokens**
211+
212+
- Never commit API tokens to version control
213+
- Use environment variables for sensitive data
214+
- Regularly rotate your access tokens
215+
216+
3. **Test Your Setup**
217+
218+
- Verify the MCP server is working with simple queries
219+
- Check VS Code's developer console for connection issues
220+
- Start with read-only operations before trying write operations
221+
222+
4. **Understand Permissions**
223+
224+
- Know what permissions your tokens grant
225+
- Use minimal required permissions for security
226+
- Be aware of rate limits and API quotas
227+
228+
## Troubleshooting Common Issues in Visual Studio Code
229+
230+
### MCP Server Not Connecting
231+
232+
**Symptoms**: Copilot doesn't recognize GitHub-related requests
233+
234+
**Visual Studio Code Solutions**:
235+
236+
1. **Check Extension Status**: Ensure GitHub Copilot extension is active in Extensions panel
237+
2. **Reload Window**: Press `Ctrl+Shift+P` → "Developer: Reload Window"
238+
3. **Check Output Panel**: View → Output → Select "GitHub Copilot" for error messages
239+
4. **Verify Settings**: Open `settings.json` and confirm MCP configuration is correct
240+
241+
### Permission Errors in Visual Studio Code
242+
243+
**Symptoms**: "Permission denied" when trying to create issues or access repositories
244+
245+
**Visual Studio Code Solutions**:
246+
247+
1. **Token Verification**:
248+
- Open Visual Studio Code Terminal (Ctrl+` or View → Terminal)
249+
- Run: `echo $GITHUB_PERSONAL_ACCESS_TOKEN` to verify token is set
250+
- If empty, check your `.env` file is in the right location
251+
252+
2. **Extension Permissions**:
253+
- Go to Extensions → GitHub Copilot → Settings
254+
- Ensure all necessary permissions are enabled
255+
256+
3. **Workspace Trust**:
257+
- Visual Studio Code may require you to trust the workspace
258+
- Click "Trust" when prompted, or go to File → Trust Workspace
259+
260+
### Visual Studio Code Performance Issues
261+
262+
**Symptoms**: Slow responses when using GitHub MCP server
263+
264+
**Visual Studio Code Optimization**:
265+
266+
1. **Disable Unnecessary Extensions**: Turn off extensions you don't need
267+
2. **Increase Memory**: Add to settings.json: `"github.copilot.advanced.length": 2000`
268+
3. **Check CPU Usage**: Open Visual Studio Code's built-in performance monitor (Help → Performance)
269+
270+
**🔧 Visual Studio Code Debug Tip**: Enable verbose logging by adding `"mcp.debug": true` to your settings.json for detailed troubleshooting information.
271+
272+
## Next Steps
273+
274+
Once you're comfortable with the GitHub MCP server:
275+
276+
1. **Explore More Servers**: Try database or file system MCP servers
277+
2. **Combine Servers**: Use multiple MCP servers together for complex workflows
278+
3. **Learn Advanced Features**: Explore server-specific advanced capabilities
279+
4. **Build Custom Servers**: Create your own MCP servers for unique needs (covered in future tips!)
280+
281+
## Learn More
282+
283+
For more information about MCP servers:
284+
285+
- [MCP Server Registry](https://github.com/topics/mcp-server) - Discover available MCP servers
286+
- [GitHub MCP Server Documentation](https://github.com/modelcontextprotocol/servers/tree/main/src/github)
287+
- [MCP Protocol Specification](https://modelcontextprotocol.io/docs/)
288+
- [Visual Studio Code MCP Integration Guide](https://code.visualstudio.com/docs/copilot/mcp-servers)

0 commit comments

Comments
 (0)