Configuration

Environment variables for the backend, frontend, and MCP server.

Copy backend/.env.example and frontend/.env.example when running locally. Never commit real secrets.

# Generate secrets (example)
python -c "import secrets; print(secrets.token_hex(32))"  # ENCRYPTION_KEY
python -c "import secrets; print(secrets.token_urlsafe(32))"  # JWT_SECRET

Backend variables

VariableRequiredDefaultDescription
OPENAI_API_KEYYesAPI key for the LLM provider used by chat orchestration
OPENAI_BASE_URLNohttps://api.openai.com/v1OpenAI-compatible API base URL
OPENAI_MODELNoModel identifier passed to the chat completion API
OPENAI_TEMPERATURENo0.3Sampling temperature for chat completions
OPENAI_MAX_TOKENSNo768Max completion tokens per chat turn
CHAT_HISTORY_LIMITNo10Number of prior messages included in LLM context
ENCRYPTION_KEYYes32-byte key for AES-256 encryption of agent wallet keys
JWT_SECRETYesSecret for signing agent access tokens
DATABASE_PATHNo./data/pocketagent.dbSQLite database file path (absolute recommended in production)
CORS_ORIGINSNohttp://localhost:3000Comma-separated allowed frontend origins
POCKET_RPC_URLNoDefault Pocket Network RPC gateway URL
COINGECKO_API_URLNohttps://api.coingecko.com/api/v3CoinGecko API base for portfolio valuations
COINGECKO_API_KEYNoOptional CoinGecko Pro API key
CACHE_TTL_BALANCENo300Balance cache TTL in seconds
CACHE_TTL_GASNo30Gas price cache TTL in seconds
NOTIONAL_POKT_PER_RELAYNo0.00089Notional POKT cost estimate per relay for analytics
DISABLE_AGENT_AUTHNofalseSkip token checks in local dev only — never enable in production

Frontend variables

VariableRequiredDefaultDescription
NEXT_PUBLIC_API_URLYesBackend API base URL (no trailing slash)
NEXT_PUBLIC_WALLETCONNECT_PROJECT_IDYesWalletConnect Cloud project ID for RainbowKit
NEXT_PUBLIC_DISABLE_AGENT_AUTHNofalseMirror backend DISABLE_AGENT_AUTH for local UI dev

MCP server variables

VariableRequiredDefaultDescription
OPENAI_API_KEYYesRequired when MCP tools invoke LLM-backed flows
ENCRYPTION_KEYYesRequired for write tools that sign with agent wallets
JWT_SECRETYesRequired to validate agent access tokens on protected tools
DATABASE_PATHNo./data/pocketagent.dbSQLite path for agent rows; use absolute path when installed via pip