Skip to content

Error executing MCP tool: Not connected #1082

Closed

Description

@Wenjing-Wei

GitHub MCP Server Connection Issue

Problem Description

Unable to establish connection with GitHub MCP server despite:

  • Valid GitHub token
  • Server process running
  • Multiple troubleshooting attempts

Error Messages

Error executing MCP tool: {"name":"Error","message":"Not connected"}

Configuration

{
  "command": "npx",
  "args": ["-y", "@modelcontextprotocol/server-github"],
  "env": {
    "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_...redacted..."
  },
  "disabled": false,
  "autoApprove": ["*"]
}

Troubleshooting Steps Taken

  1. Verified GitHub token works via direct API call
  2. Tried running server with --verbose flag
  3. Checked for running node processes
  4. Modified auto-approve settings
  5. Attempted multiple MCP tool calls

System Information

  • OS: Windows 10
  • Node: v20.11.1
  • Shell: PowerShell 7

Suggested Next Steps

  1. Check server's MCP protocol implementation
  2. Verify stdio transport compatibility
  3. Review connection handshake process

Activity

  1. BadAtCaptchas commented on Mar 30, 2025

    @BadAtCaptchas

    +1 having this issue on every MCP tool I attempt to use.

  2. assaf-b commented on Apr 1, 2025

    @assaf-b

    +1 on this

  3. ZachTheJack commented on Apr 1, 2025

    @ZachTheJack

    I was able to get mine working on Windows 10 using the following:

    { "mcpServers": { "github": { "command": "cmd", "args": [ "/c", "npx", "-y", "@modelcontextprotocol/server-github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } } }

    And then using the following command in my terminal:

    npm install -g @modelcontextprotocol/server-github

    I talked about this in my comment on this other post, but essentially it's likely because of Windows policies not allowing the temporary execution using npx.

    Instead, you have to install the package globally to your machine using npm.

    Global installations via npm install -g adds the package to your system PATH, whereas npx uses a temporary PATH. which apparently Windows doesn't like.

    Biggest downsides to this are it takes up local storage, and in order to use the latest version you need to manually update (compared to npx which uses the latest version every time and isn't installed on your local machine).

    That being said, supposedly there's been a fix to this in Cursor v0.48, but in order to access the latest version you have to enable your Early Access under the Beta Features and then Update to the latest version of Cursor.

    Hope this helps!

  4. jesse-lane-ai commented on Apr 6, 2025

    @jesse-lane-ai

    I confirm @ZylerKade your win10 method fixes this issue in Cline and Roo Code as well. I use windsurf regularly and it does not have this problem. I can use the json configs as is for the mcp servers and don't need to install globally.

  5. snahmetkaya commented on Apr 10, 2025

    @snahmetkaya

    How to Fix MCP Server "Error executing MCP tool: Not connected" Error

    Important Note: This guide provides steps to resolve the common "Not connected" error with Model Context Protocol (MCP) servers. The brave-search server is used in the examples below, but these steps and principles also apply to similar connection issues you might encounter with many other MCP servers. You may need to adapt the commands and configuration details based on the specific server you are having trouble with.

    1. Check MCP Server Configuration

    Open your MCP settings file. This file is usually located at:

    C:\Users\**<YOUR_USERNAME>**\AppData\Roaming\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
    (Replace <YOUR_USERNAME> with your actual Windows username.)

    Verify that the entry for the problematic MCP server matches the format of your other working servers or the correct format shown below.

    Especially on Windows systems, the "command" should typically be "cmd", and the "args" array should start with "/c", "npx", "-y", "package-name".

    Example Difference: Non-Working vs. Working Configuration (Windows)

    Below shows the difference between a common incorrect configuration and the corrected, working configuration for the brave-search server on Windows:

    Incorrect / Non-Working Example (Common Windows Issue):
    In this configuration, command is set directly to npx, and /c is missing from args.

    "github.com/modelcontextprotocol/servers/tree/main/src/brave-search": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-brave-search"
      ],
      "env": {
        "BRAVE_API_KEY": "YOUR_API_KEY"
      },
      "disabled": false,
      "autoApprove": []
    }

    Correct / Working Example (Fixed for Windows):
    In this configuration, command has been changed to "cmd", and "/c", "npx" have been added to the beginning of the args array.

    "github.com/modelcontextprotocol/servers/tree/main/src/brave-search": {
      "command": "cmd",  // Add
      "args": [
        "/c", // Add
        "npx", // Add
        "-y",
        "@modelcontextprotocol/server-brave-search"
      ],
      "env": {
        "BRAVE_API_KEY": "YOUR_API_KEY"
      },
      "disabled": false,
      "autoApprove": []
    }

    The Key Change: On Windows, running a Node.js package via npx often requires the cmd /c prefix to be executed correctly from within another process like VSCode's extension host. Therefore, "command": "npx" was replaced with "command": "cmd", and the actual npx command was moved into the "args" array, preceded by "/c". This fix allows Windows to interpret the command correctly and launch the server.

    2. Ensure API Keys and Environment Variables Are Set

    Make sure any required API keys (like BRAVE_API_KEY in the example above) are correctly added under the "env" section for the relevant server in the configuration file.

    Double-check for typos in key names or values. Missing or incorrect keys are a common cause of connection problems. (Ensure you replace "YOUR_API_KEY" in the working example with your actual, valid key).

    3. Save and Close the Settings File

    Save the changes you made to the cline_mcp_settings.json file.

    It's often recommended to close and reopen VSCode to ensure the changes take full effect.

    4. Restart the Claude Extension or VSCode

    MCP servers are usually started automatically by the Claude extension. However, if you're getting a "Not connected" error, the server might not have started correctly or might have crashed.

    The most reliable method is to completely close and restart VSCode to force all MCP servers and the extension to reload.

    Alternatively, you can try disabling and then re-enabling the Claude extension from the VSCode Extensions tab.

    5. Wait a Few Seconds

    After restarting VSCode or the extension, wait for 5-10 seconds to allow the MCP server time to initialize in the background.

    Then, try using your MCP tool (e.g., the Brave Search command) again.

    6. Check for Typos or Wrong Server Names

    When calling the MCP tool (e.g., in a chat prompt or via the command palette), ensure the server name (server_name) you use exactly matches the key in your cline_mcp_settings.json file (e.g., "github.com/modelcontextprotocol/servers/tree/main/src/brave-search").

    Even a minor typo or an extra character will cause a "Not connected" error.

    7. Verify Internet Connection

    Some MCP servers, like Brave Search, require an active internet connection to function.

    Make sure your internet connection is working and that no firewall or proxy settings are blocking outgoing connections from the server process (or the npx command).

    8. Update or Reinstall the MCP Server Package

    There might be an issue with the NPM package that runs the server. To check this, open a terminal (Command Prompt, PowerShell, or Terminal) and try running the package with the --help flag (e.g., for Brave Search):

    npx -y @modelcontextprotocol/server-brave-search --help

    If this command results in an error, hangs for a long time, or doesn't run at all, the package might be corrupted or there might have been an issue during download.

    You can try the following steps:

    • Clear the NPM cache: npm cache clean --force
    • Try manually updating the package to the latest version (if applicable).
    • If the problem persists, you might consider finding the cache directory where npx downloads packages (often a location like %LocalAppData%\npm-cache\_npx on Windows) and deleting the folder for the problematic package.

    9. Check for Errors in the VSCode Output Panel

    For more detailed error messages, check the VSCode Output panel:

    1. Go to View > Output in VSCode (or press Ctrl+Shift+U).
    2. Select the relevant channel from the dropdown menu, such as "Claude" or "Extension Host".
    3. Examine the output in the panel for any error messages related to MCP server startup (e.g., command not found, missing API key, connection errors, etc.). These messages can often help pinpoint the source of the problem.

    10. As a Last Resort: Remove and Re-add the MCP Server

    If none of the above steps work, try completely removing and then re-adding the problematic MCP server configuration as a last resort:

    1. Open the cline_mcp_settings.json file.
    2. Carefully delete the entire JSON block (including the key and value) for the server you're having trouble with.
    3. Save the file.
    4. Restart VSCode.
    5. After VSCode restarts, carefully re-add the server configuration to the file (e.g., using the Correct / Working Example format from Step 1). Ensure you enter the API keys and other settings correctly.
    6. Save the file again and restart VSCode one more time.
    7. Wait a few seconds after the restart, then test the server.
  6. xiao-yuhan commented on Apr 14, 2025

    @xiao-yuhan

    Thanks, it works

  7. cliffhall commented on Apr 19, 2025

    @cliffhall
    Member

    Deprecation Notice: Development for server-github has been moved to GitHub in the http://github.com/github/github-mcp-server repo. PRs to server-github in this repo are no longer being merged.

  8. foe919 commented on Apr 22, 2025

    @foe919

    The 3 adds are the key.

  9. EzioMercer commented on Feb 23, 2026

    @EzioMercer

    This works perfectly:

    The Key Change: On Windows, running a Node.js package via npx often requires the cmd /c prefix to be executed correctly from within another process like VSCode's extension host. Therefore, "command": "npx" was replaced with "command": "cmd", and the actual npx command was moved into the "args" array, preceded by "/c". This fix allows Windows to interpret the command correctly and launch the server.

    I also find another workaround. Instead of another layer of shell I wrote the absolute path to my npx:

    "mcpServers": {
        "chrome-devtools": {
          "command": "C:\\nvm4w\\nodejs\\npx.ps1",
          "args": ["-y", "chrome-devtools-mcp@latest"]
        }
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions