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

ConnectionError from generated sample #90

Closed
skylarbpayne opened this issue Nov 27, 2024 · 9 comments · Fixed by #91
Closed

ConnectionError from generated sample #90

skylarbpayne opened this issue Nov 27, 2024 · 9 comments · Fixed by #91
Labels
bug Something isn't working

Comments

@skylarbpayne
Copy link

Describe the bug

I cannot successfully connect with the MCP Inspector. It was working at one point, but suddenly stopped. Even with a fresh example generated via uvx create-mcp-server.

To Reproduce

Caveat: I am not sure what exactly is causing the broken state; so I'm not sure these are all the steps.

Steps to reproduce the behavior:

  1. uvx create-mcp-server --path example_mcp
  2. cd example_mcp && uv sync --dev --all-extras
  3. npx @modelcontextprotocol/inspector uv --directory /Users/skylarbpayne/projects/example_mcp run example-mcp
  4. Open Inspector and click > Connect button

Expected behavior
I expect the connection to occur successfully

Logs
From the console:

:3000/sse?transportType=stdio&command=uv&args=--directory+%2FUsers%2Fskylarbpayne%2Fprojects%2Fmotion_server+run+motion-server&env=%7B%7D:1 
        
        
       GET http://localhost:3000/sse?transportType=stdio&command=uv&args=--directory+%2FUsers%2Fskylarbpayne%2Fprojects%2Fmotion_server+run+motion-server&env=%7B%7D net::ERR_CONNECTION_REFUSED

Additional context
At some point it was working, and I was iterating on a server. Then I noticed that something (I think a node library?) updated, and since then it has not worked. I tried restarting my computer, uninstalling all global node packages and starting over.

