Skip to content

MCP Server

@flowrag/mcp exposes your FlowRAG knowledge base to AI assistants via the Model Context Protocol.

Installation

bash
npm install -g @flowrag/mcp

Or run directly:

bash
npx @flowrag/mcp --data ./data --docs ./content

Configuration

Create flowrag.config.json in your project root:

json
{
  "data": "./data",
  "docs": "./content",
  "schema": {
    "entityTypes": ["SERVICE", "DATABASE", "PROTOCOL"],
    "relationTypes": ["USES", "PRODUCES", "CONSUMES"]
  },
  "embedder": { "provider": "local" },
  "extractor": { "provider": "gemini" }
}

API keys go in a .env file (auto-loaded on startup):

bash
GEMINI_API_KEY=your-key-here

CLI Flags

FlagDescriptionDefault
--config <path>Config file path./flowrag.config.json
--data <path>Data directory./data
--docs <path>Documents directory

Priority: CLI flags > config file > defaults. For the simplest case, no config file is needed:

bash
npx @flowrag/mcp --data ./data --docs ./content

Provider Defaults

ProviderEmbedder ModelExtractor Model
localXenova/e5-small-v2— (not available)
geminigemini-embedding-001gemini-3-flash-preview
bedrockamazon.titan-embed-text-v2:0anthropic.claude-haiku-4-5-20251001-v1:0

TIP

local has no extractor — pair it with gemini or bedrock for entity extraction.

AI Assistant Setup

Claude Desktop

Add to your Claude Desktop config (claude_desktop_config.json):

json
{
  "mcpServers": {
    "flowrag": {
      "command": "npx",
      "args": ["@flowrag/mcp", "--config", "/path/to/flowrag.config.json"]
    }
  }
}

Kiro

Add to your project's mcp.json:

json
{
  "mcpServers": {
    "flowrag": {
      "command": "npx",
      "args": ["@flowrag/mcp", "--config", "/path/to/flowrag.config.json"]
    }
  }
}

Tools

The MCP server exposes 8 tools that AI assistants can call:

flowrag_index

Index documents into the knowledge base.

ParameterTypeDescription
forceboolean?Re-index all documents, ignore hashes

Uses the docs path from config. Unchanged documents are skipped automatically via SHA-256 hashing.

Search with dual retrieval (vector + graph).

ParameterTypeDescription
querystringSearch query (required)
modestring?hybrid, local, global, naive (default: hybrid)
limitnumber?Max results (default: 5)

flowrag_search_entities

Semantic search for entities in the knowledge graph by description similarity.

ParameterTypeDescription
querystringSearch query (required)
limitnumber?Max results (default: 10)
typestring?Filter by entity type

Unlike flowrag_entities (which does exact/substring matching), this tool uses vector similarity to find entities by meaning. For example, "the service that handles login" can find an entity named "Auth Service".

flowrag_entities

List or filter entities in the knowledge graph.

ParameterTypeDescription
typestring?Filter by entity type (e.g. SERVICE)
querystring?Filter by name/description substring
limitnumber?Max results (default: 20)

flowrag_relations

Get relations for a specific entity.

ParameterTypeDescription
entitystringEntity name (required)
directionstring?in, out, both (default: both)

flowrag_trace

Trace data flow upstream or downstream from an entity.

ParameterTypeDescription
entitystringEntity name (required)
directionstringupstream or downstream (required)

flowrag_path

Find the shortest path between two entities.

ParameterTypeDescription
fromstringSource entity name (required)
tostringTarget entity name (required)
maxDepthnumber?Max traversal depth (default: 5)

flowrag_stats

Get index statistics. No parameters.

Returns document, chunk, entity, relation, and vector counts.

Resources

flowrag://schema

Exposes the current schema definition as JSON, so the AI assistant knows what entity types, relation types, and custom fields are available.

Config Change Detection

After indexing, a flowrag.meta.json file is saved in the data directory with embedder, extractor, and schema info.

On startup, the server compares the current config with this metadata:

ChangeSeverityEffect
Embedder changedBreakingEmbeddings are incompatible — re-index required
Schema changedMinorNew types apply on next indexing
Extractor changedMinorNew extractions may differ

Entity Resolution

Tools that accept entity names (flowrag_relations, flowrag_trace, flowrag_path) resolve names using:

  1. Exact match (entity ID)
  2. Case-insensitive match
  3. Substring match
  4. Error if no match found

This means you can type auth and it will find AuthService.

Remote / HTTP Mode

The MCP server can also run as a centralized HTTP server for team use:

json
{
  "transport": "http",
  "port": 3000,
  "auth": { "token": "${FLOWRAG_AUTH_TOKEN}" },
  "storage": {
    "kv": { "provider": "redis", "url": "redis://redis.internal:6379" },
    "vector": { "provider": "opensearch", "node": "https://os:9200", "dimensions": 1024 },
    "graph": { "provider": "opensearch", "node": "https://os:9200" }
  }
}

Clients connect via URL instead of spawning a local process:

json
{
  "mcpServers": {
    "flowrag": {
      "url": "https://flowrag.company.com/mcp",
      "headers": { "Authorization": "Bearer ${FLOWRAG_TOKEN}" }
    }
  }
}

See Remote MCP Server for full deployment guide including Docker and Fargate.

Released under the MIT License.