Directory Indexer logo

Directory Indexer

Community
peteretelej

MCP Server for indexing your local directories into a knowledgebase for your AI Assistants.

Publisherpeteretelej
Repositorydirectory-indexer
LanguageTypeScript
Forks
5
Stars
17
Available tools
6
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    Directory Indexer exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 6 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    17 stars and 5 forks from the linked repository.

Directory Indexer

Turn your directories into an AI-powered knowledge base.

npm codecov License: MIT CI

Self-hosted semantic search for local files. Give your AI assistant access to search, read, and work with your local files and directories. Ask about topics, patterns, or examples and get meaningful results from your actual knowledge base.

Quick Start

Prerequisites:

  • Docker - For running Qdrant and Ollama (skip if you already have them running natively)
  • Node.js 18+ - Required for running directory-indexer (the v1.x line targets Node 18 LTS compatibility)

Note: For native Qdrant and Ollama installation without Docker, see Setup section.

1. Start Qdrant vector database (skip if already running)

bash
docker run -d --name qdrant -p 127.0.0.1:6333:6333 -v qdrant_storage:/qdrant/storage qdrant/qdrant

2. Start Ollama embedding service (skip if already running)

Note: Docker Ollama won't use GPU acceleration. For better performance, consider native installation.

bash
docker run -d --name ollama -p 127.0.0.1:11434:11434 -v ollama:/root/.ollama ollama/ollama

# Pull the embedding model
docker exec ollama ollama pull nomic-embed-text

Note: Make sure the embedding model is pulled before you start indexing.

You can confirm that Ollama and Qdrant are running by checking:

bash
# qdrant endpoint
curl http://localhost:6333/

# confirm what ollama models are available
curl http://localhost:11434/api/tags

3. Index your directories

bash
npx directory-indexer@latest index ./WorkNotes ./Projects

4. Configure AI assistant (Claude Desktop, Cursor, Cline, Roo Code, Zed etc.)

Add to your MCP configuration:

json
{
  "mcpServers": {
    "directory-indexer": {
      "command": "npx",
      "args": ["directory-indexer@latest", "serve"]
    }
  }
}

If you experience issues on windows adding this MCP. You can install the package globally using

npm install -g directory-indexer@latest

Then use the following MCP configuration

{
  "mcpServers": {
    "directory-indexer": {
      "command": "directory-indexer",
      "args": [ "serve" ]
    }
  }
}

Your AI assistant will automatically start the MCP server and can now search your indexed files.

Advanced: For organizing content into focused search areas, see Workspace Support. For faster indexing, see Performance Tips.

Setup

Directory Indexer runs locally on your machine or server. It uses an embedding provider (such as Ollama) to create vector embeddings of your files and stores them in a Qdrant vector database for fast semantic search. Both services can run remotely if needed.

Setup requires two services:

1. Qdrant Vector Database

Choose one option:

Docker (recommended for most users):

bash
docker run -d --name qdrant \
    -p 127.0.0.1:6333:6333 \
    -v qdrant_storage:/qdrant/storage \
    qdrant/qdrant
  • This option requires Docker
  • Runs Qdrant on docker container, uses a named volume qdrant_storage for persistent storage.

Alternative: Install natively from qdrant.tech

2. Embedding Provider

Choose one option:

Option A: Ollama (recommended - free, runs locally)

bash
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh  # Linux/macOS
# For Windows: Download from https://ollama.ai

# Pull the embedding model
ollama pull nomic-embed-text

Option B: OpenAI (requires paid API key)

bash
export OPENAI_API_KEY="your-api-key-here"

Quick Verification

Test your setup:

bash
# Check Qdrant Health
curl http://localhost:6333/healthz

# View collections
curl http://localhost:6333/collections

# Check Ollama
curl http://localhost:11434/api/tags

If either fails, directory-indexer will show a helpful error with setup guidance.

Usage

MCP Integration

Configure with AI assistants (Claude Desktop, Cline, etc.) using npx:

json
{
  "mcpServers": {
    "directory-indexer": {
      "command": "npx",
      "args": ["directory-indexer@latest", "serve"]
    }
  }
}

Index your directories:

bash
# Index your directories first
npx directory-indexer@latest index /home/user/projects/docs /home/user/work/reports

How it works:

  1. MCP server starts automatically - When your AI assistant connects, it launches the MCP server in the background
  2. Indexing runs independently - You can index files before, during, or after MCP setup
  3. Search immediately available - Your AI assistant can search files as soon as they're indexed

Key point: You don't need to wait for indexing to complete before using the MCP server. Index files as needed, and your AI assistant will immediately have access to search them.

Using with AI Assistant

Once configured, your AI assistant can search your indexed documents semantically:

Search by concept:

  • "Find API authentication examples"
  • "Show me error handling patterns"
  • "Find configuration for Redis"

Find similar content:

  • "Show me incidents similar to this outage report" (when you have an incident file open)
  • "Find documentation like this API guide" (when viewing an API doc)
  • "What files are similar to my deployment script?"

Troubleshoot issues:

  • "Find troubleshooting guides on SQL deadlocks"
  • "Show me solutions for timeout errors"
  • "Find debugging tips for performance issues"

Custom Configuration

Configure with custom endpoints and data directory:

json
{
  "mcpServers": {
    "directory-indexer": {
      "command": "npx",
      "args": ["directory-indexer@latest", "serve"],
      "env": {
        "DIRECTORY_INDEXER_DATA_DIR": "/opt/ai-knowledge-base",
        "QDRANT_ENDPOINT": "http://localhost:6333",
        "OLLAMA_ENDPOINT": "http://localhost:11434"
      }
    }
  }
}

Workspace Support

Organize content into workspaces for focused searches:

json
{
  "mcpServers": {
    "directory-indexer": {
      "command": "npx",
      "args": ["directory-indexer@latest", "serve"],
      "env": {
        "WORKSPACE_CUSTOMER_CASES": "C:\\Users\\john\\Documents\\Support\\Cases,C:\\Users\\john\\Documents\\Incidents",
        "WORKSPACE_ENGINEERING_DOCS": "C:\\Users\\john\\Code\\API,C:\\Users\\john\\Code\\Web",
        "WORKSPACE_COMPANY_POLICIES": "C:\\Users\\john\\Documents\\Policies,C:\\Users\\john\\Documents\\Procedures"
      }
    }
  }
}

How workspaces work:

  • Define workspace environments with WORKSPACE_NAME format
  • Use comma-separated paths or JSON arrays: ["path1", "path2"]
  • Search within specific workspaces: "Find issues about authentication in customer cases workspace"
  • Your AI assistant can filter results to relevant workspace content
  • Use server_info to see available workspaces and their statistics

CLI Usage

For advanced users who prefer command-line usage, see CLI Documentation.

Configuration

Environment variables (all optional):

bash
# Data directory (default: ~/.directory-indexer)
export DIRECTORY_INDEXER_DATA_DIR="/opt/ai-knowledge-base"

# Service endpoints (defaults shown)
export QDRANT_ENDPOINT="http://localhost:6333"
export OLLAMA_ENDPOINT="http://localhost:11434"

# Optional API keys
export OPENAI_API_KEY="your-key-here"
export QDRANT_API_KEY="your-key-here"

For all configuration options, see Environment Variables.

Performance Tips

Speed up embedding generation:

  • Install Ollama natively - Enables automatic GPU acceleration (Docker version uses CPU only)
  • Use OpenAI API - Faster than local embeddings but requires paid API key and sends data to OpenAI servers

Smart indexing:

  • Index parent directories - Avoids duplicates since full file paths are stored
  • Keep folders focused - Only index directories with documents you want searchable
  • Start with key folders - Index your most important documentation first

Time management:

  • Run during off-hours - Let large directories index overnight
  • Continue working - MCP server works immediately while indexing runs in background
  • Re-index efficiently - Only changed files are reprocessed when you re-run indexing

Supported Files

  • Text: .md, .txt

  • Code: .rs, .py, .js, .ts, .go, .java, etc.

  • Data: .json, .yaml, .csv, .toml

  • Config: .env, .conf, .ini

  • Upcoming: Support for more file types like PDFs, docx, etc, see #11

Documentation

License

MIT

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "peteretelej-directory-indexer": {
      "command": "npx",
      "args": [
        "-y",
        "directory-indexer"
      ]
    }
  }
}

