Skip to main content
Glama
ibge-sidra-mcp

ibge-sidra-mcp

README.md
# ibge-sidra-mcp

A multi-user Model Context Protocol (MCP) server for read-only access to the
IBGE Aggregates API (SIDRA). It adapts the skeleton-mcp reference application
while retaining stdio and HTTP transports, Vault-backed secret storage,
Postgres-backed tenant/principal configuration, OAuth authorization, and the
optional LangGraph/A2A/pg-boss agent runtime.

## Status and source provenance

- Repository: `ibge-sidra-mcp` (GitHub repository name).
- MCP identity and namespace source: `MCP_SERVER_NAME=ibge-sidra-mcp`.
- API contracts: legacy SIDRA Values at
  `https://apisidra.ibge.gov.br/values` (exposed as the v2 compatibility tool)
  and the distinct IBGE Aggregates API v3 at
  `https://servicodados.ibge.gov.br/api/v3`.
- Source skeleton and exact adaptation base:
  <https://github.com/LesterAJohn/skeleton-mcp>, commit
  `bfbf26a6939a3c3c387a34bd2461f1bb5d0b8eec`.
- Creation mode: `new`, standalone with fresh Git history. This workspace has
  deliberately not been initialized as a Git repository, committed, or
  published. See [SOURCE-PROVENANCE.md](SOURCE-PROVENANCE.md).
- License: MIT, retained from the skeleton.

### API-document status

[API-DOCS.md](API-DOCS.md) records the route and parameter contracts. The
`ibge_v2_get_values` tool uses the legacy `/values/t/.../n.../v.../p...`
contract; it does not call `/api/v2`. Earlier probes of the separate
`servicodados.../api/v2` routes returned HTTP 404, while a legacy Values sample
returned HTTP 200 on 2026-12-02. Existing unprefixed `ibge_*` tools continue to
call the distinct v3 routes; no automatic fallback occurs.

Eight v3 route families and one legacy Values operation are implemented and
tested, as listed in
[docs/api-coverage.md](docs/api-coverage.md) and
[inventory/api-inventory.json](inventory/api-inventory.json). The inventory is
reproducible, but exhaustive coverage is **provisional**: the full official
interactive specifications were not captured, and the v3 page returned HTTP
503 during direct retrieval. The legacy Values operation does not provide
aggregate catalogue, metadata, period-discovery, or locality-discovery tools.

## What this server exposes

All IBGE API operations exposed here are GET-only and read-only. The upstream
API is public and does not require an IBGE API credential. No user bearer
token, MCP bearer token, admin key, or Vault token is forwarded to the IBGE
service. MCP HTTP authentication remains required independently of upstream
authentication. Public statistics returned by IBGE are not private per user;
MCP tenant/principal isolation applies to configuration, tasks, memory,
credentials, schedules, and other application-owned state.

### Service tools

| Tool | API route | Use |
|---|---|---|
| `ibge_list_aggregates` | `GET /api/v3/agregados` | Browse aggregates grouped by survey. |
| `ibge_get_aggregate_metadata` | `GET /api/v3/agregados/{agregado}/metadados` | Inspect aggregate variables, classifications, periodicity, and territorial levels. |
| `ibge_get_aggregate_periods` | `GET /api/v3/agregados/{agregado}/periodos` | Discover valid periods before querying. |
| `ibge_get_aggregate_localities` | `GET /api/v3/agregados/{agregado}/localidades/{nivel}` | Discover available localities at a level such as `N1` or `N6`. |
| `ibge_get_variables_by_periods` | `GET /api/v3/agregados/{agregado}/periodos/{periodos}/variaveis` | Retrieve all variables for selected periods. |
| `ibge_get_variable_by_periods` | `GET /api/v3/agregados/{agregado}/periodos/{periodos}/variaveis/{variavel}` | Retrieve selected variable IDs for selected periods. |
| `ibge_get_recent_variables` | `GET /api/v3/agregados/{agregado}/variaveis` | Use the v3 endpoint's default recent-period selection for all variables. |
| `ibge_get_recent_variable` | `GET /api/v3/agregados/{agregado}/variaveis/{variavel}` | Use the v3 endpoint's default recent-period selection for selected variables. |
| `ibge_v2_get_values` | `GET https://apisidra.ibge.gov.br/values/t/{table}/n{level}/{localities}/v/{variables}/p/{periods}[/c{classificationId}/{categoryIds}]` | Read a legacy SIDRA Values table with explicit path selectors. |
| `service_connection_info` | local | Report server identity, effective auth policy, namespace/scope model, and API connection metadata (never a secret). |
| `service_scope_info` | local | Preview normalized tenant/user or tenant/account Postgres and Vault scope metadata. |
| `service_list_endpoints` | local | Return the API operation-to-tool catalog. |
| `service_health_check` | metadata read | Perform a bounded metadata request to verify upstream reachability. |
| `service_query_suggestion` | local | Discover schemas and recommend a non-executing read workflow. |

No generic arbitrary-URL/request tool is exposed. There are no upstream
mutations, so the IBGE tools do not request `authorizationKey`. Agent,
configuration, Vault, tenancy, pg-boss, and schedule mutations retain the
skeleton authorization checks.

### Inputs, selectors, responses, and errors

- `aggregateId`: decimal aggregate ID string; inspect the catalogue and
  metadata first.
- For v3 tools, `level` is a geographic level such as `N1`, `N3`, or `N6`;
  `periods` accepts a negative recent count, `YYYYMM`, or pipe-delimited
  `YYYYMM` values; and `variableIds` accepts numeric IDs or documented
  `allxp`. Query selectors use `localities` (`BR` or `N6[3550308]`),
  `classification` (`classificacao`), and optional `view` (`OLAP` or `flat`).
- For `ibge_v2_get_values`, `level` is `N1` through `N9`; `localities` is
  `all` or comma-delimited numeric locality IDs; `variableIds` is `all` or
  comma-delimited numeric variable IDs; and `periods` is `all`, `first`,
  `last`, `last N`, or one numeric period code. Optional `classificationId`
  and comma-delimited `categoryIds` become `/c{classificationId}/{categoryIds}`
  path segments and must be supplied together. This older endpoint returns
  header and value rows in one array.

Success responses follow the skeleton JSON convention, with the upstream
status and parsed response in `data`. Errors are MCP `isError=true` responses
with a JSON error/status; upstream 4xx/5xx are not converted into success
payloads. Invalid IDs/selectors return a validation error. Timeouts return
504, oversized or malformed upstream responses return 502, and exhausted
upstream errors retain their HTTP status where available.

The v3 API documents a maximum of 100,000 values per data request. Keep
requests smaller by selecting fewer variables, periods, localities, and
classification categories. This server also enforces a response byte limit.
Only GET requests are retried, with a bounded attempt count and bounded
`Retry-After` delay. No pagination behavior is invented; the upstream
aggregate API does not expose a page-token contract in the reviewed route set.

Example:

```json
{
  "name": "ibge_get_variable_by_periods",
  "arguments": {
    "aggregateId": "1705",
    "periods": "-6",
    "variableIds": "355",
    "localities": "BR"
  }
}
```

Legacy Values example:

```json
{
  "name": "ibge_v2_get_values",
  "arguments": {
    "aggregateId": "1705",
    "level": "N1",
    "localities": "all",
    "variableIds": "355",
    "periods": "202001",
    "classificationId": "315",
    "categoryIds": "7169"
  }
}
```

Recommended sequence: `ibge_list_aggregates` ->
`ibge_get_aggregate_metadata` -> `ibge_get_aggregate_periods` and/or
`ibge_get_aggregate_localities` -> one of the variable result tools.

## Authentication, authorization, and identity

### HTTP authentication

HTTP transport accepts the skeleton's `token`, `oauth2`, or `both` modes.
Token mode can use static development tokens or the Vault-backed token index.
OAuth mode validates access tokens using configured introspection providers;
this is not an OAuth login server, token issuer, JWT verifier, or upstream
IBGE authentication mechanism. Inbound HTTP bearer tokens are not passed to
IBGE.

The default Vault-token HTTP requirement is `mcp:invoke`; configure audience
and required scopes for the deployment. OAuth deployments should configure a
provider scope map and `MCP_HTTP_OAUTH2_REQUIRED_SCOPES` consistent with the
client's provider scopes. Reverse-proxy identity is trusted only when its
shared secret is explicitly configured.

### Accepted MCP scopes

The OAuth verifier accepts these canonical scope names. There are no
IBGE-specific upstream OAuth scopes because the public API requires none.

| MCP scope | Purpose | Authorization effect |
|---|---|---|
| `mcp:invoke` | Invoke MCP and submit authorized agent goals. | Default Vault HTTP token scope; required for general agent/A2A invocation checks. |
| `mcp:read` | Accepted read-capability label; no separate HTTP/tool gate currently checks this scope. | No additional authorization effect; unguarded IBGE reads require authenticated HTTP transport only. |
| `mcp:write` | OAuth scope for ordinary mutating operations and agent capabilities whose guards request write authorization. | Does not authorize Vault credential/token administration, tenant administration, or operations explicitly requiring `mcp:admin`. |
| `mcp:admin` | OAuth scope for protected administrative operations requiring admin authorization. | Authorizes agent credential create/rotate/delete, Vault administration, and other admin-guarded operations, subject to tenant/ownership checks. |
| `mcp:agent` | Agent/A2A invocation scope. | Allows agent/A2A invocation where handlers accept this scope; it does not grant a mutating capability unless its separate capability guard allows it. |
| `mcp:tenancy:admin` | Tenant/principal administration. | Authorizes tenancy operations and related token seeding within the actor's allowed tenant boundary. |
| `mcp:proxy:initialize` | Trusted platform-proxy user initialization. | Authorizes the restricted proxy initialization flow. |
| `mcp:agent-config:admin` | Cross-principal agent configuration administration. | Authorizes managing another principal's agent configuration within allowed tenant boundaries. |

Configure explicit provider mappings through
`MCP_HTTP_OAUTH2_<PROVIDER>_SCOPE_MAP`, for example
`provider.invoke:mcp:invoke,provider.write:mcp:write,provider.admin:mcp:admin`.
These provider-side values are placeholders. For OAuth deployments that
require invocation scope for every HTTP request, configure
`MCP_HTTP_OAUTH2_REQUIRED_SCOPES=mcp:invoke` and request/map the corresponding
provider scope at client registration. If this setting is empty, any active
introspected OAuth token may use unguarded read-only tools; protected
operations still enforce their own scopes. The default authz mode is `auto`:
verified OAuth callers use scopes, while static/Vault token and stdio callers
use the configured admin-key behavior for protected local mutations.

### Tenant and principal model

The server supports tenant/user and tenant/account principals. HTTP identity
comes from the verified token or trusted-proxy mapping; caller-supplied
principal fields do not authorize a different principal. The configured
default tenant and user support local/stdio workflows only. Postgres config,
agent state, memory, tasks, schedules, grants, and checkpoints are namespaced
and principal-scoped. Vault credentials and token indexes are namespaced and
scoped by tenant/principal. A public IBGE aggregate ID is not an identity and
does not grant access to another user's private application data.

`MCP_SERVER_NAME` is the single current naming source. For this deployment:

- Postgres prefix/table family: `ibge_sidra_mcp_*`
- pg-boss schema: `ibge_sidra_mcp_pgboss`
- LangGraph checkpoint schema: `ibge_sidra_mcp_langgraph`
- Vault paths begin with `ibge-sidra-mcp/`
- Default HTTP token index: `ibge-sidra-mcp/http/auth/token-index`

Renaming `MCP_SERVER_NAME` changes the persistence namespace. Plan an explicit
copy/migration of Vault and Postgres data; the application does not silently
rename namespaces. `APP_NAME` is a legacy migration input only.

## Vault, Postgres, and secret lifecycle

- Persistent secrets, including inference credentials, remain in Vault.
- Non-secret configuration, revisions, tasks, memory, schedules, grants, and
  audit/application state remain in MCP-namespaced Postgres.
- Configuration and service state preserve tenant/principal ownership and
  default-user fallback semantics.
- The public IBGE API has no service credential to provision, rotate, or
  revoke. Do not create a placeholder credential for it.
- Optional inference credentials for the agent are provisioned separately
  into Vault through the existing guarded MCP credential tools; their values
  are not stored in Postgres, tasks, memories, logs, or tool responses.
