Skip to main content
Glama

marzban-mcp

An MCP server that lets AI agents manage a Marzban panel — built on marzban-sdk.

Users, subscriptions, nodes, and the core config — through Claude, Cursor, or any MCP-compatible client.

npm version npm downloads Docker image license

Documentation · Client Setup · Tools


Point an AI agent at your panel and it can actually run it — not just read about it. No custom integration code, just an entry in your MCP config.

Install

npm install -g marzban-mcp

You don't usually need to install it yourself — your MCP client runs it via npx (see below). Prefer a container? A multi-arch image is published at ilmar7786/marzban-mcp:

docker pull ilmar7786/marzban-mcp

Related MCP server: io.github.antonio-mello-ai/mcp-pfsense

Quick start

Add it to your client's MCP config with your panel's URL and an admin login. Every client reads roughly the same shape:

{
  "mcpServers": {
    "marzban": {
      "command": "npx",
      "args": ["-y", "marzban-mcp"],
      "env": {
        "MARZBAN_BASE_URL": "https://panel.example.com",
        "MARZBAN_USERNAME": "admin",
        "MARZBAN_PASSWORD": "secret"
      }
    }
  }
}

Claude Desktop, Claude Code, Cursor and other MCP clients all read the same mcpServers block — just from a different config file. Restart the client and the tools below become available.

Features

  • 🔒 Env-only credentials — the panel URL, username and password are never accepted as a tool argument, so a compromised or confused model can't redirect the server elsewhere.

  • 🎯 Profile-gated tools — a tool outside the active profile never appears in tools/list at all, not just hidden behind a hint.

  • ✅ Confirmation on every destructive call — the first call only describes the consequences and returns a one-time token; nothing runs until a human-approved second call repeats it, and confirming one call never authorizes a different target or a wider version of the same call.

  • 🔁 A retried destructive call doesn't run twice — an identical repeat within 5 minutes returns the recorded result of the first one instead of restarting the core again; a call whose outcome was never observed says so plainly rather than guessing.

  • 🙈 Credentials masked by default — proxies, subscription_url and links stay hidden unless you explicitly opt in.

  • 🧭 21 tools, 3 prompts — full user lifecycle, config, hosts, nodes, system stats and subscriptions, plus ready-made investigations that chain several tools together.

  • 🛠️ Built on marzban-sdk — the same auth, retry and reconnect behavior as the SDK itself, just exposed as MCP tools.

Configuration

Variable

Required

Description

MARZBAN_BASE_URL

Yes

Your panel's URL, e.g. https://panel.example.com

MARZBAN_USERNAME

Yes

Admin username

MARZBAN_PASSWORD

Yes

Admin password — also used to silently re-authenticate on expiry

Everything else — profile, output format, verbosity, tool allow/deny filters, log level, link masking — is optional and documented in Configuration.

Tools

21 tools, namespaced marzban_<area>_<action>: Users (11) · Config (5) · System & nodes (3) · Subscription (2). Three prompts — expiring_users_audit, node_diagnostics, traffic_report — chain those tools into ready-made investigations. Full list at Tools & Prompts.

Safety model

A profile isn't a hint — a tool outside it never appears in tools/list, so a model can't call what it can't see. readonly exposes only lists and lookups; standard (default) adds full user CRUD, renewals and status changes; full adds destructive tools — delete, reset traffic, rewrite config, restart the core.

Destructive tools also gate on confirmation: the first call never runs anything — it describes exactly what would happen and returns a one-time token. Only a second call, with that token attached, executes. MARZBAN_MCP_CONFIRM controls how often this is required: auto (default, once per tool and exact arguments, for 5 minutes — a different target or a wider call always needs its own confirmation), always (every call), or off (unattended environments only — no safety net once set).

Confirmation decides whether a call may run; it doesn't decide whether it has already run. So each destructive call is also remembered for 5 minutes: an identical repeat — the kind a client sends after a timeout — returns the recorded result of the first one, with a note saying so, and never reaches the panel. When a request went out and no answer came back, the outcome is reported as unknown, with instructions to check the state with a read-only tool rather than retry. A fresh confirmation still runs the operation for real — in auto the replayed result carries a fresh token, so a second run can be approved on the spot — and restarting the server clears the memory.

Documentation

Full setup guides and the complete tool/prompt reference live at ilmar7786.github.io/marzban-sdk:

Contributing

This package lives in the marzban-sdk monorepo — see the root CONTRIBUTING.md for how to submit a patch. Running the server locally in watch mode, poking it with the MCP Inspector, or wiring a client to your own build? See ARCHITECTURE.md § Local development & manual testing. Found a bug or have an idea? Open an issue.

License

MIT © ilmar7786

Available Tools

15 tools
marzban_config_getGet core configA
Read-only

Reads the Xray core configuration. Defaults to a structural summary (inbound/outbound tags, ports, protocols, routing rule count) — the full config can be tens of KB and this is usually all that's needed. Pass section (e.g. "inbounds") for one key's raw JSON, or section: "raw" for the entire config.

Inputs: section. Returns: data, mode, section, summary

marzban_hosts_getGet proxy hostsA
Read-only

