AnythingLLM MCP Server

AnythingLLM MCP Server

Enables MCP-compatible clients to interact with AnythingLLM, providing tools for workspace management, chat and thread operations, document operations, vector search, and system inspection.

Category
访问服务器

README

AnythingLLM MCP Server

A Model Context Protocol (MCP) server that lets MCP-compatible clients (VS Code, Claude Desktop, Cursor, and others) interact with AnythingLLM. Available tools:

  • Workspace management
  • Chat and thread operations
  • Document operations and embeddings
  • Vector search
  • System and model inspection

Requirements

  • Python 3.10+ — verify: python --version or python3 --version. Download if not installed.
  • uv (Python package manager) — verify: uv --version. Install instructions.
  • AnythingLLM running and reachable — open http://localhost:3001 in a browser to confirm. If it runs in Docker, make sure the port is published (e.g., -p 3001:3001).
  • AnythingLLM API key — create one in the AnythingLLM web interface (look for API Keys or Developer API in Settings). Copy the key and store it securely; it is shown only once.

Installation

git clone https://github.com/andreperez/anythingllm-mcp.git
cd anythingllm-mcp
uv sync

uv sync reads pyproject.toml and installs all required dependencies into a local virtual environment. You do not need to create or activate the environment manually — uv run handles that automatically.

Configuration

The server reads configuration from these environment variables at startup:

  • ANYTHINGLLM_BASE_URL: Base URL of your AnythingLLM instance. Defaults to http://localhost:3001 if not set.
  • ANYTHINGLLM_API_KEY: API key for authenticating with AnythingLLM. This value is required.

The server does not load .env files by itself. You must either:

  • Set the variables in the shell before starting the server.
  • Use a tool that loads .env files for you.
  • Pass the variables directly in your MCP client configuration.

Option 1: Set variables in your current shell

PowerShell:

$env:ANYTHINGLLM_BASE_URL = "http://localhost:3001"
$env:ANYTHINGLLM_API_KEY = "your_api_key_here"

Bash:

export ANYTHINGLLM_BASE_URL="http://localhost:3001"
export ANYTHINGLLM_API_KEY="your_api_key_here"

Command Prompt (cmd.exe):

set ANYTHINGLLM_BASE_URL=http://localhost:3001
set ANYTHINGLLM_API_KEY=your_api_key_here

Use the host-exposed URL for your deployment. For Docker port mappings like 3002:3001, set ANYTHINGLLM_BASE_URL to http://localhost:3002 because the MCP server connects from the host, not from inside the container.

Option 2: Use a .env file with uv

Copy the example file:

PowerShell:

Copy-Item .env.example .env

Bash:

cp .env.example .env

Command Prompt (cmd.exe):

copy .env.example .env

Edit .env so it contains your real values:

ANYTHINGLLM_BASE_URL=http://localhost:3001
ANYTHINGLLM_API_KEY=replace_with_your_real_api_key

Then start the server with:

uv run --env-file .env anythingllm-mcp

This tells uv to load variables from .env before starting the server.

Option 3: Pass variables in your MCP client configuration

Most MCP clients accept an env block in their configuration file (see the Client setup examples below). When the env block contains ANYTHINGLLM_API_KEY and ANYTHINGLLM_BASE_URL, you do not need to export variables in the shell or use a .env file.

Client setup

Replace /path/to/anythingllm-mcp in the examples below with the absolute path where you cloned the repository. Examples:

  • Linux / macOS: /home/youruser/anythingllm-mcp
  • Windows: C:\\Users\\youruser\\anythingllm-mcp (use double backslashes \\ inside JSON strings)

VS Code

Add to your user or workspace mcp.json. Open the Command Palette (Ctrl+Shift+P on Windows/Linux, Cmd+Shift+P on macOS) and run MCP: Open User Configuration:

{
  "servers": {
    "anythingllm": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/anythingllm-mcp",
        "anythingllm-mcp"
      ],
      "env": {
        "ANYTHINGLLM_API_KEY": "${input:anythingllm_api_key}",
        "ANYTHINGLLM_BASE_URL": "http://localhost:3001"
      }
    }
  }
}

