Back to Documentation

Testing the GitHub MCP Server with Cursor

This document provides instructions for testing the GitHub MCP server with Cursor.

Prerequisites

Before testing, ensure you have:

  1. Installed the GitHub MCP server and its dependencies
  2. Set up your GitHub Personal Access Token with appropriate permissions
  3. Configured the .env file with your GitHub credentials
  4. Installed Cursor (latest version)

Testing with stdio Transport

Step 1: Configure Cursor

Create a .cursor/mcp.json file in your project root:

{
  "servers": [
    {
      "name": "github-mcp-server",
      "command": "npm",
      "args": ["run", "start:stdio"],
      "cwd": "/absolute/path/to/github-mcp-server",
      "env": {
        "GITHUB_TOKEN": "your_github_personal_access_token",
        "GITHUB_OWNER": "your_github_username",
        "GITHUB_REPO": "your_repository_name"
      }
    }
  ]
}

Step 2: Start Cursor

Open your project in Cursor.

Step 3: Verify MCP Server Detection

Cursor should automatically detect and connect to the MCP server. You can verify this by:

  1. Opening the Cursor command palette (Cmd+Shift+P or Ctrl+Shift+P)
  2. Typing "MCP" and selecting "MCP: List Available Servers"
  3. Confirming that "github-mcp-server" appears in the list

Step 4: Test GitHub Functionality

Try using the following GitHub operations in Cursor:

  1. View Repository Structure:
    • Open the command palette
    • Type "GitHub" and select "GitHub: View Repository Structure"
    • Enter the repository owner and name when prompted
  2. View File Content:
    • Open the command palette
    • Type "GitHub" and select "GitHub: View File Content"
    • Enter the repository owner, name, and file path when prompted
  3. List Issues:
    • Open the command palette
    • Type "GitHub" and select "GitHub: List Issues"
    • Enter the repository owner and name when prompted

Testing with SSE Transport

Step 1: Start the MCP Server with SSE Transport

cd github-mcp-server
npm run start:sse

This will start the server on http://localhost:3000/sse by default.

Step 2: Configure Cursor

Create a .cursor/mcp.json file in your project root:

{
  "servers": [
    {
      "name": "github-mcp-server",
      "url": "http://localhost:3000/sse"
    }
  ]
}

Step 3: Start Cursor and Test

Follow the same steps as for stdio transport to verify the MCP server is detected and to test GitHub functionality.

Troubleshooting

MCP Server Not Detected

If Cursor doesn't detect the MCP server:

  1. Verify the server is running
  2. Check the .cursor/mcp.json configuration
  3. Restart Cursor
  4. Check the Cursor logs for any error messages

GitHub API Errors

If you encounter GitHub API errors:

  1. Verify your GitHub token has the necessary permissions
  2. Check that the repository exists and is accessible
  3. Ensure you're not hitting GitHub API rate limits

Transport Issues

If you have issues with a specific transport:

  1. Try switching between stdio and SSE transports
  2. For SSE, ensure the port is not blocked by a firewall
  3. Check for any network connectivity issues

Next Steps

After successful testing, you can:

  1. Extend the MCP server with additional GitHub functionality
  2. Customize the implementation for your specific needs
  3. Deploy the SSE transport version for team use