-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
What would you like to see?
Thank you for continuously implementing advanced features! I'm excited to see the new MCP client functionality in AnythingLLM.
I have tried out the new MCP server feature in AnythingLLM and wanted to share some observations.
Environment Variable Management
Currently, AnythingLLM may not support the env property in MCP server configurations.
The official MCP specification doesn’t include an env field, but tools like Claude Desktop and the VSCode extension allow us to declare environment variables directly in the JSON config for runtime use and within args.
As a result, users must pass environment variables as command-line arguments in args, and there’s no mechanism to inject them into the runtime environment itself.
In many MCP server repositories (e.g., mcp-servers), JSON examples leverage the env property extensively. By adding support for env in AnythingLLM, users could copy & paste existing MCP JSON configs without modification. It improves usability and adoption for MCP scenarios.
Thank you for considering this enhancement!
Appendix: Debug message at AnythingLLM Desktop
Case1: Try to use env property
{
"mcpServers": {
"github": {
"command": "C:\\Windows\\System32\\wsl.exe",
"args": [
"bash",
"-c",
"/usr/bin/docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server"
],
"anythingllm": {
"autoStart": true
},
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "MY_GITHUB_ACCESS_TOKEN"
}
}
}
}
Result: Failed (MCP error -32000: Connection closed)
[backend] info: [r] Attempting to start MCP server: github
time="2025-04-23T11:44:56Z" level=fatal msg="GITHUB_PERSONAL_ACCESS_TOKEN not set"
Case2: Embed environment variable to args
{
"mcpServers": {
"github": {
"command": "C:\\Windows\\System32\\wsl.exe",
"args": [
"bash",
"-c",
"/usr/bin/docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=MY_GITHUB_ACCESS_TOKEN ghcr.io/github/github-mcp-server"
],
"anythingllm": {
"autoStart": true
}
}
}
}
Result: Success
[backend] info: [r] Attempting to start MCP server: github
GitHub MCP Server running on stdio
[backend] info: [r] Successfully started 1 MCP servers: ["github"]