MCP Compatibility
Overview
Model Context Protocol

Model Context Protocol (MCP) in AnythingLLM

AnythingLLM supports the all Model Context Protocol (MCP) tools (opens in a new tab) for use with AI Agents.

What is MCP?

MCP is an open-source protocol developed by Anthropic (opens in a new tab) to enable seamless integration between LLM applications and external data sources and tools.

There are many tools (opens in a new tab) that exist already built with MCP in mind and AnythingLLM can work with any of them.

The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.

How to use MCP in AnythingLLM

MCP Servers can be added to AnythingLLM by editing the anythingllm_mcp_servers.json configuration file in your AnythingLLM storage plugins directory.

The structure of the file is the same as the MCP Server Specification (opens in a new tab).

AnythingLLM will automatically detect the MCP Servers and attempt to boot them up as needed - you can also manage your servers directly in the AnythingLLM UI.

AnythingLLM MCP Configuration UI

Model Context Protocol

The MCP Management UI will show you all the MCP Servers that are available to use in AnythingLLM. You can also:

  • Reload/Restart all MCP Servers from the configuration file (if changes are made)
  • View the status of the MCP Servers found
  • View error logs from the MCP Servers
  • Stop or start the MCP Servers on the fly
  • View all available tools from the MCP Servers loaded successfully
  • Delete the MCP Servers (will remove the server from the configuration file)

Example configuration file

this file will be automatically generated in the proper directory if it doesn't exist before it is needed. It will be empty by default.

// anythingllm_mcp_servers.json
{
  "mcpServers": {
    "face-generator": {
      "command": "npx",
      "args": [
        "@dasheck0/face-generator"
      ],
      "env": { // optional, some MCP servers may require additional environment variables
        "MY_ENV_VAR": "my-env-var-value"
      }
    },
    "mcp-youtube": {
      "command": "uvx",
      "args": [
        "mcp-youtube"
      ],
    },
    "postgres-http": {
      "type": "streamable", // or "sse"
      "url": "http://localhost:3003",
      "headers": {
        "X-API-KEY": "api-key"
      }
    }
  }
}

Supported Transport Types

StdIO

The stdio transport type is the default and simplest transport type. It is a simple text-based protocol that is easy to implement and use. All MCP servers that use the stdio transport type require the command field to be set.

SSE & Streamable

The transport type is dependent on the MCP server implementation you are adding. So you should check the documentation for the MCP server you are adding to see what transport types is supported.

Keep in mind, that both sse and streamable require the url field to be set. It will not work with the command field set.

The SSE and Streamable transport types are alternative transport type that is supported by many MCP servers for streaming responses. In your configuration file, you can use the type field to specify the transport (sse or streamable). If not provided, sse is assumed.

The optional headers field can be used to send custom HTTP headers with requests to the MCP server.

Autostart prevention

This property is specific to AnythingLLM only and will have no effect on other tools.

Sometimes, you may want to optionally start an MCP server manually to prevent it from starting automatically and consuming resources.

To do this, AnythingLLM respects the anythingllm.autoStart property in the MCP Server configuration file.

For example, if you want to prevent the face-generator MCP Server from starting automatically, you can set the autoStart property to false in the configuration file.

Any tool that does not have autoStart: false explicitly set will be started automatically when the rest of the MCP servers are started. This is useful if you want to manually start an MCP server when you need it because of resource constraints.

{
  "mcpServers": {
    "face-generator": {
      "command": "npx",
      "args": [
        "@dasheck0/face-generator"
      ],
      "anythingllm": {
        "autoStart": false
      }
    },
    "mcp-youtube": {
      "command": "mcp-youtube",
      "args": []
    }
  }
}