Skip to main content

Configuration

DocuLayer is configured entirely through environment variables — no config files, no disk reads, no setup required beyond pip install.

Variables

VariableDefaultDescription
DOCULAYER_CACHE_TTL3600Cache entry lifetime in seconds. After this period, a fresh fetch is triggered on the next request.
DOCULAYER_MAX_CACHE256Maximum number of pages in the in-memory cache. When full, the oldest entry is evicted.
DOCULAYER_FETCH_TIMEOUT12.0HTTP timeout per request in seconds. Raise for slow sites; lower for stricter latency budgets.
DOCULAYER_MAX_BYTES524288Maximum page size to process (512 KB). Pages larger than this are truncated before parsing.
DOCULAYER_MAX_WORDS400Maximum words per returned section. Longer sections are trimmed at word boundaries.

Setting Variables

Shell (one-off)

DOCULAYER_CACHE_TTL=7200 doculayer search "validators" --source pydantic

Shell (persistent, bash/zsh)

export DOCULAYER_CACHE_TTL=7200
export DOCULAYER_FETCH_TIMEOUT=20.0

.env file

DocuLayer loads a .env file from the current working directory automatically (via python-dotenv):

# .env
DOCULAYER_CACHE_TTL=7200
DOCULAYER_MAX_CACHE=512
DOCULAYER_FETCH_TIMEOUT=20.0

MCP server (IDE config)

Pass environment variables to the MCP process through your IDE's MCP config:

{
"mcpServers": {
"doculayer": {
"command": "doculayer",
"args": ["mcp"],
"env": {
"DOCULAYER_CACHE_TTL": "7200",
"DOCULAYER_FETCH_TIMEOUT": "20.0"
}
}
}
}

Storage Guarantee

DocuLayer never writes to disk.

  • All fetched pages go into a TTLCache[FetchResult] in process memory
  • Cache entries expire after DOCULAYER_CACHE_TTL seconds (default: 1 hour)
  • On process restart, the cache is empty — nothing persisted
  • Safe for privacy-sensitive environments; docs can never go stale past the TTL

There is no database, no local files, no .cache directory. If the process exits, the cache is gone.