mcpField
M
Mcp Server For 3x Ui

Mcp Server For 3x Ui

Local
github.com/pyworkloadCloud & Infra7Updated 2w ago

About Mcp Server For 3x Ui

Mcp Server For 3x Ui connects MCP clients to the 3x-ui proxy management panel. It exposes tools for managing Xray/V2Ray inbounds, clients, routing, services, and settings, with configurable tool groups and annotated effects.

Key features

  1. 01Expose 3x-ui panel API tools
  2. 02Manage inbounds, clients, and routing
  3. 03Support session/CSRF and bearer-token auth
  4. 04Annotate tool effects
  5. 05Load selected tool groups
  6. 06Provide linked resources for large payloads

Use cases

  1. 01Create or renew proxy clients in bulk
  2. 02Inspect and adjust routing rules
  3. 03Diagnose client connectivity and service status
  4. 04Manage settings across proxy nodes

MCP support

It exposes 3x-ui HTTP API operations as MCP tools and provides resources for deferred retrieval of bulky payloads. MCP clients can distinguish read-only from destructive tools through their effect annotations.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

3x-ui MCP Server

CI Release Downloads Go Version Go Reference License: MIT

MCP (Model Context Protocol) server for 3x-ui — an Xray/V2Ray proxy management panel. Exposes the 3x-ui HTTP API as MCP tools so LLMs can manage inbounds, clients, routing rules, Xray service, and server settings.

Contents

Features

  • The whole panel API — 169 tools across inbounds, clients, groups, hosts, nodes, routing, balancers, geodata, metrics, tokens and maintenance. Everything 3x-ui exposes except four file-transfer and node-sync routes (3x-ui v3.3.0+ — see Panel versions).
  • Two auth modes — session login with CSRF, or a Bearer API token (XUI_API_TOKEN), with transparent re-authentication and CSRF refresh when either goes stale.
  • Email-keyed clients — one client attaches to several inbounds; bulk create, adjust, enable and delete, plus server-side paging over large panels.
  • Annotated tools — every tool declares its effect, so an MCP client can tell a read-only call from a destructive one before running it.
  • Lazy by default — bulky payloads answer with a summary plus a resource_link, fetched only when something actually needs the document.
  • Context-budgeted — XUI_TOOLSETS loads only the tool groups you name, cutting what the schemas occupy in every session.
  • Agent skills included — seven procedures for the real jobs, verified against the Xray-core and 3x-ui sources (see Agent skills).
  • Stdio transport, and zero external dependencies beyond the MCP SDK.

Important

These tools drive a live proxy panel. The ones annotated destructive delete clients, zero traffic counters, or restart Xray and drop every connection — several act panel-wide with no undo. Give an agent an API token scoped to what it should reach, and take a backup before bulk operations.

Quick start

npx needs only Node 16+ — the package ships prebuilt binaries for Linux, macOS and Windows on x64 and arm64, so nothing is compiled and no Go toolchain is needed. With Go already installed, go run …@latest works just as well; see other ways to run it.

Claude Code
claude mcp add 3x-ui \
  --env XUI_HOST=http://localhost:2053 \
  --env XUI_USERNAME=admin \
  --env XUI_PASSWORD=your-password \
  -- npx -y @pyworkload/3x-ui-mcp
Claude Desktop / Cursor

Add to claude_desktop_config.json (Claude Desktop) or .cursor/mcp.json (Cursor):

{
  "mcpServers": {
    "3x-ui": {
      "command": "npx",
      "args": ["-y", "@pyworkload/3x-ui-mcp"],
      "env": {
        "XUI_HOST": "http://localhost:2053",
        "XUI_USERNAME": "admin",
        "XUI_PASSWORD": "your-password"
      }
    }
  }
}
VS Code

Add to .vscode/mcp.json:

{
  "servers": {
    "3x-ui": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@pyworkload/3x-ui-mcp"],
      "env": {
        "XUI_HOST": "http://localhost:2053",
        "XUI_USERNAME": "admin",
        "XUI_PASSWORD": "your-password"
      }
    }
  }
}
Other ways to run it

