Skip to main content
Glama
lightrag-mcp

lightrag-mcp

by TimaxLacs

lightrag-mcp

MCP server that connects LightRAG to any MCP client — Cursor, Claude Desktop, and others. Gives the agent access to a persistent knowledge base: notes, decisions, documentation, runbooks.

Two tools, because knowledge retrieval has two different scenarios:

Tool

What it does

When you need it

search_lightrag

Returns a ready answer with source links

A regular question to the knowledge base

get_lightrag_context

Returns only context and sources, without generating an answer

When you need to assemble the answer yourself: cross-check with code, combine with the current conversation

Both tools are marked as readOnlyHint, so the client will not treat them as state-changing.

Installation

npm install

Requires Node.js 18 or newer — the built-in fetch is used.

Related MCP server: kb-mcp-server

Configuration

Create .env next to package.json:

LIGHTRAG_URL=http://localhost:9621
LIGHTRAG_API_KEY=ваш-ключ

LIGHTRAG_URL is optional and defaults to http://localhost:9621. LIGHTRAG_API_KEY is required: without it the server fails at startup with a clear error, not at the first request.

The path to the environment file can be overridden with the LIGHTRAG_MCP_ENV_FILE variable — convenient when the client launches the server from a different working directory.

Connecting to Cursor

In ~/.cursor/mcp.json:

{
  "mcpServers": {
    "lightrag": {
      "command": "node",
      "args": ["/абсолютный/путь/lightrag-mcp/src/server.js"],
      "env": {
        "LIGHTRAG_MCP_ENV_FILE": "/абсолютный/путь/lightrag-mcp/.env"
      }
    }
  }
}

Search modes

The mode parameter accepts mix (default), hybrid, local, global, and naive. An unknown mode is rejected before the network request. Requests always go out with source links and reranking enabled.

Tests

npm test

Tests use the built-in node --test, with no external dependencies. HTTP is mocked via the fetchImpl parameter, so both successful responses and errors are covered: missing key, empty question, unknown mode, unsuccessful response status.

License

MIT

Maintenance

ActivityStale
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers