mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2026-07-19 14:13:35 -04:00
[GH-ISSUE #4017] [BUG]: Have to launch from command-line for MCP server connections to not fail #2551
Closed
opened 2026-02-22 18:30:10 -05:00 by yindo
·
23 comments
No Branch/Tag Specified
master
5846-bug-when-scrolling-up-scrolling-jumps
refactor-remove-workspace-pfp
5969-bug-stopgenerationbutton-disappears-on-the-first-prompt-that-initiates-an-agent-session
2235-bug-how-to-upload-a-folder-with-subfolders-with-files-to-anythingllm
5990-workspace-update-fails-with-unknown-argument-router_id-v1130v1150-intel-mac
opencomputer-examples
pg
feat/image-generation-translations
feat/image-generation
5924-bug-meeting-summary-fails-with-sincludes-is-not-a-function-when-default-llm-is-anthropic-claude
render
feat/uniform-modal-component
5883-bug-unescaped-content-in-json-strings-being-passed-to-document-generator-tools
5901-bug-api-update-embeddings-fails-prisma-argument-filename-is-missing-on-workspace_documentscreate-desktop-windows-v1141
hybrid-search
1981-translations
5752-bug-prompts-to-local-jan-endpoint-unresponsive
feat-disable-native-tool-calling-env-var
5676-bug-non-ollama-agent-providers-do-not-parse-and-present-reasoning-content
feat/markdown-web-scraping
5717-bug-apiv1documentupload-silently-drops-metadata-field-in-desktop-1130-arg-count-mismatch-nested-payload-key
fix/aibitat-context-overflow
5711-bug-erratic-deepseek-v4-flash-the-agent-model-failed-to-respond-400-the-reasoning_content
5631-feat-custom-api-request-timeouts-for-ai-providers
feat-reasoning-control
feat-agent-clarifying-questions-translations
5583-bug-lm-studio-provider-does-not-present-reasoning-output
5313-normalize-translations
feat/memory-translations
5305-lemonade-embedding-engine-swallows-errors-falsely-reports-documents-as-embedded
5060-bug-agent-interactions-agent-are-not-persisted-to-thread-history-via-api
pptx-subagent
feat-render-images-from-mcp-tool-results
stt-provider-expansion-openai-api-compatible
feat-file-search-agent-tool
feat-native-embedder-job-queue
5189-normalize-translations
feat-file-search-agent-tool-translations
i18n-eslint
5140-auto-migration
5112-bug-openrouter-failed-message-bug
3506-feat-parameters-for-openrouter-models
4992-feat-preserve-scroll-position
4973-bug-markdown-numbered-list-display-in-reasoning-pane
desktop
4938-bug-pending-chat-rerendering-ui-bug
quickstart-env
node-llama-cpp-in-container-cuda
node-llama-cpp-in-container
ollama-in-container
4817-feat-set-cooldown-per-mcp-server
4845-keyboard-shortcuts-to-navigate-in-chat
4844-feat-reorder-threads-by-latest-interaction
standardize-username-constraints-normalize-translations
4792-feat-refactor-workspacepfp-image
1382-embed-ip-improvements
1382-bug-embed-api-improvements
refactor-eslint-frontend
4687-feat-refactor-vector-db-providers
4615-feat-disable-apidocs-with-environment-variable
4559-feat-agent-web-search-enable-ordering-of-results
4599-bug-ollama-race-condition-bug
4572-bug-lmstudio-provided-llm-stopped-working-with-anything-llm-after-upgrading-to-190
4508-agent-youtube-transcript-analysis
4497-feat-workspace-names
frontend-eslint
ollama-lmstudio-auto-context-window
4431-validate-vector-database-connectioN
2019-slash-command-keyboard-selection
microsoft-foundry-provider
4431-validate-vector-database-connection
4325-sys-prompt-var-improvements
3209-feat-apiv1workspacestream-chat-sources-citations
4210-bug-voice-to-text-overwrite
4136-feat-jan-as-a-backend-server-option
4172-feat-openai-o3-support
1.8.3-rerelease
web-push-notifications-service
tasks
3955-feat-jinaai-embedder-provider-support
3921-feat-agent-skills-uiux-improvements
3901-bug-validfunccall-checks-optional-arguments
keyboard-dev
1787-custom-roles-and-permissions
add-jira-slack-data-connector
office-extension-wip
lightmode-dropdown-color-update
3586-bug-agent-flow-function-description-provided-by-user-is-not-seen-in-the-llm-query
3463-bug-agent-continues-to-run-if-request-failed-even-after-exit
3439-feat-call-variables-within-the-flow-api-block-url-field
3282-manager-view-models-workspace
3280-token-counting-server-side-truncation-improvements
3147-bug-embedded-chat-widget---not-considering-query-mode-option-always-working-in-chat-mode
2995-feat-disable-temperature-setting-for-deepseek-r1-deepseek-reasoner-model
2827-feat-perplexity-citations
2866-feat-finally-a-gemini-models-endpoint
2647-feat-hpp-header-for-a-c++-code-file-mime-addition
lancedb-revert
1656-feat-implement-tooltip-ui-designs
2011-feat-bump-perplexity-models
1873-feat-auto-add-and-watch-folder-for-document-uploads
1297-feat-gemini-agent-support
1759-bug-ui-bug-fixes
1686-feat-implement-winston-for-logging
1536-bug-toggling-on-users-can-delete-workspaces-does-not-take-effect
agent-ui-mobile-styles
1522-feat-chromadb-support
1595-bug-unable-to-get-live-web-search-and-browsing-agent-working-using-google-custom-search-engine-error-getaddrinfo-enotfound-http-errno-3008
1582-bug-lm-studio-does-not-allow-for-different-model-selection
1312-bug-usernames-should-not-be-case-sensitive-when-logging-in
1029-feat-hf-serverless-inference-api
1086-feat-implement-normalized-input-fields
knowledge-graph-support
644-bug-uploaded-file-name-does-not-match-the-displayed-file-name-after-the-upload
v1.15.0
v1.14.2
v1.14.1
v1.14.0
v1.13.0
v1.12.1
v1.12.0
v1.11.2
v1.11.1
v1.11.0
v1.10.0
v1.9.1
v1.9.0
v1.8.5
v1.8.4
v1.8.3
v1.8.2
v1.8.1
v1.8.0
v1.7.8
v1.7.6
v1.7.5
v1.7.4
v1.4.0
v1.3.0
v1.2.4
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.1.1
v1.1.0
v1.0.0
Labels
Clear labels
Desktop
Docker
Integration Request
Integration Request
OS: Linux
OS: Mobile
OS: Windows
UI/UX
blocked
bug
bug
core-team-only
documentation
duplicate
embed-widget
enhancement
feature request
github_actions
good first issue
investigating
needs info / can't replicate
possible bug
pull-request
question
stage: specifications
wontfix
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Mintplex-Labs/anything-llm#2551
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @inspiredearth on GitHub (Jun 17, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4017
Originally assigned to: @timothycarambat on GitHub.
It's great that AnythingLLM now supports MCP servers. This opens up a world of possibilities. Thank you. However, I'm having a hard time getting it to work as expected.
How are you running AnythingLLM?
AnythingLLM desktop app
What happened?
My installation of AnythingLLM (v1.8.2) for macOS (v15.5) can only connect to MCP servers (both local and remote) if I launch AnythingLLM it from the command-line.
I don't have this issue with Claude desktop app and BoltAI app, using the same servers.
It suggests to me that there's something particular about AnythingLLM that is resulting in it having an incomplete Node/npx environment when launched as an app.
Front-end Errors are:
Failed to start MCP server: desktop-commander [-32000] MCP error -32000: Connection closedFailed to start MCP server: monday-api-mcp-hosted [-32000] MCP error -32000: Connection closedetc.
Related logs:
Please advise if there is some way to make AnythingLLM connect to MCP servers without to launch AnythingLLM via command line (i.e. when it is launched from the Desktop GUI)
Are there known steps to reproduce?
No response
@CesareIsHere commented on GitHub (Jun 24, 2025):
I have the same problem
@timothycarambat commented on GitHub (Jun 24, 2025):
This almost certainly has to do with ENV inheritance. What does your config for MCP look like. It is either the ENV or the execution permissions of the MCP command not being allow - the error message MCP gives back does not help that much with debugging.
Considering
spawn /private/var/folders/f5/xj8j7h19193_32dbgh9sfwgr0000gn/T/AppTranslocation/is trying to spawn form likely a userspace protected folder that is my current hunch.@vitaliiivanovspryker commented on GitHub (Jul 12, 2025):
The same issue
Applied configurations work fine for Claude and other MCP agents, but do not work for AnythingLLM
tested with various MCP servers both public and developed
@kingmohbil commented on GitHub (Jul 15, 2025):
I'm having the same issue as well with multiple mcp servers, using python and npm
@expose commented on GitHub (Jul 16, 2025):
I'm having the same issue with docker installed and working. Anything LLM just don't recognize this server. This one:
on the other hand works.
@abderrahmanskiredj commented on GitHub (Jul 20, 2025):
Same issue
@enmanuelmag commented on GitHub (Jul 22, 2025):
Same issue even with a local MCP (stdio)
@inspiredearth commented on GitHub (Jul 22, 2025):
Thanks @timothycarambat . Since posting my Issue report, I've been busy with other projects, and I've not had time to look into this since then. But I wanted to acknowledge your response and suggestions. I will try this out as soon as I am able.
In the mean time, it appears other have encountering what might be the same issue. Perhaps they also have
envissues in their MCP config?@enmanuelmag commented on GitHub (Jul 23, 2025):
I just tried with "empty" MCP server STDIO and still facing same error
Update: Only fails on MacOS, Windows works fine
@setuk commented on GitHub (Aug 1, 2025):
Same problem here. Stops me from using your product. Want to connect to Notion and Jira.
@jmvalente commented on GitHub (Aug 15, 2025):
I believe the problem is here
https://github.com/Mintplex-Labs/anything-llm/blob/b44cf21caac5bf086d7a6ed41ee87907c7629a8b/server/utils/MCP/hypervisor/index.js#L239
I have npm installed via homebrew, with homebrew's path in my zsh profile.
I'll have this issue launching from bash as well since the path isn't set.
I'm not too familiar with node but
/opt/homebrew/lib/node_modulesis the NODE_PATH where npm is installed via homebrew.@zuicis commented on GitHub (Oct 2, 2025):
Version 1.8.5 r2. : Failed to start MCP server: sequentialthinking [-32000] MCP error -32000. MCP servers works normaly from claude desktop and postman!
@timothycarambat commented on GitHub (Oct 2, 2025):
@zuicis The
dockeralias is probably not available in the subshell we use, which is why it would work via manual execution where the alias is available.If you
where dockerand use that for the command it should work.@zuicis commented on GitHub (Oct 3, 2025):
Hi, I understood your point, but the issue persists.
It looks like now, when the PATH is set and I use "docker", or when I use the "full path to docker.exe", then anythingllm also finds Docker Desktop but connection to Docker is not being kept open. At the moment when I restart the MCP servers (using anythingllm’s restart option), the containers appear briefly and then immediately disappear also.
I’ll test a few more options and wait for the next version :) Have a productive day!
@timothycarambat commented on GitHub (Oct 3, 2025):
Seems like docker might be starting these containers with
-rm. Can you copy/paste that mcp_config (omit credentials if present). I think #4299 will fix this@Ackerka commented on GitHub (Oct 24, 2025):
I'm using Anything LLM Desktop version under MacOS. First of all it seems the value of the command key within the definition of an MCP server within the ~/Library/Application Support/anythingllm-desktop/storage/plugins/anythingllm_mcp_servers.json file MUST be an absolute path. The same that is returned by the "which" command in a command prompt.
E.g. if which uv returns /Users/myusername/.local/bin/uv then /Users/myusername/.local/bin/uv has to be the value of the command key instead of uv.
Once the configuration file has been updated and the MCP servers refreshed (Settings/Agent Skills/MCP Servers/Refresh) it should show it as "On" and if you click on it then the offered tools are also displayed.
In a lucky case the MCP Server can really be used by the LLM.
Unfortunately there are cases in which the MCP Server is also using some commands or special packages that are also inaccessible in the environment provided by AnythingLLM at MCP Server call. Currently I do not know the solution for such a case. I encountered it with mcp-pandoc that uses pypandoc for document conversion and works fine with LM Studio but not with Anything LLM. How can we influence the environment the MCP Server sees?
Probably a podman or docker container encapsulation of the MCP Server together with the tools it uses solves the problem but I have not tested that, yet.
@Sinkingdev commented on GitHub (Oct 24, 2025):
Confirming what @timothycarambat and @jmvalente already suspected: this is an ENV inheritance issue on macOS. Launching from Finder/Spotlight breaks MCP servers, but launching from terminal with
open -a "AnythingLLM"works reliably.Environment
What I tested
[-32000] Connection closed.Why
process.envis empty. On macOS, that’s exactly what happens when launched from Finder./opt/homebrew/binor/opt/homebrew/lib/node_modules.Workarounds
anythingllm_mcp_servers.jsonSome users reported absolute paths helped, but in my case (and others) it didn’t solve the issue, which suggests the problem is broader than just PATH resolution?launchctl setenv PATH "..."at login could, in theory, fix Finder launches by injecting a PATH into the GUI session. But even with a sanitized PATH (system + toolchain dirs only), this feels like a blunt workaround rather than a proper solution. I haven’t tested it and would appreciate input from others on whether it’s safe practice.Suggestion
MCP on Desktop - It took me a long time to figure this much out.
process.env.Would love confirmation from someone more seasoned - is the launchctl approach safe, or is there a better way to inject the user’s PATH into Finder‑launched apps? A proper patch would be ideal, but I don’t have the skill to attempt it myself.
@timothycarambat commented on GitHub (Oct 24, 2025):
@Sinkingdev This is the best and most helpful GitHub comment I have seen in a while. We will properly patch this - easiest fix is likely doing something simple like what fix-path does on Mac/Linux..
Using
launchctlwould likely work as well but I would rather not. The safer option is run from terminal. If we do the path fix it will work for macOS, which is particularly the OS with this issue.@Sinkingdev commented on GitHub (Oct 25, 2025):
@timothycarambat Oh wow. Thanks for the feedback. This is mostly new territory for me, so your input is really valuable. Glad I could help move things forward!
@Ackerka commented on GitHub (Oct 25, 2025):
Unfortunately the workaround @Sinkingdev suggested to start Anything LLM from terminal by the 'open -a "AnythingLLM"' command did not work for me with the mcp-pandoc MCP Server. Anything LLM displayed the following response message when the LM Studio hosted LLM (openai/gpt-oss-120b) tried to use the tool:
"I’m sorry, but I can’t complete the conversion at the moment because the tool that turns Markdown into an ODT document (pandoc) isn’t available on this system."
In fact Pandoc is installed and mcp-pandoc works fine with LM Studio 0.3.30.
I believe that the workaround suggested by @Sinkingdev may solve the command finding problem to start the MCP Server but the MCP Servers themselves still do not find third party libraries (e.g. the installed pypandoc in my case) because something is missing from the environment in which Anything LLM starts the MCP Server.
I still believe that a podman or docker container encapsulation of the MCP Server together with the tools it uses solves the problem but I still have not tested that, because I'm new to container image creation and did not have the time for the deep dive.
@jmvalente commented on GitHub (Oct 25, 2025):
I would also consider adding a text field for the
PATHvariable in the application settings and making that the highest priority (then process env, then fall back) when loading. Alternatively a “long text” field for multiple lines if more than just the path needs to be setThis also avoids having to check for variations in shells (
.bashrc .bash_profile, .zshrc, etc) when loading the shell env and provides a way to set the path and other vars specifically for anythingllm.@Ackerka commented on GitHub (Oct 25, 2025):
Although it seems to be a flexible solution I'm not sure if it simplifies the life of the users or solves all problems.
What could be the difference between the way how LM Studio or VS Code extensions like Kilocode invoke MCP Servers vs Anything LLM?
If the same method could be followed then there would be no need of platform/environment specific tweaks on user level.
(Edit: Yes, the same mcp-pandoc MCP Server works fine under Kilocode as well without setting PATH or other environment variables, just the standard MCP configuration JSON block was added to the config. Fortunately Kilocode is open source, so it is possible to compare the way how they launch/provide environment to MCP Servers: https://github.com/Kilo-Org/kilocode/tree/main/src/services/mcp )
@Sinkingdev commented on GitHub (Dec 7, 2025):
You are not telling us how you are activating the mcp server?
This tells me you are not using agent to activate the mcp server.
To use MCP servers like pandoc, you need to explicitly activate the agent.
Instead of just asking the LLM directly in chat, you need to activate it in your chat.
@agent use mcp pandoc [your request here]This tells AnythingLLM to:
MCP servers don't run continuously, they start on-demand when you call the agent, which saves tokens and resources.
[BUG]: Have to launch from command-line for MCP server connections to not failto [GH-ISSUE #4017] [BUG]: Have to launch from command-line for MCP server connections to not fail