Lists proxy host settings grouped by inbound tag. Flags host fields (remark/address/host/sni/path) that reference an unknown {VARIABLE} template token — almost always a typo, since Marzban leaves unknown tokens un-substituted rather than erroring.

Inputs: no named parameters. Returns: hosts, warnings

marzban_nodes_listList nodesA
Read-only

Lists all connected nodes with their status and Xray version, plus bandwidth usage (uplink/downlink) over the given period. start/end (ISO datetimes) narrow the usage window; omit both for all-time.

Inputs: end, start. Returns: nodes, usage

marzban_subscription_getGet subscription infoA
Read-only

Reads subscription status/usage/expiry using the token from a subscription URL (the same public, unauthenticated endpoint client apps use) — for diagnosing a broken subscription link without needing the username. For an admin-side lookup by username, use marzban_users_get instead.

Inputs: subscriptionToken (required). Returns: links, expire, status, proxies, +13 more

marzban_system_get_inboundsList inboundsA
Read-only

Lists configured inbound proxies grouped by protocol, with tag, network, TLS mode, and port for each. For the raw Xray inbound JSON (routing, stream settings, etc.) use marzban_config_get with section: "inbounds" instead.

Inputs: no named parameters. Returns: object

marzban_system_get_statsGet system statsA
Read-only

Reports panel-wide stats: CPU/memory usage, user counts by status, and bandwidth totals/speeds, plus the Xray core version and whether it is currently running.

Inputs: no named parameters. Returns: core, system

marzban_users_activateActivate userB

Sets a user's status to active.

Inputs: username (required). Returns: note, admin, links, expire, +18 more

marzban_users_createCreate userA

Creates a new user. dataLimit accepts a human size ("10GB"), expire a relative duration ("30d") or absolute date — both default to unlimited when omitted. templateId fills dataLimit/inbounds/expire from a user template; any field also given explicitly overrides the template value.

Inputs: username (required), note, expire, status, +6 more. Returns: note, admin, links, expire, +18 more

marzban_users_deactivateDeactivate userA

Sets a user's status to disabled, immediately blocking their access without deleting them.

Inputs: username (required). Returns: note, admin, links, expire, +18 more

marzban_users_extendExtend user subscriptionA

Renews a user: adds addDuration to their current expiration (or to now, if they have none or it already passed) and/or addData on top of their current data limit. If the user was expired or limited, status is moved back to active. Use this instead of marzban_users_update for renewals — it reads the current expire/limit first so the increment is relative, not an absolute overwrite.

Inputs: username (required), addData, addDuration. Returns: note, user

marzban_users_getGet userA
Read-only

Fetches one user by username, with a computed summary: data left, days left, usage percent, and whether they are effectively expired (covers the case where status has not caught up with an already-past expire yet).

Inputs: username (required). Returns: user, summary

marzban_users_get_usageGet user traffic usageA
Read-only

Reports how much data a user has used: total, lifetime total, their current limit, and a breakdown by node. start/end (ISO datetimes) narrow the per-node breakdown to a period; omit both for all-time.

Inputs: username (required), end, start. Returns: byNode, username, dataLimit, usedTraffic, +1 more

marzban_users_holdPut user on holdA

Sets a user's status to on_hold — inactive until their first connection, at which point the on-hold timer starts. Useful for provisioning an account ahead of time without starting its clock.

Inputs: username (required), onHoldExpireDuration. Returns: note, admin, links, expire, +18 more

marzban_users_listList usersA
Read-only

Lists users, optionally filtered by status or a search term (matches username/note). Paginated — default 25, max 100 per call; prefer search over paging through everyone. For one known username, use marzban_users_get instead.

Inputs: limit, offset, search, status. Returns: note, total, users

marzban_users_updateUpdate userA

Partially updates a user — only fields you provide are changed, everything else is left as-is. For status changes prefer marzban_users_activate/deactivate/hold (clearer intent, no need to know the raw status enum). For renewing an expiring/expired user prefer marzban_users_extend.

Inputs: username (required), note, expire, proxies, +3 more. Returns: note, admin, links, expire, +18 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 15 tools

    Disambiguation5/5

    Tools are clearly separated by resource and action, and the descriptions explicitly distinguish potentially overlapping operations such as status changes, renewal, and partial update. Cross-references between config_get and system_get_inbounds, and between users_get and subscription_get, further reduce misselection risk.

    Naming Consistency5/5

    All tools follow a consistent marzban_<resource>_<action> snake_case pattern. Compound actions like get_inbounds and get_usage still fit the same predictable convention.

    Tool Count5/5

    With 15 tools, the set is well-scoped and each tool has a clear purpose within user, node, subscription, system, or config administration. There is no obvious filler or redundant tool.

    Completeness3/5

    User lifecycle coverage is strong for create/get/list/update/status/renew/usage, but there is no delete-user operation. Node, host, and config surfaces are mostly read-only or list-only, so common admin tasks like removing a user or managing nodes/hosts have no tool path.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Local-first CLI + proxy that curates your MCP servers per client from one canonical config, cutting tool-schema tokens ~80% and resolving secret references instead of hardcoding keys.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for Proxmox VE and Proxmox Datacenter Manager, covering every API endpoint via six consolidated tools for list, describe, and call operations with a read-only safety gate.
      6
      11 npm
      2
      AGPL 3.0