Detailed explanation of apiserver.yaml configuration file
The configuration file supports environment variable injection using the ${VAR:default} syntax. If an environment variable is not set, the default value will be used.
A common practice is to inject values through different .env, .env.development, .env.prod files, though you can also directly modify the configuration with hardcoded values.
This configuration mainly targets the backend chat message storage configuration (of course, this can be stored in the same database as the proxy configuration), primarily used to store chat sessions and message data from the Web interface.
The chat message database is mainly used to store MCP chat records conducted through the Web interface, and is separate from the gateway proxy configuration storage.
This is used to store gateway proxy configurations, which corresponds to the configuration that maps from MCP to API.
Currently supports 2 storage methods:
disk storage
Configurations are stored on disk as files, with each configuration as a separate file, similar to nginx vhost concept, such as svc-a.yaml, svc-b.yaml
db storage
Store in database, with each configuration as a record. Currently supports three databases: SQLite3, PostgreSQL, MySQL
The revision_history_limit parameter controls the number of configuration version histories retained by the system, which helps with configuration rollback and auditing. The default is to retain 10 versions.
storage: type: "${GATEWAY_STORAGE_TYPE:db}" # Storage type: db, disk revision_history_limit: ${GATEWAY_STORAGE_REVISION_HISTORY_LIMIT:10} # Number of version histories to retain # Database configuration (used when type is 'db') database: type: "${GATEWAY_DB_TYPE:sqlite}" # Database type (sqlite, postgres, mysql) host: "${GATEWAY_DB_HOST:localhost}" # Database host address port: ${GATEWAY_DB_PORT:5432} # Database port user: "${GATEWAY_DB_USER:postgres}" # Database username password: "${GATEWAY_DB_PASSWORD:example}" # Database password dbname: "${GATEWAY_DB_NAME:./unla.db}" # Database name or file path sslmode: "${GATEWAY_DB_SSL_MODE:disable}" # SSL mode for database connection # Disk configuration (used when type is 'disk') disk: path: "${GATEWAY_STORAGE_DISK_PATH:}" # Data file storage path
The notification configuration module is mainly used to let mcp-gateway sense updates and perform hot reloading without restarting the service when configuration is updated.
notifier: role: "${APISERVER_NOTIFIER_ROLE:sender}" # Role: 'sender' or 'receiver' type: "${APISERVER_NOTIFIER_TYPE:signal}" # Type: 'signal', 'api', 'redis' or 'composite' # Signal configuration (used when type is 'signal') signal: signal: "${APISERVER_NOTIFIER_SIGNAL:SIGHUP}" # Signal to send pid: "${APISERVER_NOTIFIER_SIGNAL_PID:/var/run/mcp-gateway.pid}" # PID file path # API configuration (used when type is 'api') api: port: ${APISERVER_NOTIFIER_API_PORT:5235} # API port target_url: "${APISERVER_NOTIFIER_API_TARGET_URL:http://localhost:5235/_reload}" # Reload endpoint # Redis configuration (used when type is 'redis') redis: addr: "${APISERVER_NOTIFIER_REDIS_ADDR:localhost:6379}" # Redis address password: "${APISERVER_NOTIFIER_REDIS_PASSWORD:UseStrongPasswordIsAGoodPractice}" # Redis password db: ${APISERVER_NOTIFIER_REDIS_DB:0} # Redis database number topic: "${APISERVER_NOTIFIER_REDIS_TOPIC:mcp-gateway:reload}" # Redis publish/subscribe topic
Super administrator configuration is used to set up the system’s initial administrator account. Each time apiserver starts, it will automatically detect if it exists, and if not, it will be created automatically.
Copy
super_admin: username: "${SUPER_ADMIN_USERNAME:admin}" # Super administrator username password: "${SUPER_ADMIN_PASSWORD:changeme-please-use-a-secure-password}" # Super administrator password (please change in production)
Strongly recommend using strong passwords in production or public network environments!