| title |
|---|
Connect Cursor to MCP for GitHub Control |
Set up full GitHub control via Cursor once your MCP server is running.
- Launch Cursor, the AI-first code editor.
- Click Settings (bottom-left corner βοΈ).
- In Settings, scroll down to the MCP (Model Context Protocol) section.
- Click "Add Server".
- Name:
Local MCP Server - URL:
http://localhost:3333(or your configured port fromserver.js) - Client: Select
ollamaor your preferred LLM engine. - Auth: Leave blank for local use (behind firewall). Add headers if using token-based auth.
β Cursor is now connected to your MCP server!
Run your server locally from your terminal:
node server.jsExpected output:
β
MCP server running at http://localhost:3333With MCP connected, use the Cursor command palette:
β + K / Ctrl + K β Type:
Create a private GitHub repo named ai-lab
Add README.md to ai-lab repo with initial text
Search repositories about 'android hacking tools'
MCP GitHub plugin (
@smithery-ai/github) handles GitHub API calls via your server.
| Tool | Description |
|---|---|
create_or_update_file |
Create or update files |
create_repository |
Create a new GitHub repository |
delete_repository |
Delete a repository (if supported) |
get_file_contents |
Read contents of files |
search_repositories |
Discover GitHub repositories |
These tools can be triggered through Cursor's prompt bar or:
npx @smithery/cli- Keep your
mcp.jsonsecure (especially GitHub tokens). - Use environment variables for secrets in production.
- Test server connection with:
curl http://localhost:3333Logs will show tool calls and API responses for easier debugging.
title: "MCP Server + GitHub Cursor Setup Guide" description: "Step-by-step guide for setting up MCP server with Cursor GitHub integration for repo automation, creation, deletion, and commit control."
This tutorial walks you through setting up MCP with GitHub using Cursor and controlling repositories from the terminal or automation workflows.
- Node.js & npm installed
- Cursor CLI downloaded for your OS
- A GitHub account
- An MCP-compatible agent setup with
@modelcontextprotocol/sdk
- Go to GitHub Developer Settings
- Click "Fine-grained tokens" β Generate new token
- Set:
- Name:
just_think - Expiration: May 18, 2025 (or your preferred)
- Permissions:
- Repositories: Full Read/Write
- User: Full Read/Write
- Name:
- Copy the token now. You will not see it again!
github_pat_11A4PP7FQ07lGRHVynbe5e_... (keep it secret!)
{
"defaultClient": "ollama",
"ollama": {
"baseUrl": "http://localhost:11434",
"model": "llama2"
},
"github": {
"token": "<your_copied_github_token>"
},
"agent": {
"name": "DevOpsAgent",
"persona": "An automation assistant for GitHub repo management"
}
}Save it as mcp.json in your project folder.
// server.js
import { studio } from '@modelcontextprotocol/sdk/server/studio.js';
studio.run({
config: './mcp.json',
port: 3333
});Then run:
node server.jsnpx -y @smithery/cli@latest install @smithery-ai/github --client claude --config mcp.jsonThis will install the GitHub Cursor adapter and register the token from mcp.json.
Use the terminal to create, delete, or manage GitHub repos:
npx @smithery/cli ask "Create a new private repo called test-automation"npx @smithery/cli ask "Delete the repo named old-project"npx @smithery/cli ask "Commit all changes to the repo my-app with message 'Init commit'"- π CI/CD Pipelines β Deploy workflows via GitHub Actions
- π§ LLM Automation β Agents can trigger repo events
- π‘ Secure DevOps β Use fine-grained tokens to maintain security
- π§° Full Dev Automation β No manual clicking, fully terminal-driven
If you'd like a complete ready-to-clone repo with these files, just ask and Iβll generate one!