Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Claude App] "Could not attach to MCP server github" #42

Closed
Lymdun opened this issue Nov 25, 2024 · 13 comments
Closed

[Claude App] "Could not attach to MCP server github" #42

Lymdun opened this issue Nov 25, 2024 · 13 comments

Comments

@Lymdun
Copy link

Lymdun commented Nov 25, 2024

Heya,

Currently trying to set up MCP server github on my Claude app without success - I always get a notification saying "Could not attach to MCP server github". Note that I can see my config on Settings > Developer.

mcp.logs

2024-11-25T21:27:47.135Z [info] Attempting to connect to MCP server github...
2024-11-25T21:27:47.152Z [info] Connected to MCP server github!

image

image

Latest version of Claude App
OS: Windows 11

@jspahrsummers
Copy link
Member

Are you able to get GitHub working with the MCP Inspector? That might help narrow down whether this is an issue in the desktop app or the server configuration.

@Lymdun
Copy link
Author

Lymdun commented Nov 25, 2024

Are you able to get GitHub working with the MCP Inspector? That might help narrow down whether this is an issue in the desktop app or the server configuration.

Unfortunaly can't get MCP Inspector to work either 😅

🔍 MCP Inspector is up and running at http://localhost:5173 🚀
[server] 'PORT' n'est pas reconnu en tant que commande interne
[server] ou externe, un programme ex�cutable ou un fichier de commandes.
[server] PORT= node C:\Users\Lymdun\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\@modelcontextprotocol\inspector\server\build\index.js --env npx --args="@modelcontextprotocol/server-github GITHUB_PERSONAL_ACCESS_TOKEN=ghp_rXXXXXX" exited with code 1```

@Lymdun
Copy link
Author

Lymdun commented Nov 25, 2024

Nevermind, been able to launch it - will open an issue later in Inspector repo, could be easier to launch it from Windows (in my case, had to launch both client & server by myself using npm-cache)

image

And the error when trying to connect:

Error in /sse route: Error: spawn npx ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn npx',
  path: 'npx',
  spawnargs: [ '-y', '@modelcontextprotocol/server-github' ]
}

@sean-lynch
Copy link
Contributor

sean-lynch commented Nov 25, 2024

That looks like one of the issues I was seeing here: #37

Can you try replacing the command npx with the output of running which npx in your terminal? (ie provide the absolute path to npx)

@Lymdun
Copy link
Author

Lymdun commented Nov 25, 2024

You're right, got this on my powershell (using "C:\Program Files\nodejs\npx.cmd"):

Spawned stdio transport
Connected MCP client to backing server transport
Created web app transport
Created web app transport
Set up MCP proxy
Received message for sessionId c451b6c5-5e25-4291-b09a-76f1578607d5

Error output from MCP Server:

npm ERR! code ENOENT
npm
ERR!
syscall lstat
npm ERR! path C:\Users\Lymdun\${APPDATA}
npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Lymdun\${APPDATA}' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: C:\Users\Lymdun\npm-cache\_logs\2024-11-25T22_36_56_428Z-debug-0.log

@Lymdun
Copy link
Author

Lymdun commented Nov 25, 2024

Fixed by adding APPDATA varenv in inspector, now I can receive messages & use tools without issue.
Unfortunately Claude App stille have the same issue even with a fixed npx command

Note: mcp-server-github.log is empty

@Lymdun
Copy link
Author

Lymdun commented Nov 25, 2024

Just seen this log from npm-cache while toying with Claude App, looks like it is the culprit:

39 http fetch GET 200 https://registry.npmjs.org/@modelcontextprotocol%2fserver-github 1242ms (cache revalidated)
40 timing arborist:ctor Completed in 0ms
41 timing command:exec Completed in 1259ms
42 verbose stack Error: ENOENT: no such file or directory, lstat 'C:\Users\Lymdun\AppData\Local\AnthropicClaude\app-0.7.1\${APPDATA}'
42 verbose stack     at async lstat (node:internal/fs/promises:1014:18)
42 verbose stack     at async #loadActual (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\load-actual.js:114:20)
42 verbose stack     at async exec (C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:193:26)
42 verbose stack     at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli-entry.js:61:5)
43 verbose cwd C:\Users\Lymdun\AppData\Local\AnthropicClaude\app-0.7.1
44 verbose Windows_NT 10.0.22631
45 verbose node v21.6.2
46 verbose npm  v10.2.4

@jspahrsummers
Copy link
Member

Error output from MCP Server:

npm ERR! code ENOENT
npm
ERR!
syscall lstat
npm ERR! path C:\Users\Lymdun\${APPDATA}
npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Lymdun\${APPDATA}' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: C:\Users\Lymdun\npm-cache\_logs\2024-11-25T22_36_56_428Z-debug-0.log

Did this come after making changes to the server's code, by chance? I'm a bit confused about how the path in this log is being built, or what's logging ENOENT error messages here.

@zhaolongzhong
Copy link

zhaolongzhong commented Nov 26, 2024

fwiw, it's likely related to how to spawn npx or the environment. "mcp-server-sqlite" which uses uvx works for me on windows. I tried github and puppeteer, both them using npx, it looks good on Settings -> Developer and also good in mcp.log which shows they are connected, but after like half or one minute, both them gets error in desktop.

There might be some improvement here,

  • the logs show they are connected but actually not, currently it's info level log, it's better to reflect the reality for better feedback
  • inspector seems not work on windows, as inspector also uses npx
  • when adding a new server, it seems the user needs to restart windows

Note: everything works perfect for me on macos

@Lymdun
Copy link
Author

Lymdun commented Nov 26, 2024

Error output from MCP Server:

npm ERR! code ENOENT
npm
ERR!
syscall lstat
npm ERR! path C:\Users\Lymdun\${APPDATA}
npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, ls

Did this come after making changes to the server's code, by chance? I'm a bit confused about how the path in this log is being built, or what's logging ENOENT error messages here.

No, I was using the stock inspector the whole time along with the stock github-server from npm registry

@GidianB
Copy link

GidianB commented Nov 26, 2024

Im getting the same issue on my Windows machine with both brave-search and filesystem.
image
Im using nvm for windows if that might be of any importance.

@SimonB97
Copy link
Contributor

Getting this error too for filesystem, github and memory servers

@jspahrsummers
Copy link
Member

Sorry folks, we believe there's an issue with Claude Desktop launching MCP servers with npx on Windows. Working on a fix now!

I think this is the same root cause as #40, so merging with that issue.

@jspahrsummers jspahrsummers closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants