# SAP MCP Server - Environment Configuration # Copy this file to .env and customize for your environment # ============================================================================= # Server Mode (default: readonly) # ============================================================================= # - readonly: No signing, read-only operations only (SAFE) # - local-dev-keypair: Uses local wallet for signing (DEV ONLY) # - external-signer: Prepares TXs for external signing service # - delegated-session: Uses delegated session with permissions # - hosted-api: Hosted mode with HTTP transport SAP_MCP_MODE=readonly # Prefer profile/config pointers for MCP clients such as Hermes, Claude, Codex, or OpenClaw. # This avoids stale YAML env values shadowing the active JSON profile. # SAP_MCP_PROFILE=gianni-market-nft-agent # SAP_MCP_CONFIG_PATH=~/.config/mcp-sap/config-gianni-market-nft-agent.json # Set this only when you intentionally want env RPC/mode/wallet to override a profile JSON. # SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE=false # ============================================================================= # Solana RPC Configuration # ============================================================================= SAP_RPC_URL=https://api.mainnet-beta.solana.com # SAP_MCP_RPC_URL is a compatibility alias for explicit RPC override. # Do not set it in MCP client YAML when using SAP_MCP_PROFILE or SAP_MCP_CONFIG_PATH. # SAP_MCP_RPC_URL=https://api.mainnet-beta.solana.com # SAP_RPC_URL_DEVNET=https://api.devnet.solana.com # SAP_RPC_URL_TESTNET=https://api.testnet.solana.com # ============================================================================= # SAP Program Configuration # ============================================================================= SAP_PROGRAM_ID=SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ # ============================================================================= # Commitment & Performance # ============================================================================= SAP_COMMITMENT=confirmed SAP_MAX_RETRIES=3 SAP_RETRY_DELAY_MS=1000 # ============================================================================= # Signer Configuration (for local-dev-keypair mode) # ============================================================================= # Path to wallet keypair JSON file (KEEP SECURE!) # SAP_WALLET_PATH=/path/to/your/wallet.json # SAP_WALLET_ENCRYPTED=false # SAP_WALLET_PASSPHRASE_ENV=WALLET_PASSPHRASE # ============================================================================= # External Signer Configuration (for external-signer mode) # ============================================================================= # SAP_EXTERNAL_SIGNER_URL=https://signer.example.com/api/v1/sign # Local signing proxy form: # SAP_EXTERNAL_SIGNER_URL=http://127.0.0.1:8765/sign/ # Start with: # SAP_SIGNING_AUTH_TOKEN=replace-with-local-token sap-signing-proxy # SAP_EXTERNAL_SIGNER_AUTH_TOKEN=replace-with-local-token # SAP_EXTERNAL_SIGNER_TIMEOUT_MS=30000 # ============================================================================= # HTTP Transport Configuration (for hosted-api mode) # ============================================================================= SAP_ENABLE_HTTP=false SAP_HTTP_PORT=8787 SAP_HTTP_HOST=127.0.0.1 # SAP_HTTP_CORS_ORIGINS=https://app.example.com,https://admin.example.com # ============================================================================= # Hosted Remote Scaling & Backpressure # ============================================================================= # Redis should be enabled for clustered/PM2 multi-process hosted deployments. # It shares rate limits and payment usage ledger streams across workers. # SAP_MCP_USE_REDIS=true # SAP_MCP_REDIS_URL=redis://127.0.0.1:6379 # Stateful Streamable HTTP sessions. Idle sessions are closed automatically so # crawlers and abandoned agent sessions cannot exhaust memory. SAP_MCP_REMOTE_MAX_STATEFUL_SESSIONS=2000 SAP_MCP_REMOTE_SESSION_IDLE_TTL_MS=600000 SAP_MCP_REMOTE_SESSION_ABSOLUTE_TTL_MS=3600000 SAP_MCP_REMOTE_SESSION_CLEANUP_INTERVAL_MS=30000 # Global in-process backpressure for active MCP requests/streams. # Raise this with enough RAM/CPU and a reverse proxy connection budget. SAP_MCP_REMOTE_MAX_IN_FLIGHT_REQUESTS=1024 # Node HTTP tuning for reverse-proxied Streamable HTTP. SAP_MCP_REMOTE_REQUEST_TIMEOUT_MS=300000 SAP_MCP_REMOTE_HEADERS_TIMEOUT_MS=65000 SAP_MCP_REMOTE_KEEP_ALIVE_TIMEOUT_MS=75000 # 0 means unlimited requests per socket. SAP_MCP_REMOTE_MAX_REQUESTS_PER_SOCKET=0 # ============================================================================= # Hosted Provider Keys (server-side only) # ============================================================================= # Used only by the hosted SAP MCP gateway when serving protocol tools to users. # Never put provider keys in agent runtime configs, public metadata, or MCP snippets. # Use the API root. Product paths such as /swap/v1, /swap/v1/quote, /price/v3, # or /ultra/v1 are normalized by the gateway but should not be configured here. SAP_MCP_JUPITER_API_BASE_URL=https://api.jup.ag # SAP_MCP_JUPITER_TOKENS_API_BASE_URL=https://api.jup.ag # SAP_MCP_JUPITER_API_KEY=your-jupiter-api-key SAP_MCP_JUPITER_TIMEOUT_MS=30000 # Perps configuration. SAP MCP decodes Adrena Pool/Custody/Position accounts # from Solana RPC by default. Optional provider URLs can enrich market data or # build unsigned Solana transactions that are finalized locally with # sap_payments_finalize_transaction. Do not set a builder URL unless it returns # complete, verified, unsigned perps transactions for the exact venue. # SAP_MCP_PERPS_MARKETS_URL=https://your-provider.example/perps/markets # SAP_MCP_PERPS_POSITIONS_URL=https://your-provider.example/perps/positions # SAP_MCP_PERPS_BUILDER_URL=https://your-provider.example/perps/build-order # SAP_MCP_PERPS_API_KEY=your-perps-provider-key SAP_MCP_PERPS_ADRENA_PROGRAM_ID=13gDzEXCdocbj8iAiqrScGo47NiSuYENGsRqi3SEAwet SAP_MCP_PERPS_TIMEOUT_MS=8000 # ============================================================================= # Remote MCP Access Control # ============================================================================= # Public agent-facing deployments can be bearerless and rely on x402 for paid # tools plus rate limits/policy for free tools. Enterprise/private deployments # can still use api_key or jwt. # SAP_MCP_AUTH_TYPE=none # SAP_MCP_AUTH_TYPE=api_key # SAP_MCP_API_KEYS== # SAP_MCP_AUTH_TYPE=jwt # SAP_MCP_AUTH_SECRET= # ============================================================================= # Security & Spending Limits # ============================================================================= SAP_MAX_TX_VALUE_SOL=10 SAP_REQUIRE_APPROVAL_ABOVE_SOL=1 SAP_DAILY_LIMIT_SOL=100 # SAP_ALLOWED_TOOLS=all # SAP_ALLOWED_TOOLS=sap_get_agent,sap_list_agents,sap_get_reputation # ============================================================================= # Logging & Observability # ============================================================================= SAP_LOG_LEVEL=info SAP_LOG_FORMAT=pretty # SAP_LOG_FILE=/path/to/sap-mcp.log SAP_ENABLE_METRICS=false # SAP_METRICS_PORT=9090 # ============================================================================= # Advanced Configuration # ============================================================================= SAP_ENABLE_CACHE=true SAP_CACHE_TTL_SECONDS=300 SAP_ENABLE_RATE_LIMIT=true SAP_RATE_LIMIT_PER_MINUTE=60 # ============================================================================= # Hosted Remote Monetization (x402 v2 / pay.sh) # ============================================================================= # Applies only to hosted HTTP MCP traffic. Local stdio remains free. SAP_MCP_MONETIZATION_ENABLED=false SAP_MCP_MONETIZATION_PROVIDER=x402 # SAP_MCP_MONETIZATION_PAY_TO=YOUR_SOLANA_USDC_RECIPIENT # Optional CAIP-2 override. If omitted, derived from SAP_RPC_URL. # SAP_MCP_MONETIZATION_NETWORK=solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp # Required when monetization is enabled. Use OOBE hosted facilitator or a self-hosted sap-mcp-facilitator. # SAP_MCP_X402_FACILITATOR_URL= SAP_MCP_X402_MAX_TIMEOUT_SECONDS=120 # SAP_MCP_X402_FACILITATOR_AUTH_TOKEN= # Optional browser/manual checkout link included in 402 JSON responses. # SAP_MCP_PAY_SH_CHECKOUT_URL=https://pay.sh/checkout/YOUR_CHECKOUT_ID # Optional strict hosted marketplace mode. Keeps MCP handshake/discovery, # base profile, skills bootstrap, and local payment bridge helper tools free, # but charges basic balance and operational reads. SAP_MCP_MONETIZATION_STRICT_TOOLS=false # OOBE self-hosted x402 facilitator. # The facilitator signer is a dedicated fee-payer keypair used only to complete # and submit x402 SVM settlement transactions. It is NOT the payTo recipient, # NOT an SAP agent wallet, and NOT the Solana CLI default keypair. # Create it with: npx sap-mcp-facilitator init # Fund its public key with SOL on every configured network for transaction fees. SAP_MCP_FACILITATOR_HOST=127.0.0.1 SAP_MCP_FACILITATOR_PORT=1111 SAP_MCP_FACILITATOR_PATH_PREFIX=/facilitator SAP_MCP_FACILITATOR_NETWORKS=devnet # SAP_MCP_FACILITATOR_SIGNER_PATH=~/.config/mcp-sap/keypairs/oobe-x402-facilitator-keypair.json # SAP_MCP_FACILITATOR_RPC_URL=https://api.devnet.solana.com # Optional comma-separated RPC fallbacks. Keep API keys private and server-side. # The facilitator also appends the public Solana RPC for each configured network. # SAP_MCP_FACILITATOR_RPC_FALLBACK_URLS=https://api.devnet.solana.com # SAP_MCP_FACILITATOR_AUTH_TOKEN= # Hosted pricing: # Free: MCP handshake, schemas, bootstrap, repair/status, cost estimation, # local payment bridge control, memory/audit, transaction preview/finalize helpers. # Micro read: fresh exact data such as agent/profile reads, compact directory pages, # balance checks, SNS availability, single-asset prices, and lightweight trader context. # Read premium: broad discovery, enriched holdings/DAS, token lists, quotes/routes, history. # Builder: unsigned transaction builders and complex pre-execution preparation. # Value action: fixed fee for value-linked hosted operations; heavy paths use a lower heavy fixed fee. SAP_MCP_PRICE_MICRO_READ_USD=0.001 SAP_MCP_PRICE_READ_PREMIUM_USD=0.002 SAP_MCP_PRICE_BUILDER_USD=0.006 SAP_MCP_PRICE_VALUE_FIXED_USD=0.06 SAP_MCP_PRICE_HEAVY_VALUE_USD=0.035 SAP_MCP_PRICE_VALUE_BPS=0 SAP_MCP_PRICE_MIN_USD=0.001 SAP_MCP_PRICE_MAX_USD=100