# =============================================================================
# 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
# Enable file logging (default: disabled)
# MCP_LOGGING=1
# Enable cloud tools (default: disabled)
# Enables: cloud_sync, cloud_search, cloud_list, cloud_info, cloud_clear
# RELACE_CLOUD_TOOLS=1
# -----------------------------------------------------------------------------
# Advanced: Apply API Settings (fast_apply tool)
# -----------------------------------------------------------------------------
# Note: APPLY_* variables are the new standard. RELACE_APPLY_* variants are
# deprecated but still supported with a deprecation warning.
# 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 (new) or RELACE_APPLY_API_KEY (deprecated)
# 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
# Post-check validation after fast_apply merges (default: disabled)
# Validates merged_code semantic correctness
# APPLY_POST_CHECK=1
# -----------------------------------------------------------------------------
# Advanced: Search API Settings (fast_search tool)
# -----------------------------------------------------------------------------
# Note: SEARCH_* variables are the new standard. RELACE_SEARCH_* variants are
# deprecated but still supported with a deprecation warning.
# 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 (new) or RELACE_SEARCH_API_KEY (deprecated)
# 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
# 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 fast_search)
# -----------------------------------------------------------------------------
# LSP request timeout in seconds (default: 15)
# SEARCH_LSP_TIMEOUT_SECONDS=15
# -----------------------------------------------------------------------------
# Advanced: Miscellaneous
# -----------------------------------------------------------------------------
# Custom .env file path (default: auto-discover from current directory)
# MCP_DOTENV_PATH=/path/to/.env
# -----------------------------------------------------------------------------
# Deprecated Environment Variables (still supported with warning)
# -----------------------------------------------------------------------------
# The following variables are deprecated. Use the new names above instead.
#
# RELACE_EXPERIMENTAL_LOGGING -> MCP_LOGGING
# RELACE_LOGGING -> MCP_LOGGING
# RELACE_BASE_DIR -> MCP_BASE_DIR
# RELACE_TIMEOUT_SECONDS -> APPLY_TIMEOUT_SECONDS
# RELACE_EXPERIMENTAL_POST_CHECK -> APPLY_POST_CHECK
# RELACE_LSP_TIMEOUT_SECONDS -> SEARCH_LSP_TIMEOUT_SECONDS
# RELACE_APPLY_PROVIDER -> APPLY_PROVIDER
# RELACE_APPLY_ENDPOINT -> APPLY_ENDPOINT
# RELACE_APPLY_MODEL -> APPLY_MODEL
# RELACE_APPLY_API_KEY -> APPLY_API_KEY
# RELACE_APPLY_PROMPT_FILE -> APPLY_PROMPT_FILE
# RELACE_SEARCH_PROVIDER -> SEARCH_PROVIDER
# RELACE_SEARCH_ENDPOINT -> SEARCH_ENDPOINT
# RELACE_SEARCH_MODEL -> SEARCH_MODEL
# RELACE_SEARCH_API_KEY -> SEARCH_API_KEY
# RELACE_SEARCH_TIMEOUT_SECONDS -> SEARCH_TIMEOUT_SECONDS
# RELACE_SEARCH_MAX_TURNS -> SEARCH_MAX_TURNS
# RELACE_SEARCH_PARALLEL_TOOL_CALLS -> SEARCH_PARALLEL_TOOL_CALLS
# RELACE_SEARCH_ENABLED_TOOLS -> SEARCH_ENABLED_TOOLS
# RELACE_SEARCH_TOOL_STRICT -> SEARCH_TOOL_STRICT
# RELACE_SEARCH_PROMPT_FILE -> SEARCH_PROMPT_FILE
# RELACE_DOTENV_PATH -> MCP_DOTENV_PATH