This project implements a Model Context Protocol (MCP) server that integrates with GitHub to provide comprehensive functionality for web-based projects in Cursor.
repo (Full repository access)project (Project access)write:org (Organization access)Clone the repository:
git clone https://github.com/yourusername/github-mcp-server.git
cd github-mcp-server
Install dependencies:
npm install
Create a .env file in the root directory with your GitHub credentials:
GITHUB_TOKEN=your_github_personal_access_token
GITHUB_OWNER=default_repository_owner
GITHUB_REPO=default_repository_name
PORT=3000
HOST=0.0.0.0
NODE_ENV=development
DEFAULT_TRANSPORT=stdio
npm run start:stdio
npm run start:sse
Create a .cursor/mcp.json file in your project root:
{
"servers": [
{
"name": "github-mcp-server",
"command": "npm",
"args": ["run", "start:stdio"],
"cwd": "/path/to/github-mcp-server",
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token",
"GITHUB_OWNER": "your_github_username",
"GITHUB_REPO": "your_repository_name"
}
}
]
}
Create a ~/.cursor/mcp.json file:
{
"servers": [
{
"name": "github-mcp-server",
"command": "npm",
"args": ["run", "start:stdio"],
"cwd": "/path/to/github-mcp-server",
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token",
"GITHUB_OWNER": "your_github_username",
"GITHUB_REPO": "your_repository_name"
}
}
]
}
For SSE transport, modify the configuration:
{
"servers": [
{
"name": "github-mcp-server",
"url": "http://localhost:3000/sse"
}
]
}
The MCP server exposes the following tools to Cursor:
github_repository_info: Get information about a GitHub repositorygithub_directory_structure: Get the directory structure of a GitHub repositorygithub_read_file: Read a file from a GitHub repositorygithub_list_branches: List branches in a GitHub repositorygithub_list_issues: List issues in a GitHub repositorygithub_create_issue: Create a new issue in a GitHub repositorygithub_list_projects: List GitHub projectsgithub_create_project: Create a new GitHub projectFor detailed information about each tool, see the API Reference.
npm run build
npm test
npm run lint
npm run format
The project follows a clean architecture approach with distinct layers:
For more details, see ARCHITECTURE.md.
MIT