Configuration
DocuLayer is configured entirely through environment variables — no config files, no disk reads, no setup required beyond pip install.
Variables
| Variable | Default | Description |
|---|---|---|
DOCULAYER_CACHE_TTL | 3600 | Cache entry lifetime in seconds. After this period, a fresh fetch is triggered on the next request. |
DOCULAYER_MAX_CACHE | 256 | Maximum number of pages in the in-memory cache. When full, the oldest entry is evicted. |
DOCULAYER_FETCH_TIMEOUT | 12.0 | HTTP timeout per request in seconds. Raise for slow sites; lower for stricter latency budgets. |
DOCULAYER_MAX_BYTES | 524288 | Maximum page size to process (512 KB). Pages larger than this are truncated before parsing. |
DOCULAYER_MAX_WORDS | 400 | Maximum 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_TTLseconds (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.