Clash Control MCP
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CLASH_CONTROLLER_URL | No | URL of the Clash controller | http://127.0.0.1:9097 |
| CLASH_CONTROLLER_SECRET | Yes | Secret for the Clash controller | |
| CLASH_CONTROLLER_SOCKET | No | Optional Unix socket path for controller (auto-detected if not set) | |
| CLASH_VERGE_ADAPTER_TOKEN_FILE | No | Path to file containing the Adapter token (optional) |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| clash.capabilitiesA | Get environment capabilities. MUST be called before any write tools. Returns Mihomo/Verge detection, feature flags, and pending transactions. |
| clash.doctorB | Run comprehensive diagnostics: Mihomo connectivity, Verge detection, privileged service, TUN, system proxy. |
| clash.verge.detectA | Get Clash Verge Rev detection result: version, paths, config root, portable mode, compatibility. |
| clash.verge.get_settingsA | Read Clash Verge Rev network and runtime settings from verge.yaml. |
| clash.verge.get_directoriesA | Get Verge config directories: config root, profiles dir, executable path, unix socket. |
| clash.verge.get_active_profileA | Get the currently active Verge profile: uid, type, name, path, selected proxies. |
| clash.profiles.listC | List Verge profiles with summarized, paginated results. |
| clash.profiles.inspectB | Inspect a specific Verge profile by uid. Returns config keys and summary. |
| clash.config.get_effectiveA | Get Mihomo runtime effective config (from API /configs). Returns summary by default. Use "section" to get a specific config block (e.g. "dns", "tun"). |
| clash.config.get_generatedA | Get Verge generated config (clash-verge.yaml). This is a GENERATED file, NOT a persistent source. Returns summary by default. Use "section" for specific block. |
| clash.config.get_persistentA | Get persistent config sources summary: active profile, merge file, verge settings, and config chain. Does NOT return the generated clash-verge.yaml. Use clash.config.get_generated for that. |
| clash.config.auditA | Audit current configuration for issues with conditional recommendations. Each issue includes: current fact, potential impact, applicability condition. |
| clash.runtime.get_statusA | Get Mihomo runtime status: version, mode, ports, connections count, traffic totals. |
| clash.runtime.list_proxy_groupsA | List policy groups with summarized, paginated results. |
| clash.runtime.get_proxy_groupA | Read-only: get the safe, paginated candidate names, types, liveness, and recent delay history for one policy group. Does not expose proxy credentials. |
| clash.runtime.test_proxy_delayB | Test delay for a specific proxy with multiple samples. Returns median delay and jitter. Uses predefined test targets only (no arbitrary URL). Auto-allowed. |
| clash.runtime.select_proxyA | Switch proxy in a Selector group. With the verified Clash Verge Adapter, atomically synchronizes Mihomo runtime, Verge memory, profiles.yaml, GUI/tray refresh, and optional old-connection cleanup. Otherwise falls back to verified runtime-only switching. Light confirmation required. |
| clash.runtime.list_proxy_providersA | Read-only: list proxy Provider names and safe runtime summaries for use with refresh_proxy_provider. Subscription URLs and credentials are never returned. |
| clash.runtime.list_rule_providersA | Read-only: list rule Provider names and safe runtime summaries for use with refresh_rule_provider. Provider URLs and credentials are never returned. |
| clash.runtime.list_connectionsA | Read-only: list safe, paginated connection summaries including IDs for use with close_connection. IP addresses and local paths are redacted. |
| clash.runtime.refresh_proxy_providerA | Refresh a proxy provider by name. Per-provider lock prevents concurrent refresh. Light confirmation required. Does NOT modify persistent config. |
| clash.runtime.refresh_rule_providerA | Refresh a rule provider by name. Per-provider lock prevents concurrent refresh. Light confirmation required. Does NOT modify persistent config. |
| clash.runtime.close_connectionA | Close a specific connection by ID. Does NOT support closing all connections (that requires 强制确认 level). Light confirmation required. |
| clash.config.create_workspaceA | Create a config workspace for previewing and validating changes. Reads the merge file (or profile if no merge file exists) and records fingerprints. No files are written. Workspace auto-expires after 5 minutes. |
| clash.config.preview_changeA | Apply semantic changes to a workspace and generate a diff preview. Does NOT write to any file. Supports: set key, merge section (Strategic Merge), rule_add (fingerprint-based), rule_remove (fingerprint-based). |
| clash.config.validate_changeA | Validate a workspace's modified config. Checks YAML syntax, schema, ruleset fingerprint consistency, profile fingerprint consistency, and risk classification. Does NOT write to any file. |
| clash.config.apply_transactionA | Apply a validated workspace's changes to the persistent config file. Creates a snapshot, writes the file, attempts Mihomo reload, runs health checks, and auto-rolls back on failure. Light confirmation required (confirmed=true). |
| clash.config.rollbackA | Rollback a previously applied transaction. Restores the original config file from snapshot and attempts to reload Mihomo. Light confirmation required (confirmed=true). |
| clash.transaction.resumeB | Resume verification of a persisted PENDING_RESTART transaction after Verge has been restarted. Does not write configuration. |
| clash.recovery.statusA | Inspect durable transaction and recovery state. Read-only; does not modify manifests, snapshots, profiles, or runtime state. |
| clash.verge.set_unified_delayA | Set unified-delay through the authenticated native Clash Verge Adapter. Light confirmation required; returns COMMITTED only after persistence, runtime, GUI-refresh evidence, and applicable five-state verification succeed. |
| clash.verge.set_log_levelB | Set log-level in config.yaml (verge_clash_base owner). Light confirmation required. |
| clash.verge.set_ipv6A | Set ipv6 in config.yaml (verge_clash_base owner). Light confirmation required. |
| clash.verge.configure_tunA | Configure TUN section in config.yaml (verge_clash_base owner). Strong confirmation required (call first without confirmed to get nonce, then retry with nonce). System-level verification included. |
| clash.verge.configure_dns_overrideA | Configure the DNS kernel section in dns_config.yaml (verge_dns_base owner). Strong confirmation required (call first without confirmed to get nonce). DNS resolution verification included. |
| clash.verge.configure_portsA | Configure proxy ports in config.yaml (verge_clash_base owner). Strong confirmation required (call first without confirmed to get nonce). Port listening verification included. |
| clash.verge.configure_lan_accessA | Configure allow-lan in config.yaml (verge_clash_base owner). Strong confirmation required (call first without confirmed to get nonce). LAN binding risk assessment included. |
| clash.verge.set_auto_close_connectionA | Enable or disable Clash Verge auto-close connection through the authenticated local Adapter. Updates Verge memory and verge.yaml, emits a GUI refresh, and verifies both states. Light confirmation required. |
| clash.profiles.inspect_chainA | Inspect the active profile's full reference chain: profile, merge, script, rules, proxies, groups layers with per-layer fingerprints. Read-only. Script files are fingerprinted by raw content (not YAML-parsed). |
| clash.merge.inspectA | Inspect a Merge file by uid. Defaults to the active profile's merge reference. Returns DNS/TUN/rules summary, fingerprint, and paginated rules. Read-only. |
| clash.override.inspectA | Inspect the active profile's referenced Script/Override owner, or a specific script UID. The file path is resolved from profiles.yaml; script content is fingerprinted as raw bytes. Read-only. |
| clash.rules.inspectA | Inspect rules from profile, merge, rules layer, or runtime source. Returns ruleset fingerprint, paginated rules with per-rule fingerprints, and MATCH position. Read-only. source="rules" inspects the active profile's independent rules layer (Verge prepend/append/delete enhancement template); use "section" to select which part. For runtime rules use clash.config.get_effective with section="rules". |
| clash.profiles.refreshA | Refresh a remote subscription Profile through the authenticated local Clash Verge Adapter. Local profiles return NOT_APPLICABLE. Remote profiles require light confirmation. Capability remains fail-closed and returns BLOCKED when the Adapter is unavailable or unauthenticated. This is a Verge subscription refresh, not a Mihomo Provider refresh. |
| clash.profiles.activateA | Activate a Profile through Clash Verge itself. Strong two-step confirmation is required because this may change the active network configuration. First call with confirmed=false to receive a nonce, then retry with confirmed=true and confirmNonce. |
| clash.profiles.update_metadataA | Capability-gated update of non-sensitive Profile metadata through the authenticated native Clash Verge Adapter. Allowlist: name, update_interval, desc. Protected fields (uid, type, file, url, option, auth, token, secret) are NEVER modifiable. Two-phase: preview, then confirmed execution with the returned nonce. Fails closed when Adapter evidence is unavailable. |
| clash.merge.updateA | Capability-gated update of a Merge YAML owner with a strategic merge patch through the authenticated native Clash Verge Adapter. targetProfileUid can select an inactive Profile; the owner is resolved from that Profile's option.merge. Two-phase preview/nonce execution with optimistic fingerprint verification and compensation. |
| clash.override.updateA | Capability-gated update of a YAML Override owner through the authenticated native Clash Verge Adapter. JavaScript Script files (.js/.mjs) return NOT_SUPPORTED and are never parsed as YAML or modified by string replacement. Two-phase preview/nonce execution with optimistic fingerprint verification. |
| clash.rules.addA | Capability-gated rule addition to a section (prepend/append/delete) of the independent Rules owner through the authenticated native Clash Verge Adapter. Stable fingerprint anchors are used instead of line numbers; duplicates and drift are rejected. Two-phase preview/nonce execution. |
| clash.rules.removeA | Capability-gated rule removal by unique fingerprint from a section (prepend/append/delete) of the independent Rules owner through the authenticated native Clash Verge Adapter. Ambiguous matches and owner/ruleset drift are rejected. Two-phase preview/nonce execution. |
| clash.optimize.diagnose_networkA | v1.0-A: Read-only network diagnosis. Checks Controller, Adapter, active Profile, run mode, TUN, system proxy, listening ports, DNS, key proxy groups, connections, IPv6 capability, and basic connectivity. Returns a versioned report with facts, probes, findings, recommendations, and proposedActions. Does NOT modify any configuration. Uses predefined safe probe targets only (no arbitrary URL). |
| clash.optimize.dnsA | v1.0-B: Read-only DNS configuration diagnosis. Checks listen exposure, unreachable servers, IPv4/IPv6 contradiction, invalid fallback, Fake-IP filter, resolution path and timeout. Returns a versioned report with findings and proposedActions. Does NOT modify DNS configuration. DNS strategy recommendations are based on structural evidence only, not regional templates. |
| clash.optimize.rulesA | v1.0-B: Read-only rules configuration diagnosis. Checks duplicate rules, invalid proxy references, MATCH position, rule shadowing, and rule count. Returns a versioned report with findings and proposedActions. Does NOT modify rules. Static order analysis cannot prove real traffic hits; runtime verification is required. |
| clash.optimize.proxy_groupsA | v1.0-B: Read-only proxy groups diagnosis. Checks empty groups, invalid references, current selection validity, candidate coverage, strategy type, and failover capability. Returns a versioned report with findings and proposedActions. Does NOT modify proxy groups. Node names are not used to infer real geographic location or quality. |
| clash.optimize.health_checksA | v1.0-B: Read-only health-check configuration diagnosis. Checks test URL category, interval, timeout, concurrency, lazy mode, and Provider scale. Returns a versioned report with findings and proposedActions. Does NOT modify health-check configuration. Recommendations describe resource cost and timeliness trade-offs. |
| clash.optimize.openaiA | v1.0-C: Read-only OpenAI service network reachability diagnosis. Checks rule coverage for OpenAI-related domains, API endpoint reachability (without API Key, without calling billing endpoints), and Chat endpoint reachability. Reports failures layer-by-layer (DNS/TCP/TLS/HTTP/rule_match). Does NOT collect API Keys, call billing model endpoints, read chat history, or carry auth credentials. HTTP 401/403 is NOT classified as a network failure. |
| clash.optimize.githubA | v1.0-C: Read-only GitHub service network reachability diagnosis. Checks rule coverage for GitHub-related domains, and separately probes web (github.com), API metadata (api.github.com), and download (codeload.github.com) endpoints. Reports failures layer-by-layer (DNS/TCP/TLS/HTTP/rule_match). Does NOT carry GitHub Token, execute push/login/write operations, or read private repo content. |
| clash.optimize.youtubeA | v1.0-C: Read-only YouTube service network reachability diagnosis. Checks rule coverage for YouTube-related domains (including googlevideo.com, ytimg.com), and probes YouTube web and API endpoints. Reports failures layer-by-layer (DNS/TCP/TLS/HTTP/rule_match). Does NOT promise unlock, modify account state, read watch history, or carry login credentials. HTTP 401/403 is NOT classified as a network failure. |
| clash.optimize.streamingA | v1.0-C: Read-only streaming service network reachability diagnosis. Checks rule coverage for Netflix, Disney+, and Prime Video domains, and probes their web endpoints. Reports failures layer-by-layer (DNS/TCP/TLS/HTTP/rule_match). Does NOT promise unlock, bypass DRM, modify account state, or read watch history. DRM status and region restrictions are NOT classified as network failures. |
| clash.optimize.verify_baselineA | v1.0-D: Read-only baseline drift verification. Re-collects the current baseline fingerprint and compares it with the original baseline from diagnosis. Returns matched=true if unchanged, or matched=false with drift details if the active Profile, run mode, config chain, proxy group selections, DNS, TUN, system proxy, or ports have changed. Per v1.0-D protocol step 1: if drift is detected, re-diagnose instead of executing proposedActions. Does NOT modify any configuration. |
| clash.optimize.compare_probesA | v1.0-D: Read-only before/after probe comparison. Takes beforeProbes and afterProbes (same targets, same sample counts, same timeouts) and classifies the outcome as IMPROVED, NO_MATERIAL_CHANGE, REGRESSED, or INCONCLUSIVE. Detects critical regression (DNS/HTTP/TCP newly_failing) which requires immediate stop and rollback. Per v1.0-D: config write success alone does NOT constitute optimization success. Does NOT execute probes or modify configuration. |
| clash.optimize.execution_planA | v1.0-D: Read-only execution plan builder. Takes a baselineVerification result and a list of proposedActions, then checks each action against its own independent capability gate (per v1.0-D: no global optimizationWriteEnabled). Returns which actions are executable, which are blocked and why, and the 8-step execution protocol. Does NOT execute any action or modify configuration. |
| clash.verge.preferences.inspectA | v1.1-A: Read-only inspection of Clash Verge UI preferences (Basic / Theme / Layout / Hotkeys). Returns current values, defaults, schema metadata (risk, confirmation level, effectiveTiming), platform/version support, and validation errors. Reads from Adapter memory state (when authenticated) and verge.yaml. Does NOT require write capability and does NOT trigger GUI refresh, hotkey re-registration, or persistence. Sensitive fields (css_injection, WebDAV credentials, system proxy, TUN, DNS, ports, etc.) are explicitly excluded from the result. |
| clash.verge.preferences.set_basicA | v1.1-C: Modify Clash Verge Basic UI preferences (language, theme_mode, tray_event, env_type, start_page). Returns a structured Diff in preview mode; call with confirm=true to apply. Requires Adapter authentication and settings.verge-preferences-write capability. All values are validated against real Clash Verge 2.5.1 enums. tray_event is unsupported on Linux. env_type controls copy-env output format (IMMEDIATE, no restart). start_page uses real route paths with leading slash. |
| clash.verge.preferences.configure_themeA | v1.1-C: Modify Clash Verge Theme preferences (primary_color, secondary_color, primary_text, secondary_text, info_color, error_color, warning_color, success_color, font_family). Colors must be #RRGGBB or #RRGGBBAA hex strings; pass null for an allowlisted field to restore Verge's unset/default state. font_family rejects URLs, semicolons, braces, and control characters. css_injection and background image paths are NOT opened. Returns a structured Diff in preview mode; call with confirm=true to apply. Requires settings.verge-preferences-write capability. |
| clash.verge.preferences.configure_layoutA | v1.1-C: Modify Clash Verge Layout preferences (traffic_graph, enable_memory_usage, enable_group_icon, pause_render_traffic_stats_on_blur, collapse_navbar, menu_icon, notice_position, enable_hover_jump_navigator, menu_order). menu_order must be a non-duplicate subset of real nav paths (/, /proxies, /profile, /connections, /rules, /logs, /unlock, /settings). All fields are IMMEDIATE. Returns a structured Diff in preview mode; call with confirm=true to apply. Requires settings.verge-preferences-write capability. |
| clash.verge.preferences.configure_hotkeysA | v1.1-C: Modify Clash Verge hotkey mapping. Strong confirmation required (nonce-bound). First call (confirm=false) returns a preview with a nonce; second call (confirm=true with nonce) applies the change. Function names must be in the allowlist (open_or_close_dashboard, clash_mode_rule, clash_mode_global, clash_mode_direct, toggle_system_proxy, toggle_tun_mode, entry_lightweight_mode, reactivate_profiles). Accelerators must match Tauri syntax. System-reserved combos and duplicates are rejected. Requires settings.verge-hotkeys-write capability. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/huaqing0/clash-control-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server