Skip to main content
Glama
TimaxLacs

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: mcp-rag-bridge

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

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to query and manage a document knowledge base via MCP, with RAG-powered search and grounded answers with citations.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables LLM agents to query a structured knowledge library for search, explanations, related concepts, learning paths, examples, and cross-domain references via MCP.
    Apache 2.0
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables to build and query a knowledge base with retrieval-augmented generation, supporting document ingestion, hybrid search, and live data integration from external APIs via MCP tools.
    2
    -