Skip to Content
ReferencesArcade MCPPythonSettings

Settings

Global configuration and environment-driven settings.

find_env_file()

Python
arcade_mcp_server.settings.find_env_file( start_dir: Path | None = None, stop_at: Path | None = None, filename: str = ".env" ) -> Path | None

Find 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. The stop_at directory itself is still checked for the .env file.
  • filename - Name of the env file to find. Defaults to .env.

Returns: Path to the .env file if found, None otherwise.

Example:

Python
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

Python
arcade_mcp_server.settings.MCPSettings

Main settings container.

Bases: BaseSettings

from_env()

Python
from_env() classmethod

Create 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()

Python
to_dict()

Convert settings to dictionary.

tool_secrets()

Python
tool_secrets()

Get secrets.

Sub-settings

ServerSettings

Python
arcade_mcp_server.settings.ServerSettings

Server-related settings.

Bases: BaseSettings

MiddlewareSettings

Python
arcade_mcp_server.settings.MiddlewareSettings

Middleware-related settings.

Bases: BaseSettings

validate_log_level()

Python
validate_log_level(v) classmethod

Validate log level.

NotificationSettings

Python
arcade_mcp_server.settings.NotificationSettings

Notification-related settings.

Bases: BaseSettings

TransportSettings

Python
arcade_mcp_server.settings.TransportSettings

Transport-related settings.

Bases: BaseSettings

ArcadeSettings

Python
arcade_mcp_server.settings.ArcadeSettings

Arcade-specific settings.

Bases: BaseSettings

ToolEnvironmentSettings

Python
arcade_mcp_server.settings.ToolEnvironmentSettings

environment 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()

Python
model_post_init(__context)

Populate tool_environment from process env if not provided.

Examples

Basic configuration

Python
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

Python
from arcade_mcp_server.settings import MCPSettings # Values like ARCADE_MCP_DEBUG, ARCADE_MCP_HTTP_PORT, etc. are parsed settings = MCPSettings()
Last updated on

Settings | Arcade Docs