---
title: "Configuration"
description: "Every nasa-mcp setting with its environment variable, type and default; precedence is CLI flag, environment, YAML, default."
type: Reference
tags:
  - configuration
  - environment
generated:
  by: "claude/opus-5.5"
  at: "2026-11-27T00:00:00Z"
sources:
  - id: design
    resource: "DESIGN.md"
    title: "nasa-mcp design"
    author: "team:nasa-mcp"
  - id: config
    resource: "src/nasa_mcp/config.py"
    title: "nasa-mcp configuration model"
    author: "team:nasa-mcp"
status: stable
---

<!--
SPDX-FileCopyrightText: 2026 Tyson Lee Swetnam
SPDX-License-Identifier: CC-BY-4.0
-->

# Configuration

Precedence: **command-line flag > environment > YAML file (`--config`) > default**. Environment
variables are `NASA_MCP_<SECTION>__<FIELD>`; `__` descends one level and list values are
comma-separated. `.env` files are never loaded automatically (use `uv run --env-file .env` if you
must, and keep that file out of version control). Setting one field of a nested section (for
example `NASA_MCP_RATE__OVERRIDES__SSD__RPS=0.5`) keeps the defaults of the others.

```bash
nasa-mcp --print-config        # effective configuration, key shown as "***" or null
nasa-mcp --config config.yaml  # YAML file (see config.yaml.example)
```

Command-line flags: `--transport`, `--host`, `--port`, `--config`, `--log-level`, `--check`,
`--live`, `--print-config`, `--version`. There is **no key flag**: the api.nasa.gov key is read
only from `NASA_MCP_NASA__API_KEY`, and an `api_key` (or `token`) key in the YAML `nasa` section is
a configuration error. Configuration errors name the setting, never its value, and exit with
code 2. See [the api.nasa.gov key](api-key.md).

The result budget (50 000 bytes) and hard cap (200 000 bytes) are fixed by convention.

<!-- BEGIN GENERATED CONFIG (scripts/gen_config_reference.py; do not edit) -->

| Setting (YAML path) | Environment variable | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `server.transport` | `NASA_MCP_SERVER__TRANSPORT` | `stdio` \| `http` | `stdio` | stdio or http. |
| `server.host` | `NASA_MCP_SERVER__HOST` | str | `127.0.0.1` | HTTP bind address. |
| `server.port` | `NASA_MCP_SERVER__PORT` | int | `8080` | HTTP port. |
| `server.public_base_url` | `NASA_MCP_SERVER__PUBLIC_BASE_URL` | str \| null | unset | Public URL when behind a proxy. |
| `server.allowed_hosts` | `NASA_MCP_SERVER__ALLOWED_HOSTS` | list[str] | `[]` | Extra Host values accepted (DNS-rebinding guard). |
| `server.allowed_origins` | `NASA_MCP_SERVER__ALLOWED_ORIGINS` | list[str] | `[]` | Extra Origin values accepted. |
| `server.dns_rebinding_protection` | `NASA_MCP_SERVER__DNS_REBINDING_PROTECTION` | bool | `true` | Validate Host/Origin headers. |
| `server.json_response` | `NASA_MCP_SERVER__JSON_RESPONSE` | bool | `true` | Plain JSON responses instead of SSE. |
| `server.log_level` | `NASA_MCP_SERVER__LOG_LEVEL` | str | `INFO` | DEBUG, INFO, WARNING or ERROR. |
| `server.instructions_extra` | `NASA_MCP_SERVER__INSTRUCTIONS_EXTRA` | str \| null | unset | Text appended to the server instructions. |
| `nasa.api_key (env only)` | `NASA_MCP_NASA__API_KEY` | SecretStr \| null | unset | api.nasa.gov key; environment only (NASA_MCP_NASA__API_KEY). |
| `nasa.demo_key_fallback` | `NASA_MCP_NASA__DEMO_KEY_FALLBACK` | bool | `true` | Use DEMO_KEY (30 requests/hour per IP) when no key is set. |
| `nasa.allow_key_in_http_mode` | `NASA_MCP_NASA__ALLOW_KEY_IN_HTTP_MODE` | bool | `false` | Let anonymous HTTP callers spend the operator's key; otherwise HTTP mode uses DEMO_KEY (DESIGN.md §8). |
| `services.disabled` | `NASA_MCP_SERVICES__DISABLED` | list[str] | `[]` | Service ids to hide (their tools are not listed). |
| `cache.max_entries` | `NASA_MCP_CACHE__MAX_ENTRIES` | int | `2048` | In-memory cached responses. |
| `cache.ttl_s.default` | `NASA_MCP_CACHE__TTL_S__DEFAULT` | int | `3600` | Default response TTL (s). |
| `cache.ttl_s.static` | `NASA_MCP_CACHE__TTL_S__STATIC` | int | `86400` | Slow-changing catalogs and capabilities (s). |
| `cache.ttl_s.archive` | `NASA_MCP_CACHE__TTL_S__ARCHIVE` | int | `604800` | Past-dated, immutable records (s). |
| `cache.stale_if_error_s` | `NASA_MCP_CACHE__STALE_IF_ERROR_S` | int | `86400` | Serve stale entries on errors (s). |
| `cache.disk_dir` | `NASA_MCP_CACHE__DISK_DIR` | str \| null | unset | Optional gzip-JSON disk cache directory. |
| `rate.default.rps` | `NASA_MCP_RATE__DEFAULT__RPS` | float | `2.0` | Requests per second. |
| `rate.default.concurrency` | `NASA_MCP_RATE__DEFAULT__CONCURRENCY` | int | `2` | Requests in flight. |
| `rate.overrides` | `NASA_MCP_RATE__OVERRIDES` | dict | `{}` | Per-service policy, keyed by service id. |
| `limits.max_result_bytes` | `NASA_MCP_LIMITS__MAX_RESULT_BYTES` | int | `50000` | Result budget (fixed). |
| `limits.hard_max_result_bytes` | `NASA_MCP_LIMITS__HARD_MAX_RESULT_BYTES` | int | `200000` | Hard result cap (fixed). |
| `limits.tool_timeout_s` | `NASA_MCP_LIMITS__TOOL_TIMEOUT_S` | float | `90.0` | Per-tool wall clock (s). |
| `limits.adql_max_rows` | `NASA_MCP_LIMITS__ADQL_MAX_ROWS` | int | `500` | Row cap for nasa_exoplanet_query (TOP n is enforced). |

<!-- END GENERATED CONFIG -->