Available Tools

  • index

    Index directories to make their files searchable. Processes files to create vector embeddings for semantic search.

    When to use this tool:

    • User specifically requests indexing a directory as a knowledge base
    • Adding new documentation, code repositories, or file collections to search
    • Updating index when many files have changed

    How it works:

    • Recursively scans directories for supported file types
    • Extracts text content and splits into chunks
    • Generates vector embeddings for semantic similarity
    • Stores in database for fast retrieval

    Examples:

    • Index documentation: "/home/user/docs/project-wiki"
    • Index codebase: "/home/user/projects/api-server"
    • Index multiple directories: "/home/user/docs,/home/user/configs"

    Indexing can take several minutes for large directories. Most users will already have directories indexed and can directly use search tool. Use server_info to check current indexing status first.

  • search

    Search indexed files using natural language queries. Finds files containing content semantically similar to the query.

    When to use this tool:

    • Find documentation, guides, or explanations about specific topics
    • Locate code files implementing certain functionality or patterns
    • Discover configuration files, scripts, or settings related to a topic
    • Search for files covering specific concepts or technologies

    How it works:

    • Converts query to vector embedding using semantic similarity
    • Searches all indexed file chunks for relevant content
    • Groups results by file and calculates average relevance scores
    • Returns files ranked by relevance score

    Examples:

    • "database configuration and connection pooling setup" - finds config files, documentation about DB setup
    • "comprehensive error handling patterns and exception management" - finds code files with exception handling
    • "JWT authentication implementation and session management" - finds auth-related code and docs
    • "REST API documentati
  • similar_files

    Find files with content similar to a reference file. Uses semantic similarity to find related documents, code files, or any text content.

    When to use this tool:

    • Find documentation similar to a specific guide or README
    • Locate related code files, configuration files, or scripts
    • Discover alternative implementations or approaches
    • Find files covering similar topics or concepts

    How it works:

    • Analyzes the semantic content of the reference file
    • Compares against all indexed files using vector similarity
    • Returns files ranked by content similarity score

    Examples:

    • Given "deployment-guide.md" - finds other deployment docs, CI/CD guides, infrastructure setup
    • Given "troubleshooting.md" - finds other troubleshooting guides, FAQ files, error documentation
    • Given "config.yaml" - finds other configuration files, settings, environment setups
    • Given "auth.py" - finds other authentication modules, security code, middleware

    Returns file paths with similarity scores. Use get_content to

  • get_content

    Retrieve the full content of a file or specific chunks. Reads files directly from the filesystem.

    When to use this tool:

    • Get complete file content after finding files through search
    • Read documentation, code files, or configuration files for analysis
    • Extract specific sections of large files using chunk ranges
    • Access any text-based file content

    How it works:

    • Reads files directly from filesystem (not from search index)
    • Returns entire file by default
    • Can return specific chunk ranges for indexed files
    • Preserves original formatting and content

    Examples:

    • Get full file: file_path="/home/user/docs/api.md"
    • Get specific chunks: file_path="/home/user/code/main.py", chunks="2-5"
    • Get single chunk: file_path="/home/user/config.json", chunks="1"

    Returns file content as text. Use this after search or similar_files to read actual content.

  • get_chunk

    Retrieve content of a specific chunk from an indexed file. Gets exact text segments identified during search.

    When to use this tool:

    • Get specific relevant sections after performing a search
    • Access only the most pertinent parts of large files
    • Retrieve content from high-scoring chunks identified in search results
    • Avoid reading entire files when only specific sections are needed

    How it works:

    • Files are split into overlapping text chunks during indexing
    • Each chunk has a sequential ID ("0", "1", "2", etc.)
    • Search results include chunk IDs for relevant sections
    • Returns the exact content that was semantically matched

    Examples:

    • After search returns chunk "3" from "api-docs.md" with high score
    • Get chunk content: file_path="/docs/api-docs.md", chunk_id="3"
    • Returns the specific text segment that matched your query

    Returns chunk content as text. Use this with chunk IDs from search results to get precise content sections.

  • server_info

    Get information about server status and indexed content. Shows what directories and files are available for search.

    When to use this tool:

    • REQUIRED: Check available workspace names before using workspace parameter in search or similar_files tools
    • Check what content is already indexed before performing searches
    • Verify system is working properly
    • See indexing statistics and status
    • Understand scope of available searchable content

    How it works:

    • Reports total indexed directories, files, and chunks
    • Shows database size and last indexing time
    • Lists all indexed directories with file counts
    • Lists all configured workspaces with their paths and file counts
    • Reports any errors or issues

    Examples:

    • Check workspaces before searching: "What workspaces are available?"
    • Check before searching: "What content is indexed?"
    • Verify after indexing: "Did the indexing complete successfully?"
    • Monitor system: "How many files are searchable?"

    Returns server version, indexing statistics,

Use Directory Indexer MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Directory Indexer is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Directory Indexer as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Directory Indexer MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "peteretelej-directory-indexer": {
      "command": "npx",
      "args": [
        "-y",
        "directory-indexer"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Directory Indexer MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Directory Indexer MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Directory Indexer to help me with this task?
Directory Indexer
Sure. I read it.
Here is what I found using Directory Indexer.

Frequently asked questions

What is the Directory Indexer MCP server used for?

Directory Indexer is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Directory Indexer MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Directory Indexer with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Directory Indexer MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Directory Indexer connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Directory Indexer MCP to TypingMind?

Directory Indexer runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Directory Indexer MCP provide in TypingMind?

Directory Indexer exposes 6 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Directory Indexer MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Directory Indexer requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