Configuration Reference

March 24, 2025 ยท View on GitHub

This document provides a comprehensive reference for all configuration options available in Files-DB-MCP.

Configuration Methods

Files-DB-MCP can be configured through several methods (in order of precedence):

  1. Command-line arguments: Highest precedence, overrides other methods
  2. Environment variables: Applied if command-line arguments are not provided
  3. Configuration file: Located at .files-db-mcp/config.json in the project directory
  4. Auto-detection: Automatic project type detection with smart defaults
  5. Global defaults: Applied if no other configuration is available

Command-Line Arguments

ArgumentTypeDefaultDescription
--project-pathstringCurrent directoryPath to the project directory to index
--data-dirstring.files-db-mcp in current directoryDirectory to store data
--hoststring0.0.0.0Host to bind to
--portinteger8000Port to bind to
--ignorestring[][.git, node_modules, ...]Patterns to ignore during indexing
--embedding-modelstringAuto-detectedEmbedding model to use
--model-configJSON string{}JSON with embedding model configuration
--disable-ssebooleanfalseDisable SSE interface
--debugbooleanfalseEnable debug mode
--force-reindexbooleanfalseForce a full re-index of all files
--disable-auto-configbooleanfalseDisable automatic project configuration detection

Example:

python -m src.main --project-path /path/to/project --port 8001 --embedding-model "Salesforce/SFR-Embedding-2_R" --model-config '{"device": "cuda", "quantization": "int8"}'

Environment Variables

VariableTypeDefaultDescription
PROJECT_PATHstringCurrent directoryPath to the project directory to index
DATA_DIRstring.files-db-mcp in current directoryDirectory to store data
HOSTstring0.0.0.0Host to bind to
PORTinteger8000Port to bind to
EMBEDDING_MODELstringAuto-detectedEmbedding model to use
MODEL_CONFIGJSON string{}JSON with embedding model configuration
VECTOR_DB_HOSTstringlocalhostVector database host
VECTOR_DB_PORTinteger6333Vector database port
DEBUGbooleanfalseEnable debug mode

Example:

export EMBEDDING_MODEL="Salesforce/SFR-Embedding-2_R"
export MODEL_CONFIG='{"device": "cuda", "quantization": "int8"}'
export PORT=8001
python -m src.main

Configuration File

The configuration file is automatically generated during project initialization and stored at .files-db-mcp/config.json. You can modify this file to customize the configuration.

Example:

{
  "project_type": "python",
  "detected_project_types": ["python", "javascript"],
  "embedding_model": "jinaai/jina-embeddings-v2-base-code",
  "model_config": {
    "device": "cuda",
    "normalize_embeddings": true,
    "quantization": "int8",
    "prompt_template": "Code: {text}"
  },
  "custom_ignore_patterns": ["logs/", "*.cache"],
  "auto_generated": true,
  "version": "0.1.0"
}

Automatic Project Type Detection

Files-DB-MCP automatically detects the project type based on file patterns and directory structure. This detection is used to select appropriate default settings.

See Project Initialization for details on auto-detection.

Configuration Categories

1. Server Configuration

Controls the HTTP server and API endpoints.

OptionTypeDefaultDescription
hoststring0.0.0.0Host to bind to
portinteger8000Port to bind to
disable_ssebooleanfalseDisable Server-Sent Events interface
debugbooleanfalseEnable debug logging

2. Project Configuration

Controls the project indexing behavior.

OptionTypeDefaultDescription
project_pathstringCurrent directoryPath to the project directory to index
data_dirstring.files-db-mcp in current directoryDirectory to store data
ignore_patternsstring[][.git, node_modules, ...]Patterns to ignore during indexing
force_reindexbooleanfalseForce a full re-index of all files
disable_auto_configbooleanfalseDisable automatic project configuration detection

3. Vector Database Configuration

Controls the vector database connection and behavior.

OptionTypeDefaultDescription
vector_db_hoststringlocalhostVector database host
vector_db_portinteger6333Vector database port
collection_namestringfilesCollection name in the vector database

4. Model Configuration

Controls the embedding model behavior. See Model Configuration for details.

OptionTypeDefaultDescription
embedding_modelstringDepends on project typeEmbedding model to use
devicestringAuto-detectedDevice to run the model on (cpu, cuda, mps)
normalize_embeddingsbooleantrueWhether to normalize embeddings
prompt_templatestringModel-dependentTemplate for formatting text before embedding
quantizationstringint8Quantization type (int8, int4, null)
binary_embeddingsbooleanfalseWhether to use binary embeddings

MCP Configuration API

The MCP interface provides functions for managing configuration:

Get Project Configuration

{
  "function": "get_project_config"
}

Response:

{
  "success": true,
  "config": {
    "project_type": "python",
    "detected_project_types": ["python", "javascript"],
    "embedding_model": "jinaai/jina-embeddings-v2-base-code",
    "model_config": {
      "device": "cuda",
      "normalize_embeddings": true,
      "quantization": "int8"
    }
  }
}

Detect Project Type

{
  "function": "detect_project_type",
  "parameters": {
    "force_redetect": true
  }
}

Update Project Configuration

{
  "function": "update_project_config",
  "parameters": {
    "embedding_model": "Salesforce/SFR-Embedding-2_R",
    "model_config": {
      "device": "cuda",
      "normalize_embeddings": true
    },
    "custom_ignore_patterns": ["*.log", "temp/"]
  }
}

Docker Environment Variables

When running in Docker, additional environment variables are available:

VariableTypeDefaultDescription
VECTOR_DB_HOSTstringvector-dbVector database host within Docker network
VECTOR_DB_PORTinteger6333Vector database port
PROJECT_MOUNTstring/projectMount point for the project directory
DATA_MOUNTstring/dataMount point for the data directory

Configuration Best Practices

  1. Use Project-Specific Configuration Files: Let Files-DB-MCP detect your project type and create a configuration file. Make targeted edits to this file rather than using command-line arguments for recurring configuration.

  2. Environment-Specific Configuration: Use environment variables for settings that change between environments (development, CI/CD, production).

  3. Ignore Patterns: Keep ignore patterns minimal to avoid excluding important files. The auto-detected patterns from .gitignore are usually sufficient.

  4. Model Selection: Choose models appropriate for your project type and size:

    • For small projects: BAAI/bge-small-en-v1.5 or sentence-transformers/all-MiniLM-L6-v2
    • For medium projects: jinaai/jina-embeddings-v2-base-code
    • For large projects with high accuracy needs: Salesforce/SFR-Embedding-2_R
  5. Resource Constraints: Use quantization and CPU mode for environments with limited resources.