home / mcp / github mcp server

GitHub MCP Server

Provides a RESTful GitHub integration to manage repositories from Cursor IDE with token-based authentication and rate limiting.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "alfie-tek-github-mcp-server": {
      "url": "http://localhost:3000",
      "headers": {
        "PORT": "3000",
        "NODE_ENV": "development",
        "GITHUB_TOKEN": "YOUR_GITHUB_TOKEN",
        "RATE_LIMIT_WINDOW_MS": "900000",
        "GITHUB_WEBHOOK_SECRET": "YOUR_WEBHOOK_SECRET",
        "RATE_LIMIT_MAX_REQUESTS": "100"
      }
    }
  }
}

You can manage GitHub repositories directly from Cursor IDE using this MCP server. It exposes a RESTful API to create and list repositories, authenticates with a personal access token, and protects you with rate limiting and robust error handling. The server runs locally and integrates seamlessly with Cursor IDE workflows for quick repository setup and management.

How to use

You will interact with the MCP server through its HTTP endpoints or by running the local server that Cursor IDE can connect to. The server provides endpoints to create repositories and to list repositories you have access to. Start by running the server locally, then point Cursor IDE at the base URL to begin creating and listing repositories from within your IDE. The system uses token-based authentication for secure access and includes rate limiting to prevent abuse.

How to install

Prerequisites you need before installing the MCP server are Node.js version 14 or higher and npm version 6 or higher. You also need a GitHub account with a Personal Access Token and Cursor IDE.

Step 1: Prepare your environment
- Ensure Node.js and npm are installed on your machine.
- Create a project directory for the MCP server and navigate into it.

Step 2: Install dependencies - Install the required packages for the MCP server.

Step 3: Create and configure environment variables - Create a .env file in the root directory and populate it with your settings.

Step 4: Start the server - Run the development server to begin using MCP with Cursor IDE.

Configuration and usage notes

The MCP server is configured to listen on port 3000 by default. It supports token-based authentication with a GitHub Personal Access Token and includes rate limiting controls to protect the API. You can customize the listening port, environment mode, and rate limiting thresholds through the environment file.

Security and logging are built in. Token-based access, input validation, CORS protection, and Helmet security headers help keep your server secure, while error and activity logs provide visibility into API usage and issues.

Examples of common tasks

Create a new repository from the MCP API: you will send a request to the create repository endpoint with repository details such as name, description, privacy, and initialization settings.

List repositories to see what you have access to with a simple request to the list endpoint.

Troubleshooting tips

If authentication fails, verify that your GitHub Personal Access Token has the required permissions (repo, read:org, admin:repo_hook) and that the token is correctly set in your environment variables.

If you encounter rate limit errors, review and adjust your RATE_LIMIT_WINDOW_MS and RATE_LIMIT_MAX_REQUESTS values in your environment configuration to balance usage with protection.

Available tools

CreateRepository

Creates a new GitHub repository with provided settings such as name, description, privacy, and initialization.

ListRepositories

Retrieves repositories accessible to the authenticated user.

HealthCheck

Provides a health status check for the MCP server at the /health endpoint.

SecurityFeatures

Token-based authentication, rate limiting, input validation, CORS protection, and security headers.

ErrorLogging

Comprehensive logging including error.log and combined.log to track issues and activity.