VS Code supports ${input:name} to prompt for the API key on each session.

In a multi-root workspace, prefer an absolute path for --directory if the MCP server lives outside the current folder root.

If VS Code shows only a partial tool list after you update the server or switch from another AnythingLLM integration to this local one:

  1. Run MCP: List Servers and confirm anythingllm or your chosen server name starts successfully.
  2. Run MCP: Reset Cached Tools to clear stale tool metadata.
  3. Restart the MCP server from MCP: List Servers.

Claude Desktop

Edit claude_desktop_config.json (Settings → Developer → Edit Config):

{
  "mcpServers": {
    "anythingllm": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/anythingllm-mcp",
        "anythingllm-mcp"
      ],
      "env": {
        "ANYTHINGLLM_API_KEY": "YOUR_API_KEY",
        "ANYTHINGLLM_BASE_URL": "http://localhost:3001"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project root, or to the global config at ~/.cursor/mcp.json (Linux/macOS) / %USERPROFILE%\.cursor\mcp.json (Windows):

{
  "mcpServers": {
    "anythingllm": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/anythingllm-mcp",
        "anythingllm-mcp"
      ],
      "env": {
        "ANYTHINGLLM_API_KEY": "YOUR_API_KEY",
        "ANYTHINGLLM_BASE_URL": "http://localhost:3001"
      }
    }
  }
}

Note: ANYTHINGLLM_BASE_URL defaults to http://localhost:3001, which is the application port inside the container. If you publish Docker as 3002:3001, use http://localhost:3002 in client configuration.

Run (standalone)

If you already exported the variables in your shell:

uv run anythingllm-mcp

If you want to load them from .env at launch time:

uv run --env-file .env anythingllm-mcp

Development

Install test dependencies and run the test suite:

uv sync --extra dev
uv run pytest

Troubleshooting

"API key is missing" or 401 Unauthorized

The server could not authenticate with AnythingLLM. Check that:

  1. ANYTHINGLLM_API_KEY is set in your environment or in the env block of your MCP client configuration.
  2. The key matches an active key in AnythingLLM (Settings → API Keys).
  3. The key has no leading or trailing whitespace.

"Connection refused" or timeout

The server could not reach AnythingLLM. Check that:

  1. AnythingLLM is running (open http://localhost:3001 in a browser).
  2. ANYTHINGLLM_BASE_URL points to the correct host and port.
  3. No firewall or VPN is blocking the connection.

Docker port mismatch

If AnythingLLM runs in Docker with a port mapping like 3002:3001:

  • Inside the container, the application listens on port 3001.
  • On the host, you access it on port 3002.

Because the MCP server runs on the host (not inside the container), set:

ANYTHINGLLM_BASE_URL=http://localhost:3002

Always use the host port (the left side of the -p or ports: mapping).

MCP server running inside a container (Dev Containers, Docker Compose)

If the MCP server itself runs inside a container (for example, a VS Code Dev Container), localhost refers to that container's own network — not to the host machine. To reach AnythingLLM running on the host or in another container with a published port, use host.docker.internal:

ANYTHINGLLM_BASE_URL=http://host.docker.internal:3001

If both the MCP server and AnythingLLM are containers on the same Docker network (for example, in the same docker-compose.yml), use the service name as hostname instead:

# "anythingllm" is the service name defined in docker-compose.yml
ANYTHINGLLM_BASE_URL=http://anythingllm:3001

In this case, use the container port (3001), not the host-published port.

host.docker.internal is supported on Docker Desktop (Windows and macOS) and on Docker Engine 20.10+ for Linux (requires --add-host=host.docker.internal:host-gateway or the equivalent extra_hosts in Compose).

Security notes

  • Never commit real API keys.
  • Use environment variables for secrets.
  • Use least-privileged AnythingLLM API tokens when possible.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选