Documentation
¶
Overview ¶
Package config provides configuration management for HostMCP. It handles loading, parsing, and validating configuration from YAML files.
configパッケージはHostMCPの設定管理を提供します。 YAMLファイルからの設定の読み込み、解析、検証を処理します。
Configuration is loaded from an explicitly specified path only. Use "hostmcp serve --workspace DIR" to derive {DIR}/.sandbox/config/hostmcp.yaml, or "hostmcp serve --config PATH" to specify the config file directly. Run "hostmcp init --workspace DIR" to generate a config from the built-in template.
設定は明示的に指定されたパスからのみ読み込まれます。 {DIR}/.sandbox/config/hostmcp.yaml を導出するには "hostmcp serve --workspace DIR" を使用し、 設定ファイルを直接指定するには "hostmcp serve --config PATH" を使用してください。 テンプレートから設定を生成するには "hostmcp init --workspace DIR" を実行してください。
Index ¶
- type AuditConfig
- type AuditEvents
- type AuditRotationConfig
- type AutoImportConfig
- type BlockedPathsConfig
- type CLIConfig
- type ClaudeCodeSettingsConfig
- type Config
- type CurrentContainerConfig
- type ExecDangerouslyConfig
- type GeminiSettingsConfig
- type HostAccessConfig
- type HostCommandsConfig
- type HostCommandsDangerously
- type HostPathMaskingConfig
- type HostToolsConfig
- type LoggingConfig
- type OutputMaskingConfig
- type OutputMaskingTargets
- type SecurityConfig
- type SecurityPermissions
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditConfig ¶
type AuditConfig struct {
// Enabled activates audit logging.
// Enabledは監査ログを有効化します。
Enabled bool `yaml:"enabled"`
// File is the path to write audit logs. Required when Enabled is true.
// Supports "~/" prefix for home directory expansion.
//
// Fileは監査ログを書き込むパスです。Enabled が true のとき必須です。
// "~/"プレフィックスでホームディレクトリ展開をサポートします。
File string `yaml:"file"`
// Rotation controls log file rotation on server startup.
// Rotationはサーバー起動時のログファイルローテーションを制御します。
Rotation AuditRotationConfig `yaml:"rotation"`
// Events specifies which events to log.
// Eventsはログ記録するイベントを指定します。
Events AuditEvents `yaml:"events"`
}
AuditConfig holds audit logging configuration. Audit logs provide security monitoring by recording all tool executions, access denials, and security-relevant events.
AuditConfigは監査ログ設定を保持します。 監査ログは、すべてのツール実行、アクセス拒否、セキュリティ関連イベントを 記録することでセキュリティ監視を提供します。
type AuditEvents ¶
type AuditEvents struct {
// ToolCalls logs all MCP tool invocations (exec_command, get_logs, etc.)
// ToolCallsはすべてのMCPツール呼び出しをログ記録します(exec_command、get_logs等)
ToolCalls bool `yaml:"tool_calls"`
// AccessDenied logs all permission/access denials (blocked paths, disallowed commands)
// AccessDeniedはすべての権限/アクセス拒否をログ記録します(ブロックパス、不許可コマンド)
AccessDenied bool `yaml:"access_denied"`
// ClientConnections logs client connect/disconnect events
// ClientConnectionsはクライアント接続/切断イベントをログ記録します
ClientConnections bool `yaml:"client_connections"`
// SecurityPolicy logs when security policy is queried
// SecurityPolicyはセキュリティポリシーが照会された時をログ記録します
SecurityPolicy bool `yaml:"security_policy"`
}
AuditEvents specifies which event types to include in audit logs. AuditEventsは監査ログに含めるイベントタイプを指定します。
type AuditRotationConfig ¶ added in v0.4.0
type AuditRotationConfig struct {
// Keep is the number of old log files to retain (e.g., audit.log.1, .2, .3).
// Set to 0 to disable rotation.
//
// Keepは保持する古いログファイルの数です(例: audit.log.1, .2, .3)。
// 0に設定するとローテーションを無効にします。
Keep int `yaml:"keep"`
}
AuditRotationConfig controls audit log rotation behavior. AuditRotationConfigは監査ログのローテーション動作を制御します。
type AutoImportConfig ¶
type AutoImportConfig struct {
// Enabled activates auto-import feature.
// EnabledはAutoImport機能を有効化します。
Enabled bool `yaml:"enabled"`
// WorkspaceRoot is the root directory to scan for configuration files.
// Default: current directory (".")
//
// WorkspaceRootは設定ファイルをスキャンするルートディレクトリです。
// デフォルト: カレントディレクトリ (".")
WorkspaceRoot string `yaml:"workspace_root"`
// ScanFiles is a list of files to scan for blocked path configurations.
// These are typically Docker Compose files that define volume mounts.
//
// ScanFilesはブロックパス設定をスキャンするファイルのリストです。
// 通常、ボリュームマウントを定義するDocker Composeファイルです。
ScanFiles []string `yaml:"scan_files"`
// GlobalPatterns are file patterns that are blocked in all containers.
// These are applied globally regardless of container-specific settings.
// Examples: ".env", "*.key", "*.pem", "secrets/*"
//
// GlobalPatternsはすべてのコンテナでブロックされるファイルパターンです。
// コンテナ固有の設定に関係なくグローバルに適用されます。
// 例: ".env", "*.key", "*.pem", "secrets/*"
GlobalPatterns []string `yaml:"global_patterns"`
// ClaudeCodeSettings configures import from Claude Code configuration files.
// ClaudeCodeSettingsはClaude Code設定ファイルからのインポートを設定します。
ClaudeCodeSettings ClaudeCodeSettingsConfig `yaml:"claude_code_settings"`
// GeminiSettings configures import from Gemini Code Assist configuration files.
// GeminiSettingsはGemini Code Assist設定ファイルからのインポートを設定します。
GeminiSettings GeminiSettingsConfig `yaml:"gemini_settings"`
}
AutoImportConfig holds settings for auto-importing blocked paths from DevContainer configs. This feature automatically detects which files are hidden from AI in DevContainer and applies the same restrictions in HostMCP.
AutoImportConfigはDevContainer設定からブロックパスを自動インポートする設定を保持します。 この機能はDevContainerでAIから隠されているファイルを自動検出し、 同じ制限をHostMCPに適用します。
type BlockedPathsConfig ¶
type BlockedPathsConfig struct {
// Manual is a map of container name to list of blocked paths.
// Paths can be exact matches or glob patterns.
// Example: {"api": ["/app/secrets/*", "/app/.env"]}
//
// Manualはコンテナ名からブロックパスリストへのマップです。
// パスは完全一致またはglobパターンが使用できます。
// 例: {"api": ["/app/secrets/*", "/app/.env"]}
Manual map[string][]string `yaml:"manual"`
// AutoImport configures automatic detection of blocked paths from DevContainer configs.
// AutoImportはDevContainer設定からのブロックパス自動検出を設定します。
AutoImport AutoImportConfig `yaml:"auto_import"`
}
BlockedPathsConfig holds configuration for blocked file paths. This prevents AI from reading sensitive files like secrets and credentials.
BlockedPathsConfigはブロックされるファイルパスの設定を保持します。 これによりAIがシークレットや認証情報などの機密ファイルを読むことを防ぎます。
type CLIConfig ¶
type CLIConfig struct {
// CurrentContainer configures the "current container" feature for CLI commands.
// CurrentContainerはCLIコマンドの「カレントコンテナ」機能を設定します。
CurrentContainer CurrentContainerConfig `yaml:"current_container"`
}
CLIConfig holds CLI-specific configuration for human convenience features. These features are designed for human users on the host OS, not for AI assistants. AI assistants should use MCP tools with explicit parameters instead.
CLIConfigはユーザーの利便性のためのCLI固有の設定を保持します。 これらの機能はホストOS上のユーザー向けであり、AIアシスタント向けではありません。 AIアシスタントは代わりに明示的なパラメータを持つMCPツールを使用すべきです。
type ClaudeCodeSettingsConfig ¶
type ClaudeCodeSettingsConfig struct {
// Enabled activates import from Claude Code settings.
// EnabledはClaude Code設定からのインポートを有効化します。
Enabled bool `yaml:"enabled"`
// MaxDepth controls how deep to scan for settings files.
// 0 = workspace_root only
// 1 = one level deep
// 2 = two levels deep
//
// MaxDepthは設定ファイルをスキャンする深さを制御します。
// 0 = workspace_root のみ
// 1 = 1階層下まで
// 2 = 2階層下まで
MaxDepth int `yaml:"max_depth"`
// SettingsFiles lists the Claude Code settings files to scan.
// Paths are relative to workspace root or subdirectories.
// Default: [".claude/settings.json", ".claude/settings.local.json"]
//
// SettingsFilesはスキャンするClaude Code設定ファイルをリストします。
// パスはワークスペースルートまたはサブディレクトリからの相対パスです。
// デフォルト: [".claude/settings.json", ".claude/settings.local.json"]
SettingsFiles []string `yaml:"settings_files"`
}
ClaudeCodeSettingsConfig holds settings for importing blocked paths from Claude Code settings. Claude Code can have its own list of files to ignore, which can be imported here.
ClaudeCodeSettingsConfigはClaude Code設定からブロックパスをインポートする設定を保持します。 Claude Codeは独自の無視ファイルリストを持つことができ、ここでインポートできます。
type Config ¶
type Config struct {
// Server contains HTTP server settings (port, host)
// Serverはサーバー設定を含みます(ポート、ホスト)
Server ServerConfig `yaml:"server"`
// Security contains access control and permission settings
// Securityはアクセス制御と権限の設定を含みます
Security SecurityConfig `yaml:"security"`
// Logging contains log output settings
// Loggingはログ出力の設定を含みます
Logging LoggingConfig `yaml:"logging"`
// Audit contains audit logging settings for security monitoring
// Auditはセキュリティ監視のための監査ログ設定を含みます
Audit AuditConfig `yaml:"audit"`
// CLI contains CLI-specific settings for human convenience features
// CLIはユーザーの利便性のためのCLI固有の設定を含みます
CLI CLIConfig `yaml:"cli"`
// HostAccess contains settings for host OS access features (tools and commands).
// HostAccessはホストOSアクセス機能(ツールとコマンド)の設定を含みます。
HostAccess HostAccessConfig `yaml:"host_access"`
}
Config represents the complete application configuration. It contains all settings needed to run the HostMCP server.
Configはアプリケーション全体の設定を表します。 HostMCPサーバーを実行するために必要なすべての設定を含みます。
func Load ¶
Load loads configuration from a file. If configPath is empty, default configuration is returned without reading any file. (The serve command always provides a non-empty path; empty-path behavior is intentional for testing and programmatic use.)
Loadはファイルから設定を読み込みます。 configPathが空の場合はファイルを読まずデフォルト設定を返します。 (serve コマンドは常に非空のパスを渡します。空パスはテストやプログラム利用のために意図的に許可しています。)
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig returns a Config with sensible default values. These defaults provide a balance between security and usability.
NewDefaultConfigは適切なデフォルト値を持つConfigを返します。 これらのデフォルトはセキュリティと使いやすさのバランスを提供します。
func (*Config) GetAddress ¶
GetAddress returns the complete server address in "host:port" format. This is used when starting the HTTP server.
GetAddressは"host:port"形式の完全なサーバーアドレスを返します。 これはHTTPサーバーを起動する際に使用されます。
type CurrentContainerConfig ¶
type CurrentContainerConfig struct {
// Enabled controls whether the current container feature is active.
// Default: true (recommended for sandbox environments)
//
// When enabled:
// - `hostmcp use <container>` sets the current container
// - `hostmcp logs` uses the current container if no argument is provided
// - `hostmcp exec <command>` uses the current container
//
// When disabled:
// - `hostmcp use` commands return an error
// - `hostmcp logs` requires explicit container argument
// - `hostmcp exec` requires explicit container argument
//
// Set to false in environments where AI might directly use CLI commands
// (e.g., non-sandboxed environments) to prevent unintended behavior.
//
// Enabledはカレントコンテナ機能が有効かどうかを制御します。
// デフォルト: true(サンドボックス環境で推奨)
//
// 有効な場合:
// - `hostmcp use <container>` でカレントコンテナを設定
// - `hostmcp logs` は引数がない場合カレントコンテナを使用
// - `hostmcp exec <command>` はカレントコンテナを使用
//
// 無効な場合:
// - `hostmcp use` コマンドはエラーを返す
// - `hostmcp logs` は明示的なコンテナ引数が必要
// - `hostmcp exec` は明示的なコンテナ引数が必要
//
// AIがCLIコマンドを直接使用する可能性がある環境(例:サンドボックスなし)では
// 予期しない動作を防ぐためにfalseに設定してください。
Enabled bool `yaml:"enabled"`
}
CurrentContainerConfig configures the current container feature. This allows users to set a default container for CLI commands like logs, stats, exec.
CurrentContainerConfigはカレントコンテナ機能を設定します。 これによりユーザーはlogs、stats、execなどのCLIコマンドのデフォルトコンテナを設定できます。
Design philosophy: - AI (MCP/client): Uses explicit parameters, no convenience features needed - Human (direct commands): Uses convenience features for better UX
設計思想: - AI (MCP/client): 明示的なパラメータを使用、利便性機能は不要 - 人 (直接コマンド): より良いUXのために利便性機能を使用
type ExecDangerouslyConfig ¶
type ExecDangerouslyConfig struct {
// Enabled activates dangerous mode feature.
// When false, the dangerously parameter in exec_command is ignored.
// Enabledは危険モード機能を有効化します。
// falseの場合、exec_commandのdangerouslyパラメータは無視されます。
Enabled bool `yaml:"enabled"`
// Commands defines which base commands are allowed in dangerous mode per container.
// Key: container name (use "*" for default/all containers)
// Value: list of allowed command names (without arguments)
// Only the base command name is checked; file paths are validated against blocked_paths.
//
// Example:
// commands:
// "securenote-api":
// - "tail"
// - "cat"
// "*":
// - "tail"
//
// Commandsは危険モードで許可されるベースコマンドをコンテナごとに定義します。
// キー: コンテナ名("*"でデフォルト/全コンテナ)
// 値: 許可されるコマンド名のリスト(引数なし)
// ベースコマンド名のみチェックされ、ファイルパスはblocked_pathsに対して検証されます。
Commands map[string][]string `yaml:"commands"`
}
ExecDangerouslyConfig configures the dangerous mode for exec_command. This allows execution of file inspection commands (tail, grep, cat, etc.) that are not in the whitelist, while still enforcing blocked_paths restrictions.
ExecDangerouslyConfigはexec_commandの危険モードを設定します。 ホワイトリストにないファイル検査コマンド(tail、grep、cat等)の実行を許可しますが、 blocked_pathsの制限は引き続き適用されます。
type GeminiSettingsConfig ¶
type GeminiSettingsConfig struct {
// Enabled activates import from Gemini settings files.
// EnabledはGemini設定ファイルからのインポートを有効化します。
Enabled bool `yaml:"enabled"`
// MaxDepth controls how deep to scan for settings files.
// 0 = workspace_root only
// 1 = one level deep
// 2 = two levels deep
//
// MaxDepthは設定ファイルをスキャンする深さを制御します。
// 0 = workspace_root のみ
// 1 = 1階層下まで
// 2 = 2階層下まで
MaxDepth int `yaml:"max_depth"`
// SettingsFiles lists the Gemini exclusion files to scan.
// These use gitignore-style syntax.
// Default: [".aiexclude", ".geminiignore"]
//
// SettingsFilesはスキャンするGemini除外ファイルをリストします。
// これらはgitignore形式の構文を使用します。
// デフォルト: [".aiexclude", ".geminiignore"]
SettingsFiles []string `yaml:"settings_files"`
}
GeminiSettingsConfig holds settings for importing blocked paths from Gemini Code Assist. Gemini uses .aiexclude and .geminiignore files with gitignore-style syntax.
GeminiSettingsConfigはGemini Code Assistからブロックパスをインポートする設定を保持します。 Geminiはgitignore形式の.aiexcludeと.geminiignoreファイルを使用します。
type HostAccessConfig ¶
type HostAccessConfig struct {
// WorkspaceRoot is the host-side workspace root directory.
// Used as the working directory for host commands and tool discovery base.
// Can be overridden by the --workspace CLI flag.
//
// WorkspaceRootはホスト側のワークスペースルートディレクトリです。
// ホストコマンドの作業ディレクトリおよびツール検出の基点として使用されます。
// --workspace CLIフラグで上書きできます。
WorkspaceRoot string `yaml:"workspace_root"`
// HostTools configures auto-discovery and execution of host-side tools.
// HostToolsはホスト側ツールの自動検出と実行を設定します。
HostTools HostToolsConfig `yaml:"host_tools"`
// HostCommands configures whitelisted host CLI command execution.
// HostCommandsはホワイトリスト方式のホストCLIコマンド実行を設定します。
HostCommands HostCommandsConfig `yaml:"host_commands"`
}
HostAccessConfig contains settings for host OS access features. This allows AI assistants to execute tools and commands on the host OS through HostMCP, with security controls.
HostAccessConfigはホストOSアクセス機能の設定を含みます。 これによりAIアシスタントがHostMCPを通じてホストOS上のツールやコマンドを セキュリティ制御付きで実行できるようになります。
type HostCommandsConfig ¶
type HostCommandsConfig struct {
// Enabled activates the host commands feature.
// Enabledはホストコマンド機能を有効化します。
Enabled bool `yaml:"enabled"`
// Whitelist defines allowed commands and their argument patterns.
// Key: base command name (e.g., "git"), Value: allowed argument patterns.
// Note: "docker" and "docker-compose" are always rejected even if listed here.
//
// Whitelistは許可されるコマンドとその引数パターンを定義します。
// キー: ベースコマンド名(例: "git")、値: 許可される引数パターン。
// 注意: "docker"/"docker-compose"はここに記載されていても常に拒否されます。
Whitelist map[string][]string `yaml:"whitelist"`
// Deny defines commands that are explicitly denied (overrides whitelist).
// Key: base command name, Value: denied argument patterns.
//
// Denyは明示的に拒否されるコマンドを定義します(ホワイトリストを上書き)。
// キー: ベースコマンド名、値: 拒否される引数パターン。
Deny map[string][]string `yaml:"deny"`
// Dangerously configures the dangerous mode for host commands.
// Dangerouslyはホストコマンドの危険モードを設定します。
Dangerously HostCommandsDangerously `yaml:"dangerously"`
}
HostCommandsConfig configures whitelisted host CLI command execution. Commands are matched against whitelist patterns, with optional deny list and dangerous mode for elevated operations.
Note: docker and docker-compose commands are always rejected regardless of whitelist. Use MCP tools (get_logs, get_stats, etc.) for monitoring, or host_tools for lifecycle ops.
HostCommandsConfigはホワイトリスト方式のホストCLIコマンド実行を設定します。 コマンドはホワイトリストパターンに対してマッチされ、オプションの拒否リストと 昇格された操作用の危険モードがあります。
注意: docker/docker-composeコマンドはホワイトリストに関わらず常に拒否されます。 監視にはMCPツール(get_logs、get_stats等)、ライフサイクル操作にはhost_toolsを使用してください。
type HostCommandsDangerously ¶
type HostCommandsDangerously struct {
// Enabled activates dangerous mode for host commands.
// Enabledはホストコマンドの危険モードを有効化します。
Enabled bool `yaml:"enabled"`
// Commands defines which commands are allowed in dangerous mode.
// Key: base command name, Value: allowed subcommands.
//
// Commandsは危険モードで許可されるコマンドを定義します。
// キー: ベースコマンド名、値: 許可されるサブコマンド。
Commands map[string][]string `yaml:"commands"`
}
HostCommandsDangerously configures dangerous mode for host commands. When enabled, additional commands can be executed with the dangerously=true parameter.
HostCommandsDangerouslyはホストコマンドの危険モードを設定します。 有効にすると、dangerously=trueパラメータで追加のコマンドを実行できます。
type HostPathMaskingConfig ¶
type HostPathMaskingConfig struct {
// Enabled activates host path masking in MCP tool output.
// Default: true (recommended for security)
// EnabledはMCPツール出力でのホストパスマスキングを有効化します。
// デフォルト: true(セキュリティのため推奨)
Enabled bool `yaml:"enabled"`
// Replacement is the string used to replace the home directory portion.
// Default: "[HOST_PATH]"
// Example: "/Users/john/workspace/project" → "[HOST_PATH]/workspace/project"
//
// Replacementはホームディレクトリ部分を置き換える文字列です。
// デフォルト: "[HOST_PATH]"
// 例: "/Users/john/workspace/project" → "[HOST_PATH]/workspace/project"
Replacement string `yaml:"replacement"`
}
HostPathMaskingConfig configures masking of host OS paths in MCP tool output. This prevents AI assistants from seeing the host OS username and directory structure. Only applies to MCP tool output; CLI commands show full paths for human users.
HostPathMaskingConfigはMCPツール出力でのホストOSパスのマスキングを設定します。 これによりAIアシスタントがホストOSのユーザー名やディレクトリ構造を見ることを防ぎます。 MCPツール出力にのみ適用され、CLIコマンドは人間のユーザー向けにフルパスを表示します。
type HostToolsConfig ¶
type HostToolsConfig struct {
// Enabled activates the host tools feature.
// Enabledはホストツール機能を有効化します。
Enabled bool `yaml:"enabled"`
// Directories lists directories to scan for tools (relative to workspace_root).
// In legacy mode (ApprovedDir empty): tools are executed directly from these directories.
// In secure mode (ApprovedDir set): this field is ignored (use StagingDirs instead).
//
// Directoriesはツールをスキャンするディレクトリのリストです(workspace_rootからの相対パス)。
// レガシーモード(ApprovedDir空): これらのディレクトリから直接ツールを実行します。
// セキュアモード(ApprovedDir設定済み): このフィールドは無視されます(代わりにStagingDirsを使用)。
Directories []string `yaml:"directories"`
// ApprovedDir is the directory where approved tools are stored.
// When set, enables secure mode: only tools in this directory are executed.
// Supports ~ for home directory (e.g., "~/.hostmcp/host-tools").
// Tools are organized per-project: <approved_dir>/<project-id>/
//
// ApprovedDirは承認済みツールが格納されるディレクトリです。
// 設定すると、セキュアモードが有効になります: このディレクトリ内のツールのみ実行されます。
// ホームディレクトリの~をサポートします(例: "~/.hostmcp/host-tools")。
// ツールはプロジェクトごとに整理されます: <approved_dir>/<project-id>/
ApprovedDir string `yaml:"approved_dir"`
// StagingDirs lists directories where new tools are proposed (relative to workspace_root).
// Used with `hostmcp serve --sync` or `hostmcp tools sync` to copy tools to ApprovedDir
// after user confirmation.
//
// StagingDirsは新しいツールが提案されるディレクトリのリストです(workspace_rootからの相対パス)。
// `hostmcp serve --sync`または`hostmcp tools sync`で、ユーザー確認後にApprovedDirにツールをコピーします。
StagingDirs []string `yaml:"staging_dirs"`
// Common enables loading tools from the _common subdirectory of ApprovedDir.
// Common tools are shared across all workspaces/projects.
//
// CommonはApprovedDirの_commonサブディレクトリからのツール読み込みを有効にします。
// 共通ツールはすべてのワークスペース/プロジェクトで共有されます。
Common bool `yaml:"common"`
// AllowedExtensions lists file extensions that are recognized as tools.
// AllowedExtensionsはツールとして認識されるファイル拡張子のリストです。
AllowedExtensions []string `yaml:"allowed_extensions"`
// Timeout is the maximum execution time in seconds for tool execution.
// Timeoutはツール実行の最大実行時間(秒)です。
Timeout int `yaml:"timeout"`
// MaxOutputBytes is the maximum output size in bytes before saving to a file.
// When output exceeds this limit, it is saved to LargeOutputDir and the AI
// receives a message with the file path and a preview instead of the full output.
// Set to 0 to disable (always return output directly). Default: 102400 (100KB).
//
// MaxOutputBytesは出力をファイルに保存する前の最大出力サイズ(バイト)です。
// 出力がこの上限を超えると、LargeOutputDirに保存され、AIには
// ファイルパスとプレビューを含むメッセージが返されます。
// 0に設定すると無効(常に出力を直接返す)。デフォルト: 102400 (100KB)。
MaxOutputBytes int64 `yaml:"max_output_bytes"`
// LargeOutputDir is the directory (relative to workspace_root) where large
// tool outputs are saved when they exceed MaxOutputBytes.
// Default: ".sandbox/tmp".
//
// LargeOutputDirはMaxOutputBytesを超えた大きなツール出力が保存される
// ディレクトリです(workspace_rootからの相対パス)。
// デフォルト: ".sandbox/tmp"。
LargeOutputDir string `yaml:"large_output_dir"`
}
HostToolsConfig configures auto-discovery and execution of host-side tools. Tools are scripts or programs placed in specific directories that are automatically discovered and exposed as MCP tools.
Two modes are supported:
- Legacy mode: Tools are executed directly from Directories (when ApprovedDir is empty)
- Secure mode: Tools must be approved (synced) to ApprovedDir before execution
HostToolsConfigはホスト側ツールの自動検出と実行を設定します。 ツールは特定のディレクトリに配置されたスクリプトやプログラムで、 自動的に検出されMCPツールとして公開されます。
2つのモードをサポートします:
- レガシーモード: Directoriesから直接ツールを実行(ApprovedDirが空の場合)
- セキュアモード: 実行前にツールをApprovedDirに承認(同期)する必要があります
func (*HostToolsConfig) IsSecureMode ¶
func (c *HostToolsConfig) IsSecureMode() bool
IsSecureMode returns true if the secure mode is configured (ApprovedDir is set). IsSecureModeはセキュアモードが設定されている場合(ApprovedDirが設定済み)にtrueを返します。
type LoggingConfig ¶
type LoggingConfig struct {
// Level sets the minimum log level to output.
// Valid values: "debug", "info", "warn", "error"
//
// Levelは出力する最小ログレベルを設定します。
// 有効な値: "debug", "info", "warn", "error"
Level string `yaml:"level"`
}
LoggingConfig holds logging configuration. Controls how HostMCP outputs logs.
Note: Log output destination is configured via command-line flags:
--log-file /path/to/file.log --log-also-stdout
LoggingConfigはロギング設定を保持します。 HostMCPがログを出力する方法を制御します。
注意: ログ出力先はコマンドラインフラグで設定します:
--log-file /path/to/file.log --log-also-stdout
type OutputMaskingConfig ¶
type OutputMaskingConfig struct {
// Enabled activates output masking globally.
// EnabledはOutputMasking機能をグローバルに有効化します。
Enabled bool `yaml:"enabled"`
// Replacement is the string used to replace sensitive data.
// Default: "[MASKED]"
// Replacementは機密データを置き換える文字列です。
// デフォルト: "[MASKED]"
Replacement string `yaml:"replacement"`
// Patterns is a list of regex patterns to match sensitive data.
// Each pattern will be replaced with the Replacement string.
// Patternsは機密データにマッチする正規表現パターンのリストです。
// 各パターンはReplacement文字列に置き換えられます。
Patterns []string `yaml:"patterns"`
// ApplyTo specifies which outputs to apply masking to.
// ApplyToはマスキングを適用する出力を指定します。
ApplyTo OutputMaskingTargets `yaml:"apply_to"`
}
OutputMaskingConfig configures masking of sensitive data in output. Sensitive information like passwords, API keys, and tokens are replaced with a masked string before being returned to the AI assistant.
OutputMaskingConfigは出力内の機密データのマスキングを設定します。 パスワード、APIキー、トークンなどの機密情報は、 AIアシスタントに返される前にマスク文字列に置き換えられます。
type OutputMaskingTargets ¶
type OutputMaskingTargets struct {
// Logs applies masking to get_logs and search_logs output.
// Logsはget_logsとsearch_logsの出力にマスキングを適用します。
Logs bool `yaml:"logs"`
// Exec applies masking to exec_command output.
// Execはexec_commandの出力にマスキングを適用します。
Exec bool `yaml:"exec"`
// Inspect applies masking to inspect_container output (env vars).
// Inspectはinspect_containerの出力(環境変数)にマスキングを適用します。
Inspect bool `yaml:"inspect"`
}
OutputMaskingTargets specifies which tool outputs should be masked. OutputMaskingTargetsはマスキングを適用するツール出力を指定します。
type SecurityConfig ¶
type SecurityConfig struct {
// Mode determines the overall security strictness.
// Valid values: "strict", "moderate", "permissive"
// - strict: Only explicitly allowed containers and commands
// - moderate: Balanced security with sensible defaults
// - permissive: Less restrictive, more access allowed
//
// Modeは全体的なセキュリティの厳格さを決定します。
// 有効な値: "strict", "moderate", "permissive"
// - strict: 明示的に許可されたコンテナとコマンドのみ
// - moderate: 適切なデフォルトでバランスの取れたセキュリティ
// - permissive: 制限が少なく、より多くのアクセスを許可
Mode string `yaml:"mode"`
// AllowedContainers is a list of container name patterns that can be accessed.
// Supports glob patterns (e.g., "myapp-*", "prod-api-?").
// Empty list means all containers are accessible (in moderate/permissive mode).
//
// AllowedContainersはアクセス可能なコンテナ名パターンのリストです。
// globパターンをサポートします(例: "myapp-*", "prod-api-?")。
// 空のリストはすべてのコンテナにアクセス可能を意味します(moderate/permissiveモード)。
AllowedContainers []string `yaml:"allowed_containers"`
// ExecWhitelist defines which commands can be executed in each container.
// Key: container name, Value: list of allowed commands.
// Example: {"api": ["npm test", "npm run lint"]}
//
// ExecWhitelistは各コンテナで実行可能なコマンドを定義します。
// キー: コンテナ名、値: 許可されたコマンドのリスト。
// 例: {"api": ["npm test", "npm run lint"]}
ExecWhitelist map[string][]string `yaml:"exec_whitelist"`
// Permissions defines which operations are globally allowed.
// Permissionsはグローバルに許可される操作を定義します。
Permissions SecurityPermissions `yaml:"permissions"`
// BlockedPaths configures which file paths are blocked from access.
// BlockedPathsはアクセスをブロックするファイルパスを設定します。
BlockedPaths BlockedPathsConfig `yaml:"blocked_paths"`
// OutputMasking configures masking of sensitive data in command output.
// This applies to logs, exec results, and container inspection.
// OutputMaskingはコマンド出力内の機密データのマスキングを設定します。
// これはログ、exec結果、コンテナ検査に適用されます。
OutputMasking OutputMaskingConfig `yaml:"output_masking"`
// ExecDangerously configures dangerous mode for exec_command.
// When enabled, allows execution of commands like tail, grep, cat with
// file path validation against blocked_paths.
// ExecDangerouslyはexec_commandの危険モードを設定します。
// 有効にすると、tail、grep、catなどのコマンドを
// blocked_pathsに対するファイルパス検証付きで実行できます。
ExecDangerously ExecDangerouslyConfig `yaml:"exec_dangerously"`
// HostPathMasking configures masking of host OS paths in MCP tool output.
// This hides the host OS username and directory structure from AI assistants.
// HostPathMaskingはMCPツール出力でのホストOSパスのマスキングを設定します。
// これによりAIアシスタントからホストOSのユーザー名やディレクトリ構造を隠します。
HostPathMasking HostPathMaskingConfig `yaml:"host_path_masking"`
}
SecurityConfig holds security-related configuration. This is the core of HostMCP's access control system.
SecurityConfigはセキュリティ関連の設定を保持します。 これはHostMCPのアクセス制御システムの中核です。
type SecurityPermissions ¶
type SecurityPermissions struct {
// Logs allows reading container logs via get_logs tool.
// Logsはget_logsツールによるコンテナログの読み取りを許可します。
Logs bool `yaml:"logs"`
// Inspect allows getting container details via inspect_container tool.
// Inspectはinspect_containerツールによるコンテナ詳細の取得を許可します。
Inspect bool `yaml:"inspect"`
// Stats allows getting container resource statistics via get_stats tool.
// Statsはget_statsツールによるコンテナリソース統計の取得を許可します。
Stats bool `yaml:"stats"`
// Exec allows executing commands in containers via exec_command tool.
// Even when enabled, only whitelisted commands are allowed.
//
// Execはexec_commandツールによるコンテナ内でのコマンド実行を許可します。
// 有効な場合でも、ホワイトリストに登録されたコマンドのみが許可されます。
Exec bool `yaml:"exec"`
// Lifecycle allows starting, stopping, and restarting containers via
// start_container, stop_container, and restart_container tools.
// Uses Docker API directly (no shell execution) for zero injection risk.
// Default: false (safe by default - only read operations allowed).
//
// Lifecycleはstart_container、stop_container、restart_containerツールによる
// コンテナの起動、停止、再起動を許可します。
// Docker APIを直接使用(シェル実行なし)するため、インジェクションリスクはゼロです。
// デフォルト: false(安全なデフォルト - 読み取り操作のみ許可)。
Lifecycle bool `yaml:"lifecycle"`
}
SecurityPermissions defines what operations are allowed globally. These are high-level toggles for entire categories of operations.
SecurityPermissionsはグローバルに許可される操作を定義します。 これらは操作カテゴリ全体に対する高レベルのトグルです。
type ServerConfig ¶
type ServerConfig struct {
// Port is the TCP port to listen on (default: 18080)
// Portは待ち受けるTCPポートです(デフォルト: 18080)
Port int `yaml:"port"`
// Host is the network interface to bind to (default: "0.0.0.0" = all interfaces)
// Hostはバインドするネットワークインターフェースです(デフォルト: "0.0.0.0" = 全インターフェース)
Host string `yaml:"host"`
}
ServerConfig holds server-related configuration. These settings control how the MCP server listens for connections.
ServerConfigはサーバー関連の設定を保持します。 これらの設定はMCPサーバーが接続を待ち受ける方法を制御します。