Explore the integration of GitHub MCP Server within Visual Studio Code, leveraging Docker and GitHub Copilot Chat to enhance AI-driven software development. Beginning with a simple C# command-line application, we will clone, configure, and establish our own repository. Through MCP configurations, developers can interact seamlessly with AI-powered agents to generate, commit, and push code, effectively transforming software engineering workflows.
Prerequisites
Install the following in order to proceed:
- Visual Studio Code with the GitHub Copilot Chat extension
- Docker Desktop
- .NET 9.0
Sample app on GitHub
Let us start with a simple C# command line application so that we can appreciate the opportunities of using MCP and AI agents in Visual Studio Code. Start by cloning this repo:
git clone https://github.com/medhatelmasry/OhMyTasks.git
cd OhMyTasks
Once you have cloned the OhMyTasks repo, go ahead and delete the .git folder so that the code is disconnected from the original repo.
On Windows:
rmdir /s /q .git
On Mac:
rm -rf .git
Change into the TasksManagerConsole folder and run the command-line application with "dotnet run" to experience what it does.
Next, create your own repo on github.com, under your account, and push the code.
git init
git add .
git commit -m "Initial commit"
git remote add origin <your-repo-url>
git push -u origin main
Add the following issue to your repo:
Subject:
Add task delete functionality
Description
Currently, in the OhMyTasks repo, users can only add a task and mark it as incomplete. There is no way to delete a task once it has been added. Please implement functionality to allow users to delete tasks from the list.
**Expected Behavior:**
- Users should be able to delete an existing task.
- After deletion, the task should no longer appear in the task list.
**Acceptance Criteria:**
- A delete option is available for each task.
- Deleting a task removes it from storage and the UI.
- Appropriate feedback is given to the user after deletion (e.g., confirmation or undo option).
Please provide tests and update the documentation as needed.
Configure VS Code
Start Docker Desktop on your computer.
Open the OhMyTasks source code in VS Code.. Click on the settings gear in the bottom-left corner, followed by Settings.
In the search field, enter MCP, then click on "Edit in settings.json".
Visit https://github.com/github/github-mcp-server. Under "Usage in other MCP Hosts", Copy the github JSON block.
Under the mcp >> servers section in your settings.json file, add the following MCP server settings:
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
}
}
Click on Start.
Generating a Personal Access Token (PAT) on github.com
- Go to GitHub and sign in.
- Open Settings: Click on your profile picture (top-right) and select Settings.
- Navigate to Developer Settings: Scroll down and click Developer Settings.
- Select Personal Access Tokens: Click "Personal access tokens" > "Fine-grained tokens".
- Generate a New Token:
- Click "Generate new token".
- Add a note (e.g., "VS Code MCP Server").
- Set an expiration date (or choose "No expiration" if needed).
- Select the permissions required (e.g., repo, workflow, read:org).
- Copy the Token: Once generated, copy it immediately - you won’t be able to see it again!
Replace the value of GITHUB_PERSONAL_ACCESS_TOKEN with your GitHub Personal Access Token (PAT). Eventually, the mcp >> servers block in settings.json will look like this:
NOTE: I have purposely truncated my PAT because, obviously, I do not want to share it with the world.
We can now start the server. Click on start (or restart).
In Docker Desktop, you will notice that a container has started.
Open the GitHub Copilot Chat panel:
In the GitHub Copilot Chat panel, choose any Claude model followed by Agent Mode.
Click on the tools icon in the prompt window.
I entered this prompt: Using the GitHub MCP server, list open issues in the medhatelmasry/OhMyTasks2 repo.
NOTE: Replace medhatelmasry/OhMyTasks2 above with your GitHub handle and repo.
After the appropriate GitHub repo was queried, I received this response:There is currently 1 open issue in the repository:
Issue #1: "Add task delete functionality"
- Created by: medhatelmasry (owner)
- Created on: June 13, 2025
- Status: Open
The issue describes the need to implement functionality for deleting tasks from the application. Currently, users can only add tasks and mark them as incomplete, but there's no way to delete them.
The issue includes the following acceptance criteria:
- A delete option should be available for each task
- Deleting a task should remove it from storage and the UI
- Appropriate feedback should be given to the user after deletion
Would you like me to help you implement this feature or would you like to see more details about this issue?
You can get VS Code to go ahead and implement the issue by responding with a simple: YES.
It took the agent about 90 seconds to complete the task. It then provided a summary with what it did. To accept the changes made, click on the Keep button.
Go ahead and text the application. You will notice that it now has a 'Delete task' option.You get the idea. As long as the tooken is granted the appropriate permissions, the agent can create a new branch, push the code, and create a pull request.
Alternative way to configure GitHub MCP server in VS Code
By adding MCP configurations to settings.json, it becomes global to all your VS Code projects and solutions. Suppose you want to confine these configurations to specific projects and solutions. In that case you can do the following:
In the root of your solution (not project), create a folder named .vscode. Inside the .vscode folder, create a text file named mcp.json. You will see a button "Add Server...". If you do not see the "Add Server..." button, do the above using the default tab in VS Code, instead of Solution Explorer.
Click on the "Add Server..." button, then choose "Docker Image".
For Image Name, enter mcp/github then hit 'Enter'.Next, choose Allow.Accept the default Server ID.The content of mcp.json looks very similar to what we had before in settings.json. We cannot have the same JSON in both files. Therefore, move the github { .... } block from settings.json to mcp.json.Start the GitHub MCP Server in mcp.json. We have the same agent functionality as before. Try this prompt:
Add and commit the current code.
After clicking on Continue, I got another message pertaining to code commit.It then offers to push the changes. Once again I responded with Yes.In my case it went as far as creating a feature branch, pushing to the feature branch, then issuing a pull request. It finally informed me that the code is ready for review.Conclusion
The GitHub MCP server provides an agent that is essentially becomes a team member. This changes software development forever. Of course, the question on every developer's mind is: What is going to happen to our jobs in the future. I have no answer to that. However, one can say that developers will be affected by AI and agents. At this time, we must be aware of what is going on in the MCP and AI space.
No comments:
Post a Comment