---
title: "MCP Compatibility in AnythingLLM"
description: "Use existing MCP Servers with AnythingLLM Agents"
---

import { Cards, Callout } from "nextra/components";
import Image from "next/image";
import { Card } from "../../components/card";

<Image
  src="/images/mcp-compatibility/mcp.png"
  height={140}
  width={846}
  quality={100}
  alt="Model Context Protocol"
  style={{
    borderRadius: "12px",
    margin: "10px auto",
  }}
/>

# Model Context Protocol (MCP) in AnythingLLM

AnythingLLM supports the all [Model Context Protocol (MCP) tools](https://github.com/modelcontextprotocol/modelcontextprotocol) for use with [AI Agents](/agent/overview).

## What is MCP?

MCP is an open-source protocol developed by [Anthropic](https://www.anthropic.com/) to enable seamless integration between LLM applications and external data sources and tools.

There are [many tools](https://github.com/modelcontextprotocol/servers) 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

<Cards style={{
  display: "flex",
  flexDirection: "row",
}}>
  <Card title="AnythingLLM Docker" href="/mcp-compatibility/docker">
    <Image
      src="/images/mcp-compatibility/docker-header.png"
      height={1080}
      width={1920}
      quality={100}
    />
  </Card>
  <Card title="AnythingLLM Desktop" href="/mcp-compatibility/desktop">
    <Image
      src="/images/mcp-compatibility/desktop-header.png"
      height={1080}
      width={1920}
      quality={100}
    />
  </Card>
</Cards>


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](https://github.com/modelcontextprotocol/servers?tab=readme-ov-file#using-an-mcp-client).

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

<Image
  src="/images/mcp-compatibility/user-interface.png"
  height={140}
  width={846}
  quality={100}
  alt="Model Context Protocol"
  style={{
    borderRadius: "12px",
    margin: "10px auto",
  }}
/>

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._

```json5
// 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

<Callout type="info">
  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.
</Callout>

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.

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