Skip to content

MCP GitHub Server: 'fetch is not defined' error when executing any tool #1065

@circuitfive

Description

@circuitfive

Issue Description

When attempting to use the GitHub MCP server via NPX installation, all tool executions fail with the error: MCP error -32603: fetch is not defined. This appears to be due to a missing dependency on node-fetch in the published package.

Steps to Reproduce

  1. Install the server using the NPX method as documented in the README:
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
      }
    }
  }
}
  1. Start the server (server starts successfully)
  2. Attempt to execute any tool (e.g., get_file_contents)
  3. Observe the error: MCP error -32603: fetch is not defined

Environment

  • Operating System: macOS Sonoma
  • Node.js version: v20.19.0
  • IDE: VSCode with Cursor extension
  • Cursor version: 3.8.2
  • MCP integration: Using Cline MCP settings with default configuration

Expected Behavior

Tools should execute successfully without dependency errors.

Actual Behavior

All tool executions fail with fetch is not defined error, indicating the server package is missing the node-fetch dependency.

Suggested Fix

Consider adding node-fetch as a dependency in the package.json file for the GitHub MCP server.

Additional Notes

This issue was not present in the repository's issue tracker as of March 25, 2025. The server process runs without startup errors, but fails when attempting to execute any tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions