这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG]: MCP backend ignores configured 'command' and executes wrong command (Docker, RPi5/ARM64) #3671

@LinusAurel

Description

@LinusAurel

How are you running AnythingLLM?

Docker (local)

What happened?

I am trying to add the Notion MCP server to AnythingLLM running via Docker on a Raspberry Pi 5 (ARM64 architecture), using the mintplexlabs/anythingllm:latest image. I configured it according to the Notion MCP documentation using the npx method in plugins/anythingllm_mcp_servers.json.

The AnythingLLM UI correctly reads the configuration and displays the intended startup command (e.g., Command: /usr/bin/npx, Arguments: -y @notionhq/notion-mcp-server).

Image

However, when attempting to start the MCP server (either automatically or manually via the UI), the backend fails to execute the configured command. The container logs (docker logs anythingllm) consistently show the backend attempting to run a command derived directly from the MCP key name, ignoring the specified command and args.

Specifically, for an MCP named notionApi, the logs show:

[backend] info: [MCPCompatibilityLayer] Attempting to start MCP server: notionApi
sh: 1: notion-mcp-server: not found
[backend] info: [MCPCompatibilityLayer] Failed to start MCP server: notionApi {"error":"MCP error -32000: Connection closed",...}

This happens even when the configuration explicitly defines command as /usr/bin/npx.

To confirm this, I renamed the MCP key in the configuration file to myNotionTool. The logs then showed:

[backend] info: [MCPCompatibilityLayer] Attempting to start MCP server: myNotionTool
sh: 1: notion-mcp-server: not found
[backend] info: [MCPCompatibilityLayer] Failed to start MCP server: myNotionTool {"error":"MCP error -32000: Connection closed",...}

This proves the backend correctly reads the MCP key (myNotionTool) but still ignores the configured command (/usr/bin/npx) and attempts to execute the wrongly derived command (notion-mcp-server).

This suggests a bug in the backend's MCP launcher component where the command and args fields from anythingllm_mcp_servers.json are not being used for process execution.

Are there known steps to reproduce?

  1. Run AnythingLLM using Docker Compose on an ARM64 system (e.g., Raspberry Pi 5) using the :latest tag.
    • Example docker-compose.yml:
      services:
        anythingllm:
          image: mintplexlabs/anythingllm:latest
          container_name: anythingllm
          ports:
            - "3001:3001"
          volumes:
            - /path/on/host/anythingllm/storage:/app/server/storage # Adjust path as needed
            - /path/on/host/anythingllm/storage/.env:/app/server/.env # Adjust path as needed
            - anythingllm_uploads:/app/server/uploads
            - anythingllm_hotdir:/app/client/hotdir
          environment:
            - STORAGE_DIR=/app/server/storage
            - UPLOAD_DIR=/app/server/uploads
            - VECTOR_DB=lancedb # Or your choice
            # Add other env vars as needed
          restart: unless-stopped
      volumes:
        anythingllm_uploads:
        anythingllm_hotdir:
  2. Configure an MCP server in /path/on/host/anythingllm/storage/plugins/anythingllm_mcp_servers.json using the npx method, ensuring the full path to npx (found via docker exec -it anythingllm which npx, likely /usr/bin/npx) is used for the command field.
    • Example anythingllm_mcp_servers.json:
      {
        "mcpServers": {
          "notionApi": {
            "command": "/usr/bin/npx",
            "args": ["-y", "@notionhq/notion-mcp-server"],
            "env": {
              "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer YOUR_NTN_TOKEN_HERE\", \"Notion-Version\": \"2022-06-28\" }"
            }
          }
        }
      }
  3. Ensure the container is fully restarted (docker compose down && docker compose up -d).
  4. Navigate to Agent Skills in the UI and attempt to start the configured MCP server (notionApi).
  5. Observe that the UI correctly displays the Startup Command as /usr/bin/npx ....
  6. Check the container logs (docker logs anythingllm).
  7. Expected: Logs should show an attempt to execute /usr/bin/npx -y @notionhq/notion-mcp-server.
  8. Actual: Logs show sh: 1: notion-mcp-server: not found followed by the Connection closed error.
  9. (Optional Confirmation): Rename the key from "notionApi" to "myNotionTool" in the JSON file, repeat steps 3-7. Observe the logs still show sh: 1: notion-mcp-server: not found when trying to start myNotionTool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    possible bugBug was reported but is not confirmed or is unable to be replicated.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions