xray-mcp-monitor
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@xray-mcp-monitor check subscription https://mysub.link"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Xray MCP Monitor
xray-mcp-monitor is an MCP server for checking the reachability of nodes inside an Xray subscription.
It accepts an http or https subscription URL, parses common node formats, runs scheduled TCP probes against each matched node, and exposes the whole workflow through MCP tools.
Features
Fetches Xray subscriptions from
httpandhttpsURLsParses raw URI lists and common base64-encoded subscription payloads
Supports
vmess,vless,trojan,ss,socks,http, andhttpsRecognizes
hy2,hysteria,hysteria2, andtuic, but marks them unsupported for probingRuns a background scheduler for recurring checks
Persists monitor definitions and latest results to a local JSON state file
Exposes both one-off checks and long-running monitors through MCP tools
Works over
stdio,streamable-http, andsse
Related MCP server: domain-mcp
How It Works
A client calls
register_subscription_monitororcheck_subscription_once.The server fetches the subscription payload from the provided URL.
The payload is parsed into Xray nodes.
Each matched TCP node is checked with a direct
host:portTCP connection.The result is returned to the MCP client, and scheduled monitors are stored in local state.
Limits
This is a TCP reachability probe, not a full proxy or handshake validation.
UDP-style protocols are currently not actively checked.
Monitor state is local to the process and stored in a JSON file.
interval_secondsmust be at least10.timeout_secondsmust be greater than0.
Requirements
Python
>=3.10mcp[cli] >=1.27,<2
Install
Using pip:
python3 -m venv .venv
./.venv/bin/pip install -e .Using uv:
uv syncRun The Server
Stdio transport:
./.venv/bin/python -m xray_mcp_monitor.serverStreamable HTTP transport:
./.venv/bin/python -m xray_mcp_monitor.server --transport streamable-httpSSE transport:
./.venv/bin/python -m xray_mcp_monitor.server --transport sseYou can also use the installed console script:
./.venv/bin/xray-mcp-monitorManage scheduled checks without Codex:
./.venv/bin/xray-mcp-monitor-cli --helpRun the web dashboard:
./.venv/bin/xray-mcp-monitor-web --helpEnvironment Variables
export XRAY_MCP_TRANSPORT=stdio
export XRAY_MCP_HOST=127.0.0.1
export XRAY_MCP_PORT=8000
export XRAY_MCP_STATE_FILE=./xray_watch_state.jsonXRAY_MCP_TRANSPORT: default transport when--transportis omittedXRAY_MCP_HOST: bind host for network transportsXRAY_MCP_PORT: bind port for network transportsXRAY_MCP_STATE_FILE: path to the persistent watch state JSON file
Run Without Codex
If you want the scheduler to keep running without an interactive Codex session, use the bundled CLI manager instead of the MCP transport.
Register a scheduled watch:
./.venv/bin/xray-mcp-monitor-cli \
--state-file /root/xray-mcp/.codex/xray_watch_state.json \
register "https://example.com/subscription" \
--interval-seconds 300 \
--timeout-seconds 5 \
--node-name-keyword hkList stored watches:
./.venv/bin/xray-mcp-monitor-cli \
--state-file /root/xray-mcp/.codex/xray_watch_state.json \
listRun the background scheduler as a long-lived process:
XRAY_MCP_STATE_FILE=/root/xray-mcp/.codex/xray_watch_state.json \
./.venv/bin/python -m xray_mcp_monitor.cli daemonYou can also use:
./.venv/bin/python -m xray_mcp_monitor cli listThe scheduler state is persisted in XRAY_MCP_STATE_FILE, so the daemon reloads existing watches on startup.
Web Dashboard
The project now includes a built-in local dashboard for creating and managing monitors in a browser.
Start it locally:
XRAY_MCP_STATE_FILE=/root/xray-mcp/.codex/xray_watch_state.json \
./.venv/bin/xray-mcp-monitor-web --host 127.0.0.1 --port 8080Then open:
http://127.0.0.1:8080The dashboard supports:
creating scheduled monitors
running one-off checks
listing current monitor health
enabling or disabling monitors
running a monitor immediately
removing monitors
If you prefer the module form:
./.venv/bin/python -m xray_mcp_monitor web --host 127.0.0.1 --port 8080systemd Service
This repository includes a sample unit at deploy/systemd/xray-mcp-monitor.service.
Recommended install flow:
sudo mkdir -p /opt/xray-mcp /var/lib/xray-mcp-monitor
sudo cp -r /root/xray-mcp /opt/xray-mcp
cd /opt/xray-mcp
python3 -m venv .venv
./.venv/bin/pip install -e .
sudo cp deploy/systemd/xray-mcp-monitor.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now xray-mcp-monitorAfter that:
sudo systemctl status xray-mcp-monitor
journalctl -u xray-mcp-monitor -fBefore enabling the service, edit the unit file paths if your checkout is not under /opt/xray-mcp.
systemd Web Service
A separate sample unit is included at deploy/systemd/xray-mcp-monitor-web.service.
Install it with:
sudo cp deploy/systemd/xray-mcp-monitor-web.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now xray-mcp-monitor-webCheck logs with:
sudo systemctl status xray-mcp-monitor-web
journalctl -u xray-mcp-monitor-web -fIf you expose it beyond localhost, put it behind a reverse proxy or a firewall. The current dashboard does not include authentication.
MCP Tools
register_subscription_monitor
Create a scheduled monitor and immediately run the first check.
Parameters:
subscription_url: strinterval_seconds: int = 300timeout_seconds: float = 5.0node_name_keyword: str | None = None
check_subscription_once
Fetch a subscription and run a one-time check without storing a monitor.
Parameters:
subscription_url: strtimeout_seconds: float = 5.0node_name_keyword: str | None = None
list_subscription_monitors
List all registered monitors.
get_subscription_monitor
Return one stored monitor and its latest result.
Parameters:
watch_id: str
run_monitor_now
Run a stored monitor immediately.
Parameters:
watch_id: str
set_monitor_enabled
Enable or disable a stored monitor.
Parameters:
watch_id: strenabled: bool
remove_subscription_monitor
Remove a stored monitor.
Parameters:
watch_id: str
Status Values
Watch-level statuses:
error: fetching the subscription failedempty: no nodes were foundno_match: nodes were parsed, but none matchednode_name_keywordhealthy: all matched nodes were reachablehealthy_with_warnings: all matched nodes were reachable, but some non-fatal parse warnings were recordeddegraded: some matched nodes were reachable and some were unreachablepartial: some matched nodes were reachable and some were unsupportedunsupported: all matched nodes were unsupported for probingdown: no matched nodes were reachable
Node-level statuses:
reachableunreachableunsupported
Example Tool Call
Input:
{
"subscription_url": "https://example.com/path/to/subscription",
"interval_seconds": 300,
"timeout_seconds": 5,
"node_name_keyword": "hk"
}Useful response fields:
watch.watch_id: stable ID for later operationswatch.last_result: latest stored result for a scheduled monitorresult.status: current overall health stateresult.nodes: per-node reachability, latency, and error detailsresult.errors: parse or fetch warnings
Codex Integration
This repository already includes a project-scoped Codex MCP config at .codex/config.toml.
If you want to configure it manually, use:
[mcp_servers.xray_monitor]
command = "/path/to/xray-mcp/.venv/bin/python"
args = ["-m", "xray_mcp_monitor.server"]
cwd = "/path/to/xray-mcp"
startup_timeout_sec = 15
tool_timeout_sec = 120
enabled = true
[mcp_servers.xray_monitor.env]
XRAY_MCP_STATE_FILE = "/path/to/xray-mcp/.codex/xray_watch_state.json"If you use the checked-in .codex/config.toml, update the paths if this repository is not located at /root/xray-mcp.
Then start Codex in this project:
codex -C /path/to/xray-mcpInside Codex, use /mcp to verify that xray_monitor is connected.
Claude Desktop Style Config
{
"mcpServers": {
"xray-monitor": {
"command": "/path/to/xray-mcp/.venv/bin/python",
"args": ["-m", "xray_mcp_monitor.server"],
"cwd": "/path/to/xray-mcp"
}
}
}Development
Run tests:
./.venv/bin/python -m unittest discover -s testsUseful local checks:
./.venv/bin/python -m xray_mcp_monitor.server --help
codex -C /path/to/xray-mcp mcp list
codex -C /path/to/xray-mcp mcp get xray_monitorAvailable Tools
7 toolscheck_subscription_onceB
Fetch a subscription URL and run a one-time connectivity check.
Inputs: subscription_url (required), timeout_seconds, node_name_keyword. Returns: object
get_subscription_monitorA
Get a monitor by watch ID, including the latest stored result.
Inputs: watch_id (required). Returns: object
list_subscription_monitorsB
List all registered scheduled monitors.
Inputs: no named parameters. Returns: object
register_subscription_monitorA
Create a scheduled connectivity monitor for an Xray subscription URL.
Inputs: subscription_url (required), timeout_seconds, interval_seconds, node_name_keyword. Returns: object
remove_subscription_monitorC
Remove a scheduled monitor.
Inputs: watch_id (required). Returns: object
run_monitor_nowC
Run a monitor immediately.
Inputs: watch_id (required). Returns: object
set_monitor_enabledC
Enable or disable a scheduled monitor.
Inputs: enabled (required), watch_id (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct operation: creation, one-time check, listing, retrieval, manual run, enable/disable, and deletion. While run_monitor_now and check_subscription_once both perform connectivity checks, the former applies to an existing monitor while the latter is standalone, and descriptions clearly disambiguate them.
All tool names follow a consistent verb_noun pattern using snake_case, with clear verbs such as register, check, list, get, run, set, and remove. The naming is uniform and predictable.
Seven tools is well-scoped for a monitoring server, covering the full lifecycle without redundancy. Each tool serves a clear purpose and the count is neither too sparse nor overwhelming.
The tool set covers the full CRUD lifecycle (register, list/get, remove, set_enabled) plus a one-time check and manual run. The only notable gap is the lack of an update tool for modifying a monitor's subscription URL or schedule, but this is a minor limitation that can be worked around by removing and re-registering.
Related MCP Connectors
Health checks for public MCP servers: status, latency, tools, and uptime.
Directory of remote MCP servers with daily measured reachability, tools and changes.
MCP server for Uptrack uptime monitoring. Manage monitors and incidents from AI agents.
Live status and 30-day reliability of public MCP servers, from independent hourly probes.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceRead-only MCP server that monitors a Bitcoin Core full node via JSON-RPC, providing tools to check node status, network info, mempool, and peer information.MIT
- AlicenseAqualityCmaintenanceMCP server for checking domain name availability via RDAP and WHOIS fallback, supporting single and bulk domain lookups.51MIT
- MIT
- AlicenseAqualityFmaintenanceMCP server for monitoring health of MCP servers, GitHub Actions, GitLab pipelines, and HTTP endpoints with health history, TLS expiry, assertions, diagnostics, and alerts.2297 npm2MIT