> ## Documentation Index
> Fetch the complete documentation index at: https://docs.databar.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Environment variables, safe mode, caching, and task data retention for the Databar MCP server

## Environment variables

These settings apply only when you run the **local** npm or source-built server. The **hosted** server at `https://mcp.databar.ai/mcp` uses your Bearer token only; you cannot set these via env on the remote endpoint (defaults are managed by Databar).

| Variable                       | Default                     | Description                                                  |
| ------------------------------ | --------------------------- | ------------------------------------------------------------ |
| `DATABAR_API_KEY`              | *(required)*                | Your Databar API key                                         |
| `DATABAR_BASE_URL`             | `https://api.databar.ai/v1` | API base URL                                                 |
| `CACHE_TTL_HOURS`              | `24`                        | How long to cache results                                    |
| `MAX_POLL_ATTEMPTS`            | `150`                       | Max polling attempts for async tasks                         |
| `POLL_INTERVAL_MS`             | `2000`                      | Polling interval in milliseconds                             |
| `DATABAR_SAFE_MODE`            | `true`                      | Check credit balance before each enrichment                  |
| `DATABAR_MAX_COST_PER_REQUEST` | *(unset)*                   | Max estimated credits per request; set to enforce a hard cap |
| `DATABAR_MIN_BALANCE`          | `1`                         | Minimum balance threshold before blocking                    |
| `DATABAR_AUDIT_LOG`            | *(none)*                    | File path to write audit logs                                |
| `DATABAR_MAX_RESULT_LENGTH`    | `50000`                     | Truncate results longer than this                            |

## Safe mode vs unsafe mode

By default, the server runs in **safe mode** — it checks your credit balance before each enrichment to prevent accidental overspending. Even in safe mode, the `DATABAR_MAX_COST_PER_REQUEST` cap is enforced if set.

If you find balance checks slow down bulk operations, you can disable safe mode:

```json theme={null}
{
  "env": {
    "DATABAR_API_KEY": "your-key",
    "DATABAR_SAFE_MODE": "false"
  }
}
```

<Warning>
  In unsafe mode, the server skips balance checks. You'll see a warning at startup and before bulk operations, but spending will not be blocked. The `DATABAR_MAX_COST_PER_REQUEST` cap is still enforced.
</Warning>

## Caching

Results are cached for **24 hours** by default (controlled by `CACHE_TTL_HOURS` on local installs). Cached lookups don't consume credits.

To force a fresh lookup, pass `skip_cache: true` when calling `run_enrichment`.

## Task data retention

<Warning>
  Task data is stored for **24 hours** after completion. If you need the results later, make sure to retrieve them promptly. After 24 hours, task data is permanently deleted and the status will return `gone`.
</Warning>
