Title: Fix ENOENT error when installing MCP server with `mcp install server.py` · Issue #478 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Fix ENOENT error when installing MCP server with `mcp install server.py` · Issue #478 · modelcontextprotocol/python-sdk
X Title: Fix ENOENT error when installing MCP server with `mcp install server.py` · Issue #478 · modelcontextprotocol/python-sdk
Description: Describe the bug When using mcp install server.py to install a Model Context Protocol server in Claude Desktop, the installation appears successful but fails at runtime with "spawn uv ENOENT" errors. This happens because the MCP SDK hard...
Open Graph Description: Describe the bug When using mcp install server.py to install a Model Context Protocol server in Claude Desktop, the installation appears successful but fails at runtime with "spawn uv ENOENT" error...
X Description: Describe the bug When using mcp install server.py to install a Model Context Protocol server in Claude Desktop, the installation appears successful but fails at runtime with "spawn uv ENOENT&q...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/478
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fix ENOENT error when installing MCP server with `mcp install server.py`","articleBody":"**Describe the bug**\nWhen using `mcp install server.py` to install a Model Context Protocol server in Claude Desktop, the installation appears successful but fails at runtime with \"spawn uv ENOENT\" errors. This happens because the MCP SDK hardcodes \"uv\" as the command without using the full path, and Claude Desktop can't find the executable when launched.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. Install the [MCP demo server](https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#quickstart) with `uv run mcp install server.py`: \n```zsh\n➜ mcp-server-demo git:(main) ✗ uv run mcp install server.py\n[04/10/25 17:07:31] INFO Added server 'Demo' to Claude config claude.py:129\n INFO Successfully installed Demo in Claude app cli.py:467\n➜ mcp-server-demo git:(main) ✗\n```\n2. Open Claude Desktop\n3. Observe three error notifications pop up: \n - \"MCP Demo: spawn uv ENOENT 2\"\n - \"Could not connect to MCP server Demo\"\n - \"MCP Demo: Server disconnected. For troubleshooting guidance, please visit our debugging documentation\"\n\n**Expected behavior**\nThe MCP server should start properly when Claude Desktop launches, without any ENOENT errors. The SDK should use the full path to the `uv` executable rather than assuming it's in the PATH.\n\n**Screenshots**\nN/A\n\n**Desktop (please complete the following information):**\n- OS: macOS Sonoma 14.5\n- Claude Desktop: 0.9.2\n- modelcontextprotocol/python-sdk: 1.6.0\n\n**Smartphone (please complete the following information):**\nN/A\n\n**Additional context**\n\n**Log Output**\n\nThe following is present in `mcp-server-Demo.log`:\n```\n\u003csnip-server-pre-initialization-logs>\n2025-04-10T14:46:54.177Z [Demo] [info] Initializing server...\n2025-04-10T14:46:54.204Z [Demo] [error] spawn uv ENOENT {\"context\":\"connection\",\"stack\":\"Error: spawn uv ENOENT\\n at ChildProcess._handle.onexit (node:internal/child_process:285:19)\\n at onErrorNT (node:internal/child_process:483:16)\\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\"}\n2025-04-10T14:46:54.204Z [Demo] [error] spawn uv ENOENT {\"stack\":\"Error: spawn uv ENOENT\\n at ChildProcess._handle.onexit (node:internal/child_process:285:19)\\n at onErrorNT (node:internal/child_process:483:16)\\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\"}\n\u003csnip-server-disconnect-logs>\n```\n\n**Root Cause Analysis**\n\nThe `mcp install server.py` command configures the `Demo` server's `command` in `claude_desktop_config.json` to be \"uv\":\n```json\n \"Demo\": {\n \"command\": \"uv\",\n \"args\": [\n \"run\",\n \"--with\",\n \"mcp[cli]\",\n \"mcp\",\n \"run\",\n \"\u003cfull-path-to-server-py-file>\"\n ]\n }\n```\n\nSpawn emits the ENOENT error because 'uv' doesn't exist in the directories defined in PATH when Claude Desktop runs.\n\nThe Model Context Protocol [server quickstart docs](https://modelcontextprotocol.io/quickstart/server) warn about this: \"You may need to put the full path to the `uv` executable in the `command` field. You can get this by running `which uv` on MacOS/Linux or `where uv` on Windows.\"\n\n**Verification**\nChanging the `command` from \"uv\" to the full path to the uv executable fixes the errors:\n```json\n \"Demo\": {\n \"command\": \"\u003cfull-path-to-uv-executable>\",\n \"args\": [\n \"run\",\n \"--with\",\n \"mcp[cli]\",\n \"mcp\",\n \"run\",\n \"\u003cfull-path-to-server-py-file>\"\n ]\n }\n```\n\n**Code Issue**\nCurrently, \"command\" is hardcoded to be \"uv\": https://github.com/modelcontextprotocol/python-sdk/blob/c4beb3e8eff4869b4eb063d3a5f257bdf67dd62f/src/mcp/cli/claude.py#L120 \n\n**Proposed Solution**\nCreate a function that returns the full path to the uv executable:\n```python\nimport os\nimport subprocess\nimport platform\n\ndef find_uv_path() -> str | None:\n \"\"\"Find the full path to the 'uv' executable across platforms\"\"\"\n \n system = platform.system()\n \n if system == \"Windows\":\n try:\n result = subprocess.run([\"where\", \"uv\"], capture_output=True, text=True, check=True)\n paths = result.stdout.strip().split('\\n')\n return paths[0] if paths else None\n except subprocess.CalledProcessError:\n return None\n else:\n try:\n result = subprocess.run([\"which\", \"uv\"], capture_output=True, text=True, check=True)\n return result.stdout.strip()\n except subprocess.CalledProcessError:\n return None\n```\n\nWhich could then be used in `src/mcp/cli/claude.py` like so:\n```python\ndef update_claude_config(\u003csnip>) -> bool:\n \u003csnip>\n \n uv_path = find_uv_path()\n if uv_path:\n server_config: dict[str, Any] = {\"command\": uv_path, \"args\": args}\n else: \n server_config: dict[str, Any] = {\"command\": \"uv\", \"args\": args}\n \n \u003csnip>\n```","author":{"url":"https://github.com/rossheat","@type":"Person","name":"rossheat"},"datePublished":"2025-04-10T16:14:28Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/478"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ce57810a-86da-7cab-f8c8-bf9f8633d731 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8286:21AC3F:E98E0:13252D:6B00BA49 |
| html-safe-nonce | 2523781ff51515fa5014b74b3bc73e9c3892a611976e69ad109ee8f36f8a74da |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Mjg2OjIxQUMzRjpFOThFMDoxMzI1MkQ6NkIwMEJBNDkiLCJ2aXNpdG9yX2lkIjoiODM2OTE1MTU4MDkwMDk5NzcwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 15a9e07b98a689b9d0b9cfcefc305647306ac537e56f4b5f13c16665e1f1ae08 |
| hovercard-subject-tag | issue:2986198213 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/478/issue_layout |
| twitter:image | https://opengraph.githubassets.com/63f6dc727f24efdecbbc6cfabb23bf0ccb76dbea366b6fe4ae048af91e1cbee6/modelcontextprotocol/python-sdk/issues/478 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/63f6dc727f24efdecbbc6cfabb23bf0ccb76dbea366b6fe4ae048af91e1cbee6/modelcontextprotocol/python-sdk/issues/478 |
| og:image:alt | Describe the bug When using mcp install server.py to install a Model Context Protocol server in Claude Desktop, the installation appears successful but fails at runtime with "spawn uv ENOENT" error... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rossheat |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1d07c25977adfc5ff6acb0a962a9bc168c07afbda6fef765f9761c350c2ae4a2 |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5429cbfc6aca8c7b9a086a3c8f47400346f38cc9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width