Swap command and args in any of the configs above:

Howcommandargs
Go toolchaingo["run", "github.com/pyworkload/3x-ui-mcp/cmd/xui-mcp@latest"]
Pre-built binary/path/to/xui-mcp—
Installed globallyxui-mcp—

go run …@latest compiles on first use and runs from cache afterwards. npm install -g @pyworkload/3x-ui-mcp puts xui-mcp on the PATH if you would rather not go through npx each time.

Example prompts

Once connected, ask your agent things like:

  • "Create 20 trial clients on inbound 3 with 10 GB and a 7-day expiry, and give me their subscription links."
  • "Which clients are past 90% of their quota? Extend them all by 30 days and 50 GB."
  • "Scan 104.16.0.0/24 for usable REALITY targets and put the fastest one on my VLESS inbound."
  • "Register a Warp account and route *.netflix.com through it."
  • "Nobody can connect — check the Xray logs, the panel logs, and when each client was last online."
  • "Which node is serving the most online clients right now, and how loaded is it?"
  • "Back up the database to Telegram, then run the panel self-update on every node."

Agent skills

skills/ holds seven procedures for the jobs people actually bring to a panel — they encode operating knowledge the tool schemas cannot carry: what order to do things in, and what the panel will not warn you about.

SkillCovers
reality-inboundChoosing and verifying a REALITY camouflage target, keys, shortIds, repairing a burnt inbound
diagnose-connectivityWhy a client cannot connect, cheapest cause first, with core error strings mapped to causes
panel-hardeningScoped tokens instead of admin passwords, rotation, fail2ban, cert pinning, backups
cdn-fallbackWebSocket/gRPC/xhttp behind a CDN, and sharing port 443 through fallbacks
client-lifecycleOnboarding, subscription links, bulk renewals, reports, cleanup
smart-routingSplit routing by domain and geo token, provider outbounds, verifying rules with test_route
multi-nodeAdding nodes, TLS trust modes and mTLS, selective sync, cluster monitoring
cp -r skills/* ~/.claude/skills/     # Claude Code, everywhere
cp -r skills/* .claude/skills/       # this project only

Configuration

VariableRequiredDescriptionExample
XUI_HOSTYesPanel URLhttp://localhost:2053
XUI_USERNAMEYes¹Admin usernameadmin
XUI_PASSWORDYes¹Admin passwordadmin
XUI_API_TOKENNoBearer API token. Bypasses CSRF for /panel/api/*eyJ…
XUI_TOOLSETSNoTool groups to expose (default: all)clients,metrics
XUI_BASE_PATHNoPanel base path (default: /)/xui/
XUI_LOG_LEVELNoLog level (default: info)debug, info, warn, error

¹ Provide either XUI_USERNAME+XUI_PASSWORD or XUI_API_TOKEN.

Auth modes (3x-ui protects the panel with CSRF and supports API tokens):

  • Session + CSRF (username/password): works for every tool. The client logs in, tracks the session CSRF token, and replays it on write requests, refreshing automatically when it goes stale.

  • Bearer API token (XUI_API_TOKEN): the token is sent on every request and the panel accepts it for /panel/api/* routes without CSRF — on v3.3.0+ that covers every tool here, settings and Xray templates included. Create a token in the panel under Settings → Security → API Token.

    Since v3.7.0 tokens are scoped and may carry an expiry, so give this server the admin scope. The other two do not fit it: monitor is a short allowlist of status and metrics routes (of the tools here only server_status and get_xray_versions fall inside it), and node-sync is a fixed allowlist for panel-to-node traffic. The plaintext token is shown once at creation — the panel keeps a SHA-256 hash. Also note that x-ui setting -getApiToken on the CLI now rotates a single shared cli-fallback token instead of minting a new one, so running it again invalidates a token you handed out earlier.

    Since v3.8.0 a token the panel refuses answers 401 instead of the 404 it used to be masked behind. The panel still checks the session afterwards, so if credentials are also configured the client logs in, retries and logs a warning that the token was refused; with the token alone, the call fails with an error naming it. A wrong XUI_BASE_PATH still 404s, so the two are now tellable apart.

Narrowing the toolset: all 169 tool schemas together occupy roughly 29k tokens of model context in every session — worth narrowing. XUI_TOOLSETS loads only the groups you need: inbounds, clients, server, xray, metrics, groups, geodata, hosts, nodes, tokens, providers, maintenance, or all. XUI_TOOLSETS=clients,metrics leaves 47 tools at about 7.5k tokens. An unknown name fails at startup rather than silently loading nothing.

Panel versions

Requires 3x-ui v3.3.0 or newer. That release moved the settings and Xray endpoints from /panel/setting/* and /panel/xray/* under /panel/api/ (upstream c6f15cd5, a documented breaking change), and this server targets the current layout.

On an older panel the inbound, client and server tools still work, but anything touching settings or the Xray template answers HTTP 404. For panels up to v3.2.8, use release v0.2.0 instead.

A few tools wrap endpoints that landed after v3.3.0 and answer 404 below the version listed:

ToolNeeds
get_balancers, set_balancer_override, test_routev3.3.1
scan_reality_target, scan_reality_targets, get_all_inbound_linksv3.4.2
Observability, client groups, bulk client state, inbound projections and fallbacksv3.5.0
Host groups, API tokens, client export/import, external links, Warp and NordVPNv3.5.0
Multi-node toolsv3.5.0
Maintenance, certificate helpers, cluster client views, test_outboundsv3.5.0
Geodata, HWID devices, get_clients_by_telegram_id, set_inbound_sub_sort_indexv3.7.0
Subscription balancers, PIA, reload_node_mtls_client, and token scope/expires_atv3.7.0
validate_regex, get_factory_defaults, get_panel_update_status, get_amneziawg_logsv3.7.0
preview_client_renewal, the reset_weekday client parameterv3.9.0
manage_warp action regMasque, MASQUE inboundsv3.10.0

The last two rows are bounded by the panel's own generated openapi.json, which only starts at v3.5.0 — some of those routes may predate it.

v3.8 added no routes. Its drift is in the JSON shape instead. Since v3.3.1 the panel emits an inbound's settings, streamSettings and sniffing as nested objects rather than the JSON-encoded strings older releases sent, and every release keeps adding columns to inbounds and clients. So this server no longer models either body as a struct: update_inbound and update_client read the current row into a map, drop only the fields the panel recomputes per request, and overlay the supplied parameters — anything a newer panel adds rides along untouched instead of being silently cleared on the next update. Riding along is not the same as being settable, so the client columns those releases added — the HWID limit, the per-client reset cycle, the VLESS reverse tag, and the MTProto, WireGuard and AmneziaWG peer settings — have parameters of their own on both add_client and update_client. The full list is in the xui://docs/client-fields resource.

v3.9.0 added one route — the renewal preview — and changed what an inbound update may touch: inbounds/update now keeps the stored client list and the inbound's enable flag whatever the body says, so update_inbound can no longer switch an inbound off or edit its clients. Use set_inbound_enable and the client tools for those; on older panels they were already the safer route. The same release added weekly quota renewal (reset_weekday, exclusive with reset and reset_day — update_client clears the mode being left), and refuses a private or loopback target in get_remote_cert_hash unless allow_private is set.

v3.10.0 added no routes — one new Warp action and one new protocol. manage_warp takes action=regMasque to register a Warp device over MASQUE; the panel stores nothing and answers with the private key, addresses and endpoint for a warp-masque outbound. MASQUE inbounds sign clients in with email and password: add_client without password lets the panel mint one, and the email must not contain :. The same release moved a client's WireGuard peer columns (private_key, public_key, pre_shared_key, allowed_ips, keep_alive) under the WireGuard/AmneziaWG inbound the client is on: on a client without one, update_client still succeeds but the panel keeps the stored values. Balancer overrides now survive routing reloads (not a core restart), and the panel refuses more configs Xray could not run — a Shadowsocks-2022 key of the wrong size, a mask password under 4 bytes, an unparsable report or LDAP cron. v3.10.2 changed no API.

Tested against v3.10.2, the current panel release (and before it v3.9.0 and v3.8.5). Every tool was exercised against a live panel: the reads, the writes, the node tools against a second panel registered as a node, and the outbound-subscription tools against a URL that really serves a list. Four need a configuration this server cannot conjure — test_smtp and test_telegram_bot want credentials, delete_client_device wants a device a client app registered, get_node_cert_fingerprint wants an HTTPS node — so those were confirmed to reach the panel and be answered by it, not to succeed. The read-modify-write contract is pinned by integration tests (make test-panel) that diff a whole inbound and a whole client across an update.

MCP Tools

Every tool is annotated with its effect on the panel — read-only, additive, destructive, or service-interrupting — and with whether it reaches a host outside the panel. MCP clients use those hints to auto-approve safe calls and to ask before the rest.

Inbound Management
15 tools — CRUD, enable toggle, traffic reset, fallbacks, bulk delete, links
ToolDescription
list_inboundsList all inbound connections
get_inboundGet inbound by ID
create_inboundCreate a new inbound
update_inboundUpdate an existing inbound
delete_inboundDelete an inbound
set_inbound_enableEnable/disable an inbound without rewriting its settings
reset_inbound_trafficZero one inbound's traffic counters
delete_all_inbound_clientsRemove every client from an inbound, keeping the inbound
bulk_delete_inboundsDelete several inbounds in one call
get_all_inbound_linksCounts the connection URLs and links to the full list (full=true inlines them)
list_inbounds_slimInbounds with client arrays trimmed — the cheap listing for large panels
get_inbound_optionsPicker projection: id, remark, tag, protocol, port, capability flags
get_inbound_fallbacksFallback rules on a master VLESS/Trojan TCP-TLS inbound
set_inbound_fallbacksReplace the whole fallback list (restarts Xray)
set_inbound_sub_sort_indexSet an inbound's position in subscription output
Client Management

Clients are email-keyed entities that can be attached to several inbounds at once.

41 tools — CRUD by email, attach/detach, bulk operations, traffic, devices, online state
ToolDescription
add_clientCreate a client and attach it to one or more inbounds (inbound_ids)
update_clientUpdate a client by email (only supplied fields change; UUID preserved)
delete_clientDelete a client by email (optional keep_traffic)
get_clientGet a client's full config and its inbound attachments, by email
list_clientsPaged, searchable, filterable client list
attach_clientAttach an existing client to more inbounds
detach_clientDetach a client from given inbounds
bulk_create_clientsCreate many clients across the same inbounds
bulk_delete_clientsDelete many clients by email
get_client_trafficGet client traffic stats by email
get_client_ipsGet IPs used by a client
clear_client_ipsClear recorded client IPs
reset_client_trafficReset traffic counters for a client by email
reset_all_trafficsReset all inbound traffic counters
reset_all_client_trafficsReset traffic for every client (panel-wide)
bulk_reset_trafficReset traffic for a specific set of clients
delete_depleted_clientsDelete clients with exhausted traffic/expired (panel-wide)
get_online_clientsList currently connected clients
get_last_onlineLast-online timestamp for every client
update_client_trafficSet specific upload/download byte counters for a client
get_subscription_linksConnection URLs served under a subscription ID, as JSON
get_client_linksConnection URLs for one client by email, one per inbound
get_happ_linkEncrypted happ://crypt5 link wrapping a client's subscription, for the Happ app
preview_client_renewalWhen a quota renewal schedule fires next, in the panel's time zone; saves nothing
get_clients_by_telegram_idFind clients by Telegram user ID
list_client_devicesHWID devices registered for a client
delete_client_deviceRemove one registered device, freeing an HWID slot
clear_client_devicesDrop every registered device for a client
bulk_enable_clientsEnable many clients, one rewrite per owning inbound
bulk_disable_clientsDisable many clients, one rewrite per owning inbound
bulk_adjust_clientsShift expiry and quota for many clients — the bulk renewal
delete_orphan_clientsDelete clients attached to no inbound, with their records
export_clientsCounts the clients and links to the full export (full=true inlines it)
import_clientsCreate clients from an exported array; existing emails are skipped
set_client_external_linksReplace a client's external links and subscriptions
list_clients_pagedServer-side filtering, sorting and paging over clients
bulk_attach_clientsAttach many clients to many inbounds at once
bulk_detach_clientsDetach many clients from many inbounds at once
get_active_inboundsInbound tags that carried traffic, grouped by node
get_online_clients_by_nodeOnline clients grouped by the node serving them
get_client_ips_by_nodePer-client source IPs grouped by the node that saw them
Server Management
14 tools — status, logs, Xray service control, key generation, REALITY scans
ToolDescription
server_statusGet server system status (CPU, RAM, disk, uptime)
restart_xrayRestart Xray service
stop_xrayStop Xray service
get_xray_configSummarizes the running Xray config and links to the full JSON (full=true inlines it)
get_xray_versionsList available Xray versions
install_xrayInstall a specific Xray version
get_logsGet panel service logs
get_xray_logsGet Xray core logs
get_settingsGet panel settings
get_default_xray_configGet default Xray configuration
restart_panelRestart the 3x-ui panel
generate_keyGenerate key material: UUID, X25519 (Reality), VLESS encryption, ML-KEM-768, ML-DSA-65
scan_reality_targetProbe one REALITY candidate and report whether it is usable
scan_reality_targetsProbe domains, IPs or CIDR ranges, ranked by feasibility and latency
Xray Configuration
21 tools — template, routing rules, outbounds, balancers, outbound subscriptions
ToolDescription
get_xray_templateSummarizes the template and links to the full JSON (full=true inlines it)
update_xray_templateUpdate Xray JSON template
get_routing_rulesList all routing rules (and the balancers they reference)
add_routing_ruleAdd a routing rule
remove_routing_ruleRemove a routing rule by index
update_routing_ruleUpdate a routing rule by index
get_outboundsList all outbounds
get_outbounds_trafficGet outbound traffic statistics
reset_outbound_trafficReset traffic for an outbound tag
test_outboundTest connectivity of an outbound
get_balancersBalancer definitions plus their live state in the running core
set_balancer_overridePin a balancer to one outbound, or release it back to its strategy
test_routeAsk the core which outbound it would pick for a synthetic connection
list_outbound_subsList outbound subscriptions — remote URLs supplying extra outbounds
preview_outbound_subParse a subscription URL without saving it
create_outbound_subAdd an outbound subscription
update_outbound_subUpdate a subscription (only supplied fields change)
refresh_outbound_subRe-fetch a subscription now and return its outbounds
move_outbound_subMove a subscription up/down in priority
delete_outbound_subDelete an outbound subscription
Host Groups

A host group publishes one or more inbounds under external addresses — a CDN hostname, a second port, a different SNI — and the panel renders subscription links against them. Groups are addressed by a string group_id.

11 tools — CRUD, ordering, bulk state
ToolDescription
list_hostsEvery host group across all inbounds
get_host_groupOne group by its ID
get_inbound_hostsThe groups attached to one inbound
list_host_tagsDistinct tags used across the groups
add_host_groupCreate a group over a set of inbounds
update_host_groupUpdate a group, keeping the fields you omit
delete_host_groupDelete a group and its hosts
set_host_group_enableEnable or disable one group
reorder_host_groupsSet the order groups appear in
bulk_delete_host_groupsDelete several groups at once
bulk_set_host_groups_enableFlip several groups at once

add_host_group and update_host_group expose the fields a group is normally built from; raw_json sends a complete HostGroup for the rest (mux, sockopt, ECH, final mask).

Subscription Balancers

Client-side balancers: each appears in the JSON subscription of every client on one of its inbounds, and the client app picks a server by the strategy. Not to be confused with get_balancers, which reports the routing balancers running inside Xray.

4 tools — CRUD in sort order
ToolDescription
list_sub_balancersEvery subscription balancer in sort order
create_sub_balancerAdd one over a set of inbounds
update_sub_balancerUpdate one, keeping the fields you omit
delete_sub_balancerRemove one
API Tokens
4 tools — mint, disable, delete
ToolDescription
list_api_tokensToken metadata; the values themselves are never returned
create_api_tokenMint a scoped token — the plaintext is shown only once
set_api_token_enabledDisable or re-enable a token without deleting it
delete_api_tokenDelete a token permanently

delete_api_token and set_api_token_enabled take the token's stored scope; the panel fails closed unless it matches, so a token cannot be flipped by guessing its ID.

Outbound Providers

Cloudflare Warp, NordVPN and PIA each get a read tool and a write tool, so querying a country list is annotated differently from erasing credentials.

6 tools — a read and a write tool per provider
ToolDescription
get_warp_dataWarp account state or the stored WireGuard config
manage_warpRegister (WireGuard or MASQUE), rotate the IP, apply a license, set rotation, or erase
get_nordvpn_dataCountries, servers in a country, or the stored account
manage_nordvpnRegister with a token, set a key, or erase
get_pia_dataRegions, servers in a region, or the stored account
manage_piaLog in, register a key against a server, or erase
Panel Maintenance
19 tools — health, certificates, geo files, self-update, backups, integration tests
ToolDescription
get_fail2ban_statusWhether per-client IP limits can be enforced on this host
get_web_cert_filesThis panel's own TLS certificate and key paths
get_cert_hashSHA-256 of a certificate, for pinning
get_remote_cert_hashSHA-256 of a remote server's live certificate
generate_ech_certAn ECH keypair and config list for one SNI
update_geofileDownload fresh GeoIP/GeoSite data files
get_panel_update_statusHow the last panel self-update ended
set_update_channelSwitch between the stable and dev channels
update_panelSelf-update the panel (it restarts)
get_amneziawg_logsLive AmneziaWG peer activity and events
get_node_descendantsThe nodes below this panel in the cluster tree
get_client_ips_tableThe aggregated client-IP table behind IP limits
backup_to_telegramSend a database backup to the admin Telegram chats
test_smtpTest SMTP with stage-by-stage reporting
test_telegram_botSend a test message through the configured bot
validate_regexCompile a pattern with the panel's Go RE2 engine
get_default_settingsPreview what a fresh install would compute
get_factory_defaultsThe shipped default per setting key
update_admin_credentialsChange the panel admin username and password

update_admin_credentials invalidates the credentials this server itself uses: update XUI_USERNAME / XUI_PASSWORD and restart it afterwards, or switch to an API token first.

Multi-Node

A node is another 3x-ui panel this one drives: inbounds and clients are pushed to it and its traffic is pulled back. Most of these calls reach the node itself, not just this panel.

16 tools — CRUD, probing, mTLS, node panel updates
ToolDescription
list_nodesConfigured nodes with health, counts and last heartbeat
get_nodeOne node's connection details and sync state
get_node_historyCPU or memory history for one node
get_node_web_certThe certificate and key paths that exist on the node
test_nodeProbe connection details without saving them
list_node_inboundsThe inbounds available on a node, for selective sync
get_node_cert_fingerprintSHA-256 of the node's leaf certificate, for pinning
add_nodeRegister a node (probed before it is saved)
update_nodeUpdate a node, keeping the fields you omit
set_node_enablePause or resume traffic sync with a node
probe_nodeProbe a registered node and refresh its cached health
delete_nodeDelete a node; its inbounds are not migrated
get_node_mtls_caThis panel's node-auth CA, minted on first call
set_node_mtls_trust_caThe CA this panel trusts when acting as a node
reload_node_mtls_clientApply a rotated client certificate without a restart
update_node_panelsRun the 3x-ui self-updater on the given nodes

The node API token is write-only from v3.6.0: the panel reports only whether one is set, so update_node omits it unless you pass a new one, and clear_api_token is how a node moved to mTLS drops the old token.

Client Groups

A group is a label carried both by the client record and by every owning inbound's settings; the panel keeps the two in step in one transaction.

8 tools — CRUD and bulk membership
ToolDescription
list_client_groupsEvery group with its member count, including empty ones
get_client_group_emailsEmails in one group — the input for a bulk action
create_client_groupCreate an empty, selectable group
rename_client_groupRename a group and repoint every member
delete_client_groupDrop a group, keeping its clients
add_clients_to_groupLabel many clients with one group
remove_clients_from_groupClear the group label on many clients
reset_client_group_trafficZero the group counter, leaving per-client counters running
Observability
6 tools — metric history, observatory, update check
ToolDescription
get_metrics_historyTime-series for one host metric (cpu, mem, netUp/Down, online, load)
get_xray_metricsXray runtime metrics state and current expvar values
get_xray_metrics_historyTime-series for one Xray runtime metric
get_xray_observatoryLatest per-outbound latency and health snapshot
get_xray_observatory_historyProbe results over time for one outbound tag
get_panel_update_infoWhether a newer 3x-ui release is out

The history tools take a bucket in seconds and always return 60 samples, so the bucket picks the window too: 2 (2m), 30 (30m), 60 (1h), 180 (3h), 360 (6h), 720 (12h), 1440 (24h), 2880 (2d), 10080 (7d).

Geodata
4 tools — browse geo databases, validate routing tokens
ToolDescription
list_geodata_filesGeo databases in Xray's asset folder, with layout and category count
list_geodata_categoriesCategories in one database, with entry counts and attributes
list_geodata_entriesThe rules inside a category — typed domains or CIDRs
validate_geodata_tokensReport routing tokens that do not resolve, with a reason

Deliberately not wrapped: server/getDb, server/getMigration and server/importDB move database files as attachments and multipart uploads rather than JSON, so they belong in a browser or a backup script, not here. inbounds/pushClientTraffics and POST server/clientIps are the inbound half of node sync — endpoints a node receives on, not ones a client calls.

Resources

Tools spend context on their results whether or not the caller needed all of it. Resources are the lazy half: each costs one line in resources/list and is read only when something asks for the URI. The three bulkiest tools answer with a summary plus a resource_link to the matching resource — a running Xray config is ~9k characters, and its summary is under 500.

URIContents
xui://docs/inbound-settingsThe settings, streamSettings and sniffing JSON, with an example per protocol
xui://docs/client-fieldsWhat each client field means and the units it uses
xui://xray/configThe config the core is running right now
xui://xray/templateThe saved template: routing, balancers, outbounds, DNS
xui://inboundsEvery inbound with settings and per-client stats
xui://inbounds/linksConnection URLs for every client
xui://clients/exportEvery client as {client, inboundIds}, credentials included
xui://inbound/{id}One inbound by numeric ID
xui://client/{email}One client record by email

The two xui://docs/… resources are static reference text, so reading them costs no panel call.

Architecture

cmd/xui-mcp/main.go        Entry point, config loading, signal handling
internal/config/            Configuration from environment variables
internal/xui/              HTTP client with session management
internal/handler/          MCP tool definitions and request handlers

Development

make test       # Run tests
make lint       # Run golangci-lint (config in .golangci.yml)
make fmt        # Format code
make build      # Build binary

Contributing

Bug reports, panel-version findings and pull requests are all welcome — see CONTRIBUTING.md for the setup, the checks CI runs, and the panel conventions a new tool has to follow. Participation is covered by the Code of Conduct; for a vulnerability, follow SECURITY.md rather than opening an issue. What changed in each release, including the tool counts and the panel versions they need, is in CHANGELOG.md.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.