- Agent credential values are scoped to the authenticated tenant and
  principal. For example, reference `provider/openai-default` resolves under
  `ibge-sidra-mcp/tenants/<tenant>/{users|accounts}/<principal>/credentials/`.
  Credential references are relative Vault KV paths; the value is stored as
  `apiKey` in KV v2. Existing root-level `${MCP_SERVER_NAME}/<credentialRef>`
  secrets are not automatically migrated or used by the scoped agent runtime.
  Re-provision the credential with the MCP tool and retest before enabling the
  corresponding configuration; the old secret is left untouched.
- Vault Agent file/listener/both modes, app-readable token sink path, and
  Postgres-backed non-secret pointers remain available.
- Local and production Vault configurations use Raft persistence. Startup
  keeps `vault-unseal-key-init` ordered before Vault, resolving the managed
  key by `VAULT_UNSEAL_KEY`, then
  `src/config/vault.unseal.key.json`, then generated material. This helper
  does not replace Vault initialization or KMS/HSM auto-unseal.
- Keep backups of Vault Raft data and Postgres, and test restore procedures.
  Never publish Vault data, initialization output, unseal material, `.env`,
  certificates, or production credentials.

## Agent, A2A, worker, and schedules

The skeleton's LangGraph agent, A2A endpoint, durable worker, checkpointing,
memory, pg-boss dispatch, and owner-scoped schedule/grant system are retained.
They are optional application capabilities, not required to query IBGE.
There is no default model, provider, inference endpoint, or inference
credential. A healthy Vault/Postgres deployment without inference configured
must report inference as unconfigured and reject inference-dependent calls
with an actionable error.

The MCP configuration surface includes:

- Agent config: `agent_config_get`, `agent_config_set`,
  `agent_config_update`, `agent_config_delete`, `agent_config_validate`,
  `agent_config_test_connection`.
- Agent execution: `agent_goal`, `agent_task_status`, `agent_task_resume`,
  `agent_task_cancel`.
- Agent memory/compositions: `agent_memory_search`, `agent_memory_add`,
  `agent_compositions_list`, `agent_composition_run`.
- User-scoped config administration: `agent_config_user_get`,
  `agent_config_user_list`, `agent_config_user_set`,
  `agent_config_user_update`, `agent_config_user_delete`.
- Scheduling: `agent_schedule_*` grant, schedule, preview, manual-run,
  history, and lifecycle tools; pg-boss operations use `pgboss_*`.
- A2A: authenticated JSON-RPC at `/a2a`; public Agent Card at
  `/.well-known/agent-card.json`.

Use the existing agent schema-discovery and capability tools before creating
configuration. Provision a Vault credential reference through the separate
credential tools, then validate config, set/update the scoped configuration,
and explicitly test the inference connection. Connection testing makes a
network request to the configured OpenAI-compatible endpoint and may incur
provider charges. Do not include API keys in config, goals, tasks, memory, or
examples. Start a non-destructive verification task only after the config is
enabled and the required capabilities are permitted.

### Inference credential lifecycle tools

| Tool | Classification and authorization | Behavior |
|---|---|---|
| `agent_credential_put` | Mutating; requires `MCP_ADMIN_AUTH_KEY` authorization or OAuth `mcp:admin` in scope authorization mode. | Creates a principal-scoped Vault KV v2 secret or writes a new version. |
| `agent_credential_rotate` | Mutating; same admin requirement. | Writes a new version only when the current credential is active. Rotate/revoke the upstream provider key separately as part of your provider's process. |
| `agent_credential_delete` | Mutating; same admin requirement. | Soft-deletes the current KV v2 version. Older versions can remain subject to Vault retention and policy; it does not revoke the key at the inference provider. |
| `agent_credential_inspect` | Read-only; authenticated caller can inspect only its own resolved principal scope. | Returns active/existence and Vault version timestamps only; never reads or returns the credential value. |

Example placeholder invocation:

```json
{
  "name": "agent_credential_put",
  "arguments": {
    "credentialRef": "provider/openai-default",
    "credential": "<inference-provider-api-key>",
    "authorizationKey": "<admin-key-when-key-auth-is-used>"
  }
}
```

In OAuth scope mode, `mcp:admin` authorizes the mutation and an
`authorizationKey` is not needed. In key mode, the key must be configured and
supplied. Credential creation, rotation, and deletion do not modify agent
configuration or cancel queued/running tasks or schedules. Active requests
may already have loaded a credential into process memory; queued tasks resolve
the current Vault value when execution begins and fail actionably if it is
deleted. Schedules remain configured and may fail until valid credentials and
configuration are restored. Update/delete the separate agent config when it
should no longer reference a credential.

