MCP customUserVars broken when MCP server name has spaces/punctuation in it #8632
Replies: 2 comments 3 replies
-
@dustinhealy can you look into this? the only aspect about this being a potential bug is the tool not resolving with the unmodified name. the normalization is done as some providers will not support special characters in the function name. also @notfoundry if you’re in control of the MCP server, you can avoid this problem by renaming the function names. Certain LLM providers will throw an error when they’re used anyway. if using a public MCP server, please share so we can troubleshoot. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Closed by #8644 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
When creating a MCP tool, the LangChain tool name is computed as
`${toolName}${Constants.mcp_delimiter}${normalizeServerName(serverName)}`
. ThenormalizeServerName()
function strips out various special characters and replaces them with underscores; for example, a server in librechat.yaml named "Connector: Microsoft" would be normalized as "Connector__Microsoft". However, this seems to be the only place in Librechat that normalizes the MCP server name. The tools cache uses unmodified name, and insidegetUserMCPAuthMap()
, the server's name (used for looking up the saved credentials) is computed as${Constants.mcp_prefix}${serverName}
. Since the normalized server name for the tool was inconsistent with how it was stored, Librechat will never be able to find the credentials for those MCP servers, and tool calling with user-provided credentials will be broken.I'm assuming this is a real bug, since nowhere in the Librechat documentation does it say that having spaces in user-selectable MCP servers isn't permitted, and every other aspect of MCP tool calling works flawlessly. I found that making the following substitution in
getUserMCPAuthMap()
addressed the issue. I'm just leaving on vacation so don't have time to make a MR this second, but maybe it will be useful:Version Information
Commit 62c3f13
Steps to Reproduce
See description.
What browsers are you seeing the problem on?
No response
Relevant log output
N/A. No log output indicating an error exists. Substituting in credentials silently fails.
Screenshots
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions