Hardcoding API keys into librechat.yaml unavoidable for (some) MCP servers? #6226
-
I had somewhat trouble setting up the Brave Search MCP server. Their API is free up to 2.000 requests / month so it seemed like a perfect tool to integrate. However the process proved troublesome since - no matter what I tried initially - things did not want to work. As I started troubleshooting, I realized that on startup docker was for some reason not correctly executing npx to start the Brave Search MCP server. Ultimately I used a completely different approach then with the already configured MCP server and went for this configuration:
I tried to set the API key in the .env file but that never worked. As an alternative I also tried putting the key in the docker override file and only reference the variable in librechat.yaml but that failed, too ... even when I launched the process via the shell like in this example. I think I can honestly say I tried every other approach that Claude 3.7 was suggesting and this was the only one working. It also works reliable though I wonder if this configuration could be improved up on. Overall I have the impression that MCP server run a bit unstable. Many times when starting the server via docker compose I noticed the mcp server Puppeteer shutting down shortly after the full webapp was running. Restarting 1-2 times usually resolved this issue. The issue stopped occuring after I removed a custom AI provider that was loading on startup but was not configured with a proper API key. Since then Puppeteer launches and runs without issues. It is amazing what already is supported and I understand that this is all cutting edge technology. So things probably not always work as intended and there will be bugs and issues. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This was recently added, and there are tests running/passing for this feature, so try it again on latest, with a reference to the environment variable as you did before: |
Beta Was this translation helpful? Give feedback.
-
Okay, I will once I update to latest and report if I could get it working. Thanks |
Beta Was this translation helpful? Give feedback.
This was recently added, and there are tests running/passing for this feature, so try it again on latest, with a reference to the environment variable as you did before:
BRAVE_API_KEY: "${BRAVE_API_KEY}"