Settings
Global configuration and environment-driven settings.
find_env_file()
arcade_mcp_server.settings.find_env_file(
start_dir: Path | None = None,
stop_at: Path | None = None,
filename: str = ".env"
) -> Path | NoneFind a .env file by traversing upward through parent directories.
Starts at the specified directory (or current working directory) and traverses upward through parent directories until a .env file is found or the filesystem root (or stop_at directory) is reached.
Parameters:
start_dir- Directory to start searching from. Defaults to current working directory.stop_at- Directory to stop traversal at (inclusive). If specified, the search will not continue past this directory. Thestop_atdirectory itself is still checked for the.envfile.filename- Name of the env file to find. Defaults to.env.
Returns: Path to the .env file if found, None otherwise.
Example:
from arcade_mcp_server.settings import find_env_file
# Find .env starting from current directory
env_path = find_env_file()
# Find .env starting from a specific directory
env_path = find_env_file(start_dir=Path("/path/to/project/src"))
# Find .env but don't search above project root
env_path = find_env_file(stop_at=Path("/path/to/project"))MCPSettings
arcade_mcp_server.settings.MCPSettingsMain settings container.
Bases: BaseSettings
from_env()
from_env() classmethodCreate settings from environment variables.
Automatically discovers and loads a .env file by traversing upward from the current directory through parent directories until a .env file is found or the filesystem root is reached.
The .env file is loaded with override=False, meaning existing environment variables take precedence. Multiple calls are safe.
to_dict()
to_dict()Convert settings to dictionary.
tool_secrets()
tool_secrets()Get secrets.
Sub-settings
ServerSettings
arcade_mcp_server.settings.ServerSettingsServer-related settings.
Bases: BaseSettings
MiddlewareSettings
arcade_mcp_server.settings.MiddlewareSettingsMiddleware-related settings.
Bases: BaseSettings
validate_log_level()
validate_log_level(v) classmethodValidate log level.
NotificationSettings
arcade_mcp_server.settings.NotificationSettingsNotification-related settings.
Bases: BaseSettings
TransportSettings
arcade_mcp_server.settings.TransportSettingsTransport-related settings.
Bases: BaseSettings
ArcadeSettings
arcade_mcp_server.settings.ArcadeSettingsArcade-specific settings.
Bases: BaseSettings
ToolEnvironmentSettings
arcade_mcp_server.settings.ToolEnvironmentSettingsenvironment settings.
Bases: BaseSettings
Every environment variable that is not prefixed with one of the prefixes for the other settings will be added to the environment as an available tool secret in the ToolContext.
model_post_init()
model_post_init(__context)Populate tool_environment from process env if not provided.
Examples
Basic configuration
from arcade_mcp_server.settings import MCPSettings
settings = MCPSettings(
debug=True,
middleware=MCPSettings.middleware.__class__(
enable_logging=True,
mask_error_details=False,
),
server=MCPSettings.server.__class__(
title="My MCP Server",
instructions="Use responsibly",
),
transport=MCPSettings.transport.__class__(
http_host="0.0.0.0",
http_port=8000,
),
)Loading from environment
from arcade_mcp_server.settings import MCPSettings
# Values like ARCADE_MCP_DEBUG, ARCADE_MCP_HTTP_PORT, etc. are parsed
settings = MCPSettings()