The worker is a separate process:

```bash
MCP_AGENT_WORKER_ENABLED=true PGBOSS_ENABLED=true MCP_SERVER_NAME=ibge-sidra-mcp \
  npm run start:agent-worker
```

MCP server and worker must share `MCP_SERVER_NAME`, Postgres database, Vault
access, and authorization policy. Queue and application state must use the
same Postgres database for transactional dispatch. Scheduling uses strict
five-field cron/timezone or future one-shot timing, missed-run skip behavior,
revocable owner/capability grants, overlap protection, and reconciliation.
Disabling/deleting a schedule does not cancel tasks already submitted.
Schedule grants never store bearer tokens. Compose starts the HTTP MCP and a
dedicated worker; it does not create an agent config or inference credential.

## Transports and TLS

Transports: `stdio`, `http`, or `both`. HTTP authentication, body-size limits,
rate limits, origin/IP controls, and access logging remain enabled as
configured. Local HTTP examples below bind to loopback; for a remote deployment
use TLS at a trusted reverse proxy or native Node.js TLS.

**Native TLS default: `MCP_HTTP_TLS_ENABLED=false`.** HTTP is appropriate only
for loopback development or trusted internal proxy connections. The
recommended production pattern is TLS termination at a reverse proxy/load
balancer with `MCP_HTTP_TRUST_PROXY=true` only when the proxy is trusted.

To enable native HTTPS:

```dotenv
MCP_HTTP_TLS_ENABLED=true
MCP_HTTP_TLS_CERT_PATH=/app/certs/server.crt
MCP_HTTP_TLS_KEY_PATH=/app/certs/server.key
# Optional:
# MCP_HTTP_TLS_KEY_PASSPHRASE=<injected-at-runtime>
# MCP_HTTP_TLS_MIN_VERSION=TLSv1.2
MCP_A2A_PUBLIC_URL=https://mcp.example.invalid/a2a
```

Provision PEM certificates and private keys outside Git and mount the
certificate directory read-only (`./certs:/app/certs:ro`). Startup fails if
TLS paths are absent/unreadable; it does not silently fall back to HTTP.
Renew/rotate certificate material outside the repository and restart/recreate
the MCP process to load replacements. With native TLS enabled, register
clients at `https://<host>:3000/mcp`; with a trusted proxy, register the
proxy's HTTPS URL. The public Agent Card/A2A URL must use the externally
reachable HTTPS scheme.

## Setup and deployment

Requirements: Node.js 22+ and npm. Docker Compose is used for local
Postgres/Vault deployment.

```bash
npm ci
cp .env.example .env
# Set a strong MCP_ADMIN_AUTH_KEY for protected local mutations.
npm run hooks:install
npm test
npm run start:stdio
```

HTTP local development:

```dotenv
MCP_TRANSPORT_MODE=http
MCP_HTTP_HOST=127.0.0.1
MCP_HTTP_AUTH_MODE=token
MCP_HTTP_AUTH_TOKENS=<local-development-token>
MCP_HTTP_TLS_ENABLED=false
```

```bash
npm run start:http
```

Local container stack (Raft-backed Vault, Postgres, HTTP server, and worker):

```bash
docker compose up -d
```

For first-time Vault use, initialize and unseal the Raft server according to
[vault-production/README.md](vault-production/README.md). The example Vault
root token is a local placeholder, not a production credential. Configure
least-privilege Vault authentication before production.

### External Services Mode (Vault and Postgres)

Use `docker-compose.external.yml` when Vault and Postgres are already managed
externally. Required settings:

- `POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_DB`, `POSTGRES_USER`,
  `POSTGRES_PASSWORD` (or `POSTGRES_CONNECTION_STRING`)
- `VAULT_ADDR`, `VAULT_TOKEN`
- `MCP_SERVER_NAME=ibge-sidra-mcp`
- `MCP_AGENT_WORKER_ENABLED=true`, `PGBOSS_ENABLED=true`

```bash
docker compose -f docker-compose.external.yml up -d
```

The app-only compose file starts the HTTP server and dedicated agent worker,
not Postgres or Vault. Keep the required database and Vault endpoints
reachable from both containers and use production TLS/authentication.

### Environment variables

Core service and identity:

- `MCP_SERVER_NAME` (default `ibge-sidra-mcp`, single namespace source)
- `APP_NAME` (legacy migration input only)
- `MCP_SERVER_VERSION`
- `IBGE_SIDRA_API_BASE_URL` (default official v3 URL; configures only v3)
- Legacy v2 compatibility base is fixed in the adapter at
  `https://apisidra.ibge.gov.br/values`; it is not an environment override
- `IBGE_SIDRA_API_TIMEOUT_MS` (default 15000)
- `IBGE_SIDRA_MAX_RESPONSE_BYTES` (default 12582912)
- `IBGE_SIDRA_RETRY_ATTEMPTS` (default 2; 1–3)
- `MCP_CONFIG_DEFAULT_TENANT_ID`, `MCP_CONFIG_DEFAULT_USER_ID`,
  `MCP_CONFIG_DEFAULT_PRINCIPAL_TYPE`, `MCP_CONFIG_DEFAULT_ACCOUNT_ID`
- `MCP_ADMIN_AUTH_KEY`, `MCP_AUTHZ_MODE`
- `MCP_TRANSPORT_MODE` (`stdio`, `http`, `both`)
- `MCP_AGENT_WORKER_ENABLED`, `MCP_AGENT_MAX_GOAL_BYTES`,
  `MCP_AGENT_MAX_TASK_RUN_TIME_MS`, `MCP_AGENT_SCHEDULE_RECONCILE_MS`,
  `MCP_AGENT_SCHEDULE_RETENTION_DAYS`
- `MCP_A2A_PATH`, `MCP_A2A_CARD_PATH`, `MCP_A2A_PUBLIC_URL`
- `MCP_TOKEN_ROTATION_DEFAULT_INTERVAL_MS`,
  `MCP_TOKEN_ROTATION_USER_INTERVAL_CONFIG_KEY`
- `MCP_VAULT_AGENT_AUTH_MODE_CONFIG_KEY`,
  `MCP_VAULT_AGENT_TOKEN_FILE_PATH_CONFIG_KEY`,
  `MCP_VAULT_AGENT_LISTENER_ADDR_CONFIG_KEY`

HTTP transport and security:

- `MCP_HTTP_HOST`, `MCP_HTTP_PORT`, `MCP_HTTP_PATH`,
  `MCP_HTTP_HEALTH_PATH`
- `MCP_HTTP_AUTH_MODE`, `MCP_HTTP_TOKEN_SOURCE`, `MCP_HTTP_AUTH_TOKENS`
- `MCP_HTTP_TRUST_PROXY`, `MCP_HTTP_ALLOWED_ORIGINS`,
  `MCP_HTTP_ALLOWED_IPS`, `MCP_HTTP_MAX_BODY_BYTES`,
  `MCP_HTTP_RATE_LIMIT_WINDOW_MS`, `MCP_HTTP_RATE_LIMIT_MAX_REQUESTS`
- Trusted proxy bootstrap secrets: `MCP_HTTP_APIFY_PROXY_TOKEN`,
  `MCP_HTTP_MCPIZE_PROXY_TOKEN` (only when those platform identity bridges
  are deployed)
- `MCP_HTTP_VAULT_TOKEN_INDEX_PATH`,
  `MCP_HTTP_VAULT_TOKEN_DEFAULT_USER_ID`,
  `MCP_HTTP_VAULT_TOKEN_REQUIRED_SCOPES`,
  `MCP_HTTP_VAULT_TOKEN_REQUIRED_AUDIENCE`,
  `MCP_HTTP_VAULT_TOKEN_CACHE_TTL_MS`
- OAuth introspection: `MCP_HTTP_OAUTH2_PROVIDERS`,
  `MCP_HTTP_OAUTH2_<PROVIDER>_INTROSPECTION_URL`,
  `..._CLIENT_ID`, `..._CLIENT_SECRET`, `..._ISSUER`,
  `..._REQUIRED_SCOPES`, `..._REQUIRED_AUDIENCE`, `..._SCOPE_MAP`,
  `..._TIMEOUT_MS`, `..._CACHE_TTL_MS`
