MarzbanSDK
MCP Server

Configuration

Every marzban-mcp environment variable — what it controls, its default, and the values it accepts.

Configuration is entirely env-based — set these in your MCP client's env block (see Client Setup). Nothing here is ever accepted as a tool argument; see Security for why that's a hard rule, not just a convention.

Credentials

VariableRequiredDefaultDescription
MARZBAN_BASE_URLYesYour panel's URL, e.g. https://panel.example.com
MARZBAN_USERNAMEYesAdmin username
MARZBAN_PASSWORDYesAdmin password
MARZBAN_TOKENNoAn already-valid session token, to skip the first login call

MARZBAN_USERNAME/MARZBAN_PASSWORD are required even when MARZBAN_TOKEN is set — see Security for why a token alone isn't enough.

Access control

VariableDefaultValuesDescription
MARZBAN_MCP_PROFILEstandardreadonly | standard | fullWhich tools get registered at all — see Security
MARZBAN_MCP_CONFIRMautooff | auto | alwaysHow often a destructive tool re-asks for confirmation — see Security
MARZBAN_MCP_SHOW_LINKSfalsetrue | falseWhether proxies, subscription_url, and links are shown in full instead of masked
MARZBAN_MCP_TOOLS_ALLOWComma-separated globs, e.g. marzban_users_*If set, only matching tools are registered
MARZBAN_MCP_TOOLS_DENYComma-separated globsMatching tools are never registered — wins over _ALLOW when both match the same tool

Output shaping

VariableDefaultValuesDescription
MARZBAN_MCP_FORMATtexttext | table | jsonHow a tool's result is rendered for the model to read
MARZBAN_MCP_VERBOSITYcompactcompact | fullHow many fields each response includes
MARZBAN_MCP_MAX_CHARS8000Positive integerCharacter budget per response before truncation

See Response Format & Token Economy for what each of these actually changes.

Logging

VariableDefaultValuesDescription
MARZBAN_MCP_LOG_LEVELwarndebug | info | warn | errorMinimum level written to stderr

Logs never go to stdout — stdout is reserved for the JSON-RPC protocol itself, and a single stray byte there would break the connection.

TLS / self-signed certificates

VariableDefaultValuesDescription
MARZBAN_TLS_CA_FILEPath to a CA cert (PEM)Trust this CA in addition to the system store — for a panel behind a self-signed or internal-CA certificate. Relative paths resolve against the process's working directory.
MARZBAN_TLS_REJECT_UNAUTHORIZEDtrue | falseEscape hatch for a panel you can't get a trusted/known CA for. Setting false disables certificate validation entirely and logs a startup warning — prefer MARZBAN_TLS_CA_FILE whenever the CA is available.

An unreadable MARZBAN_TLS_CA_FILE fails startup with a ConfigError naming the resolved path, rather than a bare ENOENT.

On this page