I also remember there being some logs that would occur after the output of the link to the locally running Inspector when it was working (possibly something that was starting the mcp server?). Now I do not see anything (as if it's not actually starting the server?)

@skylarbpayne skylarbpayne added the bug Something isn't working label Nov 27, 2024
@ashwin-ant
Copy link
Member

Possibly a dupe of #83.

@skylarbpayne just out of curiosity, if you start the inspector with npx @modelcontextprotocol/inspector@0.2.2, does the issue still occur?

@ashwin-ant
Copy link
Member

Or alternatively, if you run with DEBUG="*" npx @modelcontextprotocol/inspector, you should get detailed output. Try running that and then hitting Ctrl-C after you reach the error you're seeing, and you should get some additional info.

@skylarbpayne
Copy link
Author

Running with the version pinned to 0.2.2 works!
When running with the DEBUG flag, I don't see an error:

(node:38953) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Starting MCP inspector...
  spawn-rx spawning process: /opt/homebrew/bin/node /Users/skylarbpayne/.npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js,--env,uv,--args,--directory /Users/skylarbpayne/projects/example_mcp run example-mcp, {"env":{"SPACESHIP_VERSION":"4.16.0","TERM_PROGRAM":"iTerm.app","NODE":"/opt/homebrew/Cellar/node/23.3.0/bin/node","INIT_CWD":"/Users/skylarbpayne","TERM":"xterm-256color","SHELL":"/bin/zsh","HOMEBREW_REPOSITORY":"/opt/homebrew","TMPDIR":"/var/folders/2g/kv1wcncs1rj5tsr4tvqb1pgc0000gn/T/","npm_config_global_prefix":"/opt/homebrew","TERM_PROGRAM_VERSION":"3.5.10","COLOR":"1","TERM_SESSION_ID":"w0t0p0:FD126098-8C9D-46B5-A685-BDDF98236300","npm_config_noproxy":"","npm_config_local_prefix":"/Users/skylarbpayne","ZSH":"/Users/skylarbpayne/.oh-my-zsh","USER":"skylarbpayne","LS_COLORS":"di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43","COMMAND_MODE":"unix2003","npm_config_globalconfig":"/opt/homebrew/etc/npmrc","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.AJC7cFWprd/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","npm_execpath":"/opt/homebrew/lib/node_modules/npm/bin/npm-cli.js","TERM_FEATURES":"T3LrMSc7UUw9Ts3BFGsSyHNoSxF","PAGER":"less","LSCOLORS":"Gxfxcxdxbxegedabagacad","TERMINFO_DIRS":"/Applications/iTerm.app/Contents/Resources/terminfo:/usr/share/terminfo","PATH":"/Users/skylarbpayne/.npm/_npx/5a9d879542beca3a/node_modules/.bin:/Users/skylarbpayne/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/skylarbpayne/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/TeX/texbin:/Applications/iTerm.app/Contents/Resources/utilities","npm_package_json":"/Users/skylarbpayne/package.json","_":"/Users/skylarbpayne/.npm/_npx/5a9d879542beca3a/node_modules/.bin/mcp-inspector","npm_config_userconfig":"/Users/skylarbpayne/.npmrc","npm_config_init_module":"/Users/skylarbpayne/.npm-init.js","__CFBundleIdentifier":"com.googlecode.iterm2","npm_command":"exec","PWD":"/Users/skylarbpayne","npm_lifecycle_event":"npx","EDITOR":"vi","LANG":"en_US.UTF-8","ITERM_INJECT_SHELL_INTEGRATION":"1","ITERM_PROFILE":"Default","npm_config_npm_version":"10.9.0","XPC_FLAGS":"0x0","npm_config_node_gyp":"/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js","RBENV_SHELL":"zsh","SPACESHIP_ROOT":"/Users/skylarbpayne/.oh-my-zsh/custom/themes/spaceship-prompt","XPC_SERVICE_NAME":"0","SHLVL":"2","HOME":"/Users/skylarbpayne","COLORFGBG":"15;0","LC_TERMINAL_VERSION":"3.5.10","HOMEBREW_PREFIX":"/opt/homebrew","ITERM_SESSION_ID":"w0t0p0:FD126098-8C9D-46B5-A685-BDDF98236300","npm_config_cache":"/Users/skylarbpayne/.npm","LESS":"-R","LOGNAME":"skylarbpayne","npm_lifecycle_script":"mcp-inspector","npm_config_user_agent":"npm/10.9.0 node/v23.3.0 darwin arm64 workspaces/false","INFOPATH":"/opt/homebrew/share/info:","HOMEBREW_CELLAR":"/opt/homebrew/Cellar","LC_TERMINAL":"iTerm2","DEBUG":"*","npm_node_execpath":"/opt/homebrew/Cellar/node/23.3.0/bin/node","npm_config_prefix":"/opt/homebrew","COLORTERM":"truecolor","PORT":"3000"},"signal":{}} +0ms
  spawn-rx spawning process: /opt/homebrew/bin/node /Users/skylarbpayne/.npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/client/bin/cli.js, {"env":{"SPACESHIP_VERSION":"4.16.0","TERM_PROGRAM":"iTerm.app","NODE":"/opt/homebrew/Cellar/node/23.3.0/bin/node","INIT_CWD":"/Users/skylarbpayne","TERM":"xterm-256color","SHELL":"/bin/zsh","HOMEBREW_REPOSITORY":"/opt/homebrew","TMPDIR":"/var/folders/2g/kv1wcncs1rj5tsr4tvqb1pgc0000gn/T/","npm_config_global_prefix":"/opt/homebrew","TERM_PROGRAM_VERSION":"3.5.10","COLOR":"1","TERM_SESSION_ID":"w0t0p0:FD126098-8C9D-46B5-A685-BDDF98236300","npm_config_noproxy":"","npm_config_local_prefix":"/Users/skylarbpayne","ZSH":"/Users/skylarbpayne/.oh-my-zsh","USER":"skylarbpayne","LS_COLORS":"di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43","COMMAND_MODE":"unix2003","npm_config_globalconfig":"/opt/homebrew/etc/npmrc","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.AJC7cFWprd/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","npm_execpath":"/opt/homebrew/lib/node_modules/npm/bin/npm-cli.js","TERM_FEATURES":"T3LrMSc7UUw9Ts3BFGsSyHNoSxF","PAGER":"less","LSCOLORS":"Gxfxcxdxbxegedabagacad","TERMINFO_DIRS":"/Applications/iTerm.app/Contents/Resources/terminfo:/usr/share/terminfo","PATH":"/Users/skylarbpayne/.npm/_npx/5a9d879542beca3a/node_modules/.bin:/Users/skylarbpayne/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/skylarbpayne/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/TeX/texbin:/Applications/iTerm.app/Contents/Resources/utilities","npm_package_json":"/Users/skylarbpayne/package.json","_":"/Users/skylarbpayne/.npm/_npx/5a9d879542beca3a/node_modules/.bin/mcp-inspector","npm_config_userconfig":"/Users/skylarbpayne/.npmrc","npm_config_init_module":"/Users/skylarbpayne/.npm-init.js","__CFBundleIdentifier":"com.googlecode.iterm2","npm_command":"exec","PWD":"/Users/skylarbpayne","npm_lifecycle_event":"npx","EDITOR":"vi","LANG":"en_US.UTF-8","ITERM_INJECT_SHELL_INTEGRATION":"1","ITERM_PROFILE":"Default","npm_config_npm_version":"10.9.0","XPC_FLAGS":"0x0","npm_config_node_gyp":"/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js","RBENV_SHELL":"zsh","SPACESHIP_ROOT":"/Users/skylarbpayne/.oh-my-zsh/custom/themes/spaceship-prompt","XPC_SERVICE_NAME":"0","SHLVL":"2","HOME":"/Users/skylarbpayne","COLORFGBG":"15;0","LC_TERMINAL_VERSION":"3.5.10","HOMEBREW_PREFIX":"/opt/homebrew","ITERM_SESSION_ID":"w0t0p0:FD126098-8C9D-46B5-A685-BDDF98236300","npm_config_cache":"/Users/skylarbpayne/.npm","LESS":"-R","LOGNAME":"skylarbpayne","npm_lifecycle_script":"mcp-inspector","npm_config_user_agent":"npm/10.9.0 node/v23.3.0 darwin arm64 workspaces/false","INFOPATH":"/opt/homebrew/share/info:","HOMEBREW_CELLAR":"/opt/homebrew/Cellar","LC_TERMINAL":"iTerm2","DEBUG":"*","npm_node_execpath":"/opt/homebrew/Cellar/node/23.3.0/bin/node","npm_config_prefix":"/opt/homebrew","COLORTERM":"truecolor","PORT":"5173"},"signal":{}} +2ms

🔍 MCP Inspector is up and running at http://localhost:5173 🚀

@ashwin-ant
Copy link
Member

ashwin-ant commented Nov 27, 2024

Having trouble repro-ing even with your steps unfortunately. I'll keep trying some things. In the meantime, can you try running against the latest version (0.2.6)? It has some additional changes around the startup logic.

@darinkishore
Copy link

Possibly a dupe of #83.

@skylarbpayne just out of curiosity, if you start the inspector with npx @modelcontextprotocol/inspector@0.2.2, does the issue still occur?

Also have it working on 0.2.2 when @latest (0.2.6) wouldn't work for me.

logs:

0.2.2

❯ npx @modelcontextprotocol/inspector@0.2.2 uv --directory /Users/darin/shit/research_mcp run research-mcp
Need to install the following packages:
@modelcontextprotocol/inspector@0.2.2
Ok to proceed? (y) y

Starting MCP inspector...

🔍 MCP Inspector is up and running at http://localhost:5173 🚀
[server] New SSE connection
[server] Query parameters: {
[server]   transportType: 'stdio',
[server]   command: 'uv',
[server]   args: '--directory /Users/darin/shit/research_mcp run research-mcp',
[server]   env: '{"HOME":"/Users/darin","LOGNAME":"darin","PATH":"/Users/darin/.npm/_npx/fd1eb2c85672aa8b/node_modules/.bin:/Users/darin/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/darin/.local/share/mise/installs/node/22.9.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/darin/.bun/bin:/Users/darin/Library/pnpm:/Users/darin/.local/share/mise/installs/python/3.11/bin:/Users/darin/.local/share/mise/installs/node/latest/bin:/Users/darin/.local/share/mise/installs/watchexec/latest/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/darin/.deno/bin:/Users/darin/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/darin/Library/Application Support/edgedb/bin:/Users/darin/.npm-packages:/opt/local/sbin:/opt/local/bin:/Users/darin/.local/bin:/Users/darin/.pyenv/bin:/bin:/Users/darin/go/bin:/Users/darin/.cargo/bin:/usr/local/bin:/opt/homebrew/opt/fzf/bin:/Users/darin/.rye/shims:/System/Cryptexes/App/usr/bin:/usr/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/darin/Applications/iTerm.app/Contents/Resources/utilities:/Users/darin/.cache/lm-studio/bin","SHELL":"/opt/homebrew/bin/fish","TERM":"xterm-new","USER":"darin"}'
[server] }
[server] Stdio transport: command=uv, args=--directory,/Users/darin/shit/research_mcp,run,research-mcp, env={"HOME":"/Users/darin","LOGNAME":"darin","PATH":"/Users/darin/.npm/_npx/fd1eb2c85672aa8b/node_modules/.bin:/Users/darin/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/darin/.local/share/mise/installs/node/22.9.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/darin/.bun/bin:/Users/darin/Library/pnpm:/Users/darin/.local/share/mise/installs/python/3.11/bin:/Users/darin/.local/share/mise/installs/node/latest/bin:/Users/darin/.local/share/mise/installs/watchexec/latest/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/darin/.deno/bin:/Users/darin/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/darin/Library/Application Support/edgedb/bin:/Users/darin/.npm-packages:/opt/local/sbin:/opt/local/bin:/Users/darin/.local/bin:/Users/darin/.pyenv/bin:/bin:/Users/darin/go/bin:/Users/darin/.cargo/bin:/usr/local/bin:/opt/homebrew/opt/fzf/bin:/Users/darin/.rye/shims:/System/Cryptexes/App/usr/bin:/usr/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/darin/Applications/iTerm.app/Contents/Resources/utilities:/Users/darin/.cache/lm-studio/bin","SHELL":"/opt/homebrew/bin/fish","TERM":"xterm-new","USER":"darin"}
[server] Spawned stdio transport
[server] Connected MCP client to backing server transport
[server] Created web app transport
[server] Created web app transport
[server] Set up MCP proxy
[server] Received message for sessionId 149d544f-8c21-48f2-b0a3-85afb0a7541c
[server] Received message for sessionId 149d544f-8c21-48f2-b0a3-85afb0a7541c
^C[client] PORT= node /Users/darin/.npm/_npx/fd1eb2c85672aa8b/node_modules/@modelcontextprotocol/inspector/client/bin/cli.js exited with code SIGINT
--> Sending SIGTERM to other processes..
[server] PORT= node /Users/darin/.npm/_npx/fd1eb2c85672aa8b/node_modules/@modelcontextprotocol/inspector/server/build/index.js --env uv --args="--directory /Users/darin/shit/research_mcp run research-mcp" exited with code SIGINT

0.2.6:


❯ npx @modelcontextprotocol/inspector@latest uv --directory /Users/darin/shit/research_mcp run research-mcp
Starting MCP inspector...
node:internal/util/parse_args/parse_args:87
    throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(errorMessage);
          ^

TypeError [ERR_PARSE_ARGS_INVALID_OPTION_VALUE]: Option '--args' argument is ambiguous.
Did you forget to specify the option argument for '--args'?
To specify an option argument starting with a dash use '--args=-XYZ'.
    at checkOptionLikeValue (node:internal/util/parse_args/parse_args:87:11)
    at node:internal/util/parse_args/parse_args:382:9
    at Array.forEach (<anonymous>)
    at parseArgs (node:internal/util/parse_args/parse_args:378:3)
    at file:///Users/darin/.npm/_npx/9eac9498388ae25e/node_modules/@modelcontextprotocol/inspector/server/build/index.js:14:20
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:483:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
  code: 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE'
}

Node.js v22.9.0

🔍 MCP Inspector is up and running at http://localhost:5173 🚀

on 0.2.6, all i get is connection failed on the frontend. no logs in console.

@ashwin-ant
Copy link
Member

@darinkishore super helpful logs, thanks! One thing to try on 0.2.6: Try running just npx @modelcontextprotocol/inspector@latest and then manually put in uv as the command and -directory /Users/darin/shit/research_mcp run research-mcp as the arguments in the UI.

@ashwin-ant ashwin-ant mentioned this issue Nov 28, 2024
9 tasks
@skylarbpayne
Copy link
Author

Yes, I got the same thing as Darin when I tried 0.2.6.

When I try running npx @modelcontextprotocol/inspector@0.2.6 it worked.
But somehow the args were actually already there... No idea where it got them from 👀

@ashwin-ant
Copy link
Member

But somehow the args were actually already there... No idea where it got them from 👀

The previous command/args that you used are stored in localStorage and used if you don't provide new ones 😄

@skylarbpayne @darinkishore we just released 0.2.7, which should address the issue. Thanks for the report, and please feel free to reopen this issue if the problem persists!

@skylarbpayne
Copy link
Author

Confirming it works! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants