Automate Your GitHub Workflow with the mCP Server in Cursor
In my opinion, you don't really need to use the terminal anymore, at least when it comes to GitHub. Let me show you what I mean; everything can now be automated with this new tool.
A Quick Demonstration
For example, let's ask it to create a repository. Normally, I'd have to go to the GitHub website and do it manually, but now I can do it directly in Cursor. So let's send the request.
You can see that the mCP tool is being called, and it's using the create repository
tool.
The setup for this particular mCP server was a bit complex. If you're not sure what this means, don't worry, I'll explain everything. But first, let's just see it in action.
And there it is, the repository has been created. Let's check if it actually worked. Yep, you can see that the testing
repository has been created.
Now, let's take it a step further. Let's ask it to add a simple HTML file with a greeting message and push it to the repo. Let's see what happens.
Again, it's calling the mCP tool, but this time it's using the push files
tool. And even though it encountered an error, it's fixing it automatically using another tool. And there we go. Let's check it out.
Yep, the HTML file is there, and it even wrote the greeting message. Now if I want, I can clone the repo right here. Let's do that.
And you can see it's cloned successfully. I have the index.html
file, and the greeting message is right there. So yeah, this is really cool. And these aren't the only features; there are tons of other things you can do with it.
The Model Context Protocol (mCP) Server
This is the mCP server fully added to my Cursor IDE. You can see some of the other features: it can search issues, search code, create branches, and even fork repositories. But the best one, in my opinion, is that you just type it out, and it will create requests for you. There's no break in your flow state; you just keep working. And even if you simply tell the agent, it will handle everything for you. With this wide range of tools that the mCP server has access to, it truly automates the entire workflow.
So, this is the Model Context Protocol and its collection of repositories. Down here, you'll find the servers
repo, and inside that, go into Source
. From there, head over to GitHub
. This is the repo we'll be using, and it contains everything related to the mCP server. For example, it includes all the tools available in the mCP server, and you can read about them in extensive detail. It also provides a full breakdown of the mCP server's capabilities.
Installation Guide
Now, down here we have the installation instructions, so let me walk you through them. They've outlined usage for Claude Desktop, but for Cursor, it's going to be a bit different. I'll guide you through that.
For this, we'll be using npx
, so open up your terminals and follow along. This is the command we're going to be using:
GITHUB_TOKEN=ghp_... npx @mcp/server@latest github --port 3000
You'll notice that in this command, we need to provide an environment variable, which is our personal access token. We can't paste the command directly into Cursor because Cursor doesn't accept environment variables directly in the command. Instead, you're going to create a shell script, and then we'll execute it through Cursor.
Step 1: Create the Execution Script
- In the terminal, create the file. For example:
touch script.sh
- Next, open it using a text editor like
nano
:nano script.sh
- Inside the file, paste the command from above.
Step 2: Generate a GitHub Personal Access Token
You'll need to replace the ghp_...
part with your actual personal access token. Here is how to get it from GitHub:
- Click on your profile, go to Settings.
- Scroll down on the left side and click on Developer settings.
- Go to Personal access tokens and select Tokens (classic).
- You'll see I've already generated a token for mCP, but to create a new one, click on Generate new token and choose the classic option.
- Name the token and set an expiration date.
- Important: Select the
repo
scope. This will give the token access to all of your private repositories, which is necessary for mCP to function correctly.
Note: Once the token is generated, GitHub will display it only once, so save it somewhere safe.
Step 3: Finalize the Script
- After you have your personal access token, just paste it into the
script.sh
file you created. - To save and exit in the nano editor, press
Ctrl+O
, thenEnter
, and after that, pressCtrl+X
. - Once it's saved, you need to get its absolute file path so you can paste it into Cursor. For that, we'll use the
realpath
command.
Note: The script I showed you is just a demo. My actual script is
run.sh
, so I'll be using that. For you, make sure to use the script where you pasted your personal access token.
realpath your_script_name.sh
After running the command, it will generate the file path, so just copy it.
Step 4: Add the mCP Server to Cursor
- To add the mCP to Cursor, open Cursor Settings.
- From there, go into the mCP section and click on Add a new mCP server.
- In the menu, name the mCP server. This is just a nickname, so you can name it whatever you want.
- For the Type, select Command since we're running an actual command.
- Then, here in this section, type
bash
followed by the file path that you copied. - Then add it. Since I've already added mine, you can see the command I pasted, the green light, and all the available tools.
Testing The Setup
Okay, so now that we've set it up, let's test it out again. You must be in agent mode for this to work, so make sure that's enabled.
Now, let's ask it to search for co-medan
on GitHub. You can see it's calling the mCP tool, and it's using the search users
tool. So let's run it. Now it's calling another tool, the search repositories
tool, so let's see what it finds.
And there it is. It has found the co-medan
GitHub profile. And yes, that's the actual username. I was going to ask it to list the repositories, but it looks like it has already done that automatically. You can see that the archon
repository is listed. It's a pretty great tool; you should definitely check out his article on that. It's a super creative and amazing tool for building AI agents.
But yeah, this mCP server is really cool. I just showed you some of the basic features, but the installation process was covered thoroughly so that you don't run into any issues setting it up.
Now go ahead, try it out, and see how it fits into your workflow. I didn't test out all the features, certainly not the most impressive ones, but this article should have given you a good idea of how you can actually use this with your Cursor agent.