- Native TLS: `MCP_HTTP_TLS_ENABLED` (default false),
  `MCP_HTTP_TLS_CERT_PATH`, `MCP_HTTP_TLS_KEY_PATH`,
  `MCP_HTTP_TLS_KEY_PASSPHRASE`, `MCP_HTTP_TLS_MIN_VERSION`

Persistence and queue:

- `POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_DB`, `POSTGRES_USER`,
  `POSTGRES_PASSWORD`, optional `POSTGRES_CONNECTION_STRING`
- `PGBOSS_ENABLED`, `PGBOSS_CONNECTION_STRING`, `PGBOSS_SUPERVISE`,
  `PGBOSS_MIGRATE`, `PGBOSS_CREATE_SCHEMA`, `PGBOSS_MAX_POOL_SIZE`
- `VAULT_ADDR`, `VAULT_TOKEN`, `VAULT_KV_MOUNT`, `VAULT_UNSEAL_KEY`
- `VAULT_AGENT_ENABLED`, `VAULT_AGENT_AUTH_MODE`,
  `VAULT_AGENT_TOKEN_FILE_PATH`, `VAULT_AGENT_LISTENER_ENABLED`,
  `VAULT_AGENT_LISTENER_ADDR`
- `VAULT_WRITE_RETRY_ATTEMPTS`, `VAULT_WRITE_RETRY_BASE_DELAY_MS`,
  `VAULT_WRITE_RETRY_MAX_DELAY_MS`

The complete example and safe defaults are in [.env.example](.env.example).
Never commit `.env`, secrets, database contents, Vault data, certificates, or
unseal keys.

## API inventory, tests, and CI

The inventory is generated from checked-in operation definitions; generation
does not download mutable live documentation:

```bash
npm run inventory:generate
npm run inventory:check
npm test
npm run verify
```

`npm run verify` checks inventory consistency then runs the package and
application test suite. Tests include legacy Values path/selector construction,
distinct v3 route mapping, service input validation, URL allowlisting, response
bounds, retries/timeouts,
operation-to-tool mapping,
MCP HTTP auth and TLS, Vault token fallback, Vault Agent runtime resolution,
agent credential authorization/redaction, A2A, scheduling, and the Apify and
MCPize proxy contracts. Opt-in
integration tests use `MCP_AGENT_TEST_DATABASE_URL` for disposable Postgres
and controlled local inference, and `VAULT_TEST_ADDR` /
`VAULT_TEST_TOKEN` for a disposable Vault KV v2 service; unset services cause
those tests to be skipped. CI starts disposable Postgres and Vault instances
and runs these integration tests. No complete live Vault/Postgres/inference
end-to-end verification is claimed for this local preparation.

For local push readiness, configure disposable services in
`MCP_AGENT_TEST_DATABASE_URL`, `VAULT_TEST_ADDR`, and `VAULT_TEST_TOKEN`, then
run `npm run verify:required`. The version-controlled `.githooks/pre-push`
runs this required mode and fails closed if those settings are absent. Install
it for a Git checkout with `npm run hooks:install`. This preparation workspace
was intentionally left without a Git repository, so the hook is provided but
not installed here.

GitHub Actions workflow: `.github/workflows/inventory-and-tests.yml` runs the
inventory and test jobs for pushes and pull requests. After creating the new
Git repository, install the version-controlled pre-push check with:

```bash
npm run hooks:install
```

The hook runs `npm run verify:required` and blocks a normal push when required
integration settings, inventory, or tests fail. Branch protection and remote
required checks must be configured after publishing; this workspace task does
not create a GitHub repository or configure remote branch protection.

## Operations and known limitations

- API inventory exhaustiveness is provisional pending complete legacy Values
  and v3 specifications; see [docs/api-coverage.md](docs/api-coverage.md).
- A legacy Values sample and v3 aggregate route returned JSON; the separate
  `/api/v2` route family returned 404 in earlier probes and is not used. Live
  availability and data freshness can change independently of this build.
- Requests are bounded by timeout, retry, and response-byte limits; the
  official data request cap is documented as 100,000 values.
- No live inference provider, model, or credential is configured or required.
- A2A and agent task execution require a separately enabled, scoped config,
  Vault credential reference, and running worker.
- Production deployment must use TLS, least-privilege Vault authentication,
  restricted Postgres credentials/network access, safe token rotation, and
  tested backups/restores.