# =============================================================================
# Relace MCP Server - Environment Variables
# =============================================================================
# Copy this file to .env for local development.
# For MCP usage, set these in your mcp_config.json "env" section instead.
# =============================================================================
# -----------------------------------------------------------------------------
# Required
# -----------------------------------------------------------------------------
# Relace API Key (get yours at: https://app.relace.ai/settings/billing)
RELACE_API_KEY=rlc-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# -----------------------------------------------------------------------------
# Recommended
# -----------------------------------------------------------------------------
# Restrict file access to this directory (prevents path traversal attacks)
# Defaults to current working directory if not set
MCP_BASE_DIR=/path/to/your/project
# Local file logging (default: off)
# Options: off | safe | full
# off - Disabled (no file logging)
# safe - Enabled with redaction (long strings truncated)
# full - Enabled without redaction (complete content)
# MCP_LOGGING=off
# Log level for stderr output (default: WARNING)
# Options: DEBUG, INFO, WARNING, ERROR
# Use DEBUG for troubleshooting base_dir resolution, MCP roots, etc.
# MCP_LOG_LEVEL=WARNING
# Enable cloud tools (default: disabled)
# Enables: cloud_sync, cloud_search, cloud_list, cloud_info, cloud_clear
# RELACE_CLOUD_TOOLS=1
# Enable agentic_retrieval tool (default: disabled)
# Requires RELACE_CLOUD_TOOLS=1 or a local backend (codanna/chunkhound)
# MCP_SEARCH_RETRIEVAL=1
# Retrieval backend for agentic_retrieval (default: relace)
# Options: relace | codanna | chunkhound | none
# codanna requires: codanna init && codanna index <dir>
# chunkhound requires: pip install chunkhound (index auto-created on first search)
# MCP_RETRIEVAL_BACKEND=relace
# -----------------------------------------------------------------------------
# Advanced: Apply API Settings (fast_apply tool)
# -----------------------------------------------------------------------------
# Apply provider (default: relace)
# Set to openai/openrouter/cerebras (or any non-"relace" label) to use an
# OpenAI-compatible chat.completions endpoint.
# APPLY_PROVIDER=relace
# API key selection (in order):
# 1) APPLY_API_KEY
# 2) Provider default env var (e.g. OPENAI_API_KEY / OPENROUTER_API_KEY / CEREBRAS_API_KEY)
# 3) RELACE_API_KEY (fallback for Relace provider)
#
# APPLY_API_KEY=
#
# OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# CEREBRAS_API_KEY=csk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Apply API endpoint (default: Relace official endpoint)
# APPLY_ENDPOINT=https://instantapply.endpoint.relace.run/v1/apply
# Apply model name (Relace default: auto)
# APPLY_MODEL=auto
# Optional: override the OpenAI-compatible apply prompt YAML (developer/debug)
# APPLY_PROMPT_FILE=/path/to/apply_openai.yaml
# Apply request timeout in seconds (default: 60)
# APPLY_TIMEOUT_SECONDS=60
# Apply LLM sampling temperature (default: 0.0, range: 0.0-2.0)
# APPLY_TEMPERATURE=0.0
# Semantic check after fast_apply merges (default: disabled)
# Validates new/delete intent correctness
# APPLY_SEMANTIC_CHECK=1
# -----------------------------------------------------------------------------
# Advanced: Search API Settings (agentic_search tool)
# -----------------------------------------------------------------------------
# Search provider (default: relace)
# Set to openai/openrouter/cerebras (or any non-"relace" label) to use an
# OpenAI-compatible chat.completions endpoint.
# SEARCH_PROVIDER=relace
# API key selection (in order):
# 1) SEARCH_API_KEY
# 2) Provider default env var (e.g. OPENAI_API_KEY / OPENROUTER_API_KEY / CEREBRAS_API_KEY)
# 3) RELACE_API_KEY (fallback for Relace provider)
#
# SEARCH_API_KEY=
#
# OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# CEREBRAS_API_KEY=csk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Search API endpoint (default: Relace official endpoint)
# SEARCH_ENDPOINT=https://search.endpoint.relace.run/v1/search
# Search model name (default: relace-search)
# SEARCH_MODEL=relace-search
# Search request timeout in seconds (default: 120)
# SEARCH_TIMEOUT_SECONDS=120
# Search LLM sampling temperature (default: 1.0, range: 0.0-2.0)
# SEARCH_TEMPERATURE=1.0
# Maximum agent turns for search (default: 6)
# SEARCH_MAX_TURNS=6
# Allow the model to emit multiple tool calls per turn (default: enabled)
# Improves latency when tools are independent
# SEARCH_PARALLEL_TOOL_CALLS=1
# Restrict Fast Agentic Search tools (comma/space separated allowlist)
# `report_back` is always enabled. `bash` requires explicit opt-in (security).
# Example (recommended minimal set):
# SEARCH_ENABLED_TOOLS=view_file,view_directory,grep_search,glob
# Tool schema compatibility: include `strict` field in tool schemas (default: 1)
# Set to 0 to omit the non-standard `strict` field if your OpenAI-compatible
# endpoint rejects it
# SEARCH_TOOL_STRICT=1
# Nucleus sampling parameter (optional, not set by default)
# Some providers (e.g., Mistral) require top_p=1 for greedy sampling (temperature=0)
# Only set this if your provider requires it
# SEARCH_TOP_P=1
# Optional: override the Fast Search prompt YAML (developer/debug)
# SEARCH_PROMPT_FILE=/path/to/search.yaml
# -----------------------------------------------------------------------------
# Advanced: Cloud/Repo Sync Settings (for cloud_* tools)
# -----------------------------------------------------------------------------
# Relace Repos API endpoint (default: https://api.relace.run/v1)
# RELACE_API_ENDPOINT=https://api.relace.run/v1
# Pre-configured Repo ID (skip list/create if set)
# RELACE_REPO_ID=
# Repo sync timeout in seconds (default: 300)
# RELACE_REPO_SYNC_TIMEOUT=300
# Maximum files to sync per repo (default: 5000)
# RELACE_REPO_SYNC_MAX_FILES=5000
# Maximum repos to list (default: 10000)
# RELACE_REPO_LIST_MAX=10000
# Concurrent upload workers for cloud sync (default: 8)
# RELACE_UPLOAD_MAX_WORKERS=8
# -----------------------------------------------------------------------------
# Advanced: Encoding Settings
# -----------------------------------------------------------------------------
# Project default encoding (e.g., "gbk", "big5", "shift_jis")
# If not set, auto-detection will be attempted at startup
# RELACE_DEFAULT_ENCODING=
# -----------------------------------------------------------------------------
# Advanced: LSP Settings (for find_symbol tool in agentic_search)
# -----------------------------------------------------------------------------
# LSP tools mode: 'false' (disabled, default), 'true' (all enabled), 'auto' (detect installed servers)
# SEARCH_LSP_TOOLS=false
# LSP request timeout in seconds (default: 15)
# SEARCH_LSP_TIMEOUT_SECONDS=15
# -----------------------------------------------------------------------------
# Advanced: Agentic Retrieval Settings
# -----------------------------------------------------------------------------
# Auto-sync before agentic retrieval (default: enabled when cloud tools are enabled)
# RELACE_AGENTIC_AUTO_SYNC=1
# -----------------------------------------------------------------------------
# Advanced: Miscellaneous
# -----------------------------------------------------------------------------
# Custom .env file path (default: auto-discover from current directory)
# MCP_DOTENV_PATH=/path/to/.env