npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@trsnet/mcp

v1.1.0

Published

Local (stdio) MCP server for the Treas developer API

Readme

treas-mcp

Local (stdio) MCP server for the Treas developer API. It lets an AI client on your own machine (Claude Code, Claude Desktop, Cursor, VS Code) read and manage your Treas services through the same customer API you already use. It adds no new permissions and opens no network port: requests leave from your computer, with your API key and your IP allowlist.

Version 1.1.0 with 41 tools (see Tools): 38 that your key's scopes enable, plus 3 irreversible tools (reinstall, disk expansion, server password) that stay off unless you turn them on, and that each need the account owner's approval in the Treas panel with a passkey or two-factor code, unless the owner turned that approval off for the key at their own risk (see Irreversible operations and Keys with panel approval turned off).

Where it runs

| Supported | Not supported (phase 1) | |---|---| | Your own computer | Claude Code cloud sessions, GitHub Codespaces, other hosted agent sandboxes | | Your own server with a fixed IP (e.g. over ssh stdio) | CI pipelines |

Every Treas API key requires an IP allowlist. Hosted agent environments share changing outgoing addresses and keep secrets in environment variables that others can read, so they are not supported until the hosted Treas MCP server (phase 2). With a dynamic IP or CGNAT the allowlist breaks often: allow a single address (/32), never your ISP's whole block, or run treas-mcp on your own server with a fixed IP.

Requirements: Node.js 22 LTS or newer.

Quick start

  1. In the Treas panel (Account → Developer) create a key. Recommended for MCP: read-only scopes (account:read servers:read monitoring:read firewall:read ssh_keys:read tickets:read billing:read), 30 days, IP allowlist with only this computer's address (/32). If the API sees a different address, login (step 2) prints it and saves nothing: add that address as /32 and run login again. The panel's "Add my current IP" button adds your browser's address, which can differ from this computer's (VPN, proxy, iCloud Private Relay).

  2. Store the key (you are asked for it; it is never passed as an argument):

    cd ~
    npx -y @trsnet/[email protected] login            # OS keychain (macOS Keychain, Secret Service, Windows Credential Locker)
    npx -y @trsnet/[email protected] doctor           # key source, the IP the API sees, scopes, expiry, available tools

    On a server without a keychain, store the key in a file only you can read (~/.treas-mcp/api-key, mode 0600; Windows: %LOCALAPPDATA%\treas-mcp\api-key). treas-mcp reads a key file only through TREAS_API_KEY_FILE:

    cd ~
    npx -y @trsnet/[email protected] login --key-file
    TREAS_API_KEY_FILE="$HOME/.treas-mcp/api-key" npx -y @trsnet/[email protected] doctor
  3. Install it globally with a pinned version and point your client at the absolute path of the command, at user level (never in a project .mcp.json):

    npm install -g @trsnet/[email protected]
    command -v treas-mcp        # e.g. /usr/local/bin/treas-mcp  (Windows: where.exe treas-mcp.cmd)

    Why not npx: npx -y @trsnet/[email protected] run inside a project directory executes a copy of @trsnet/mcp from that project's node_modules if one with the same version is there (verified with npm 11). Clients usually start servers in the project you opened, so a malicious repository could run its own copy with your key. For the same reason run login and doctor from your home directory, not from a project.

    • Claude Code: claude mcp add --scope user --transport stdio treas -- /usr/local/bin/treas-mcp

    • Claude Desktop (claude_desktop_config.json) and Cursor (global ~/.cursor/mcp.json):

      { "mcpServers": { "treas": { "command": "/usr/local/bin/treas-mcp" } } }
    • VS Code (user mcp.json; the env part only if you do not use login):

      { "servers": { "treas": { "type": "stdio", "command": "/usr/local/bin/treas-mcp",
          "env": { "TREAS_API_KEY": "${input:treas-key}" } } },
        "inputs": [ { "type": "promptString", "id": "treas-key", "description": "Treas API key", "password": true } ] }
    • Key file: add "env": { "TREAS_API_KEY_FILE": "/home/you/.treas-mcp/api-key" } to the same user-level entry.

    • Windows: the command is treas-mcp.cmd. Start it through cmd /c, which works in every client: "command": "cmd", "args": ["/c", "C:\\path\\to\\treas-mcp.cmd"] (Claude Code: run claude mcp add --scope user --transport stdio treas -- cmd /c C:\path\to\treas-mcp.cmd in Command Prompt). If PowerShell says that running scripts is disabled, use npm.cmd, npx.cmd and treas-mcp.cmd.

    • Your own server over SSH: on the server run treas-mcp login --key-file (the key stays there), then "command": "ssh", "args": ["you@server", "env", "TREAS_API_KEY_FILE=/home/you/.treas-mcp/api-key", "/usr/local/bin/treas-mcp"]. SSH must log in with a key and without prompts: connect once from a terminal first to accept the server's host key.

Always pin the exact version, never @latest; to update, install the new pinned version.

If a tool is missing or fails, ask the assistant to call whoami: it explains what is wrong (for example the IP address the API sees) and retries.

Tools

Tools are registered only when your key has their scope (and TREAS_MCP_READ_ONLY / TREAS_MCP_TOOLSETS allow them). A read-only key shows at most the 21 read tools. whoami is always there and explains missing tools.

| Class | Tools | What happens | |---|---|---| | Read (21) | whoami, list_services, list_servers, get_server, get_server_metrics, get_server_traffic, list_server_ips, list_server_activity, list_operating_systems, list_server_addons, list_server_actions, get_action, list_upgrade_options, get_firewall, list_ddos_attacks, list_ssh_keys, list_alarms, list_tickets, get_ticket, list_invoices, get_invoice | Nothing changes. | | Low-risk change (5) | start_server, rename_server (panel name only), set_alarm, delete_alarm, close_ticket | Runs directly. | | High-risk change (12) | power_server (shut down, power off, reboot, reset), set_hostname, set_rdns, create_ticket, reply_ticket, set_firewall, add_firewall_rule, delete_firewall_rule, clear_firewall, add_ssh_key, apply_ssh_key, remove_ssh_key | You confirm it in a dialog (below). | | Irreversible (3) | rebuild_server, resize_disk, reset_server_password | Off by default. When enabled, each one needs the account owner's approval in the Treas panel (below); if the owner turned that off for the key, only the dialog, and only in clients that can show it. |

Confirmation dialogs

Before a high-risk change treas-mcp reads the target from the API and shows a dialog in your client with a fixed text: your account e-mail (if the key has account:read), the server's product, creation date, operating system and IP address, its panel name (marked as user-written; a warning is shown if it was renamed in the last 24 hours, a note if that could not be checked), and exactly what will change. For support tickets the dialog shows the whole text the assistant wrote (at most 2,000 characters, every line marked with │); exactly that text is sent, with invisible and control characters removed. Nothing is sent to Treas unless you tick "Yes, I confirm this change" and accept. The confirmation is valid once, for 5 minutes, for exactly these arguments and this target; if the target changes in the meantime (renamed, new IP, rules changed) nothing is done. After you decline, the same change on the same target is not asked again for 60 seconds.

The model never sees or fills in the confirmation: the tools have no "confirm" argument. Clients that cannot show such dialogs get an error for high-risk tools instead (nothing is sent). Claude Code, VS Code and Cursor support them; Claude Desktop is not known to.

Limits: a dialog only protects you if your client really shows it to you. In Claude Code an Elicitation hook (in your own settings, or in a project you trusted) can answer dialogs automatically; do not install such hooks for this server. This is why irreversible operations need approval in the Treas panel, which no dialog, hook or API key can give — unless the account owner turned that approval off for the key; then the dialog is the only check (below).

Irreversible operations

| Tool | What it does | |---|---| | rebuild_server | Reinstalls the operating system (osId from list_operating_systems). Erases all data on the server and uses one reinstall credit. The new login details are shown in the panel when the job finishes; they are not returned to the assistant. | | resize_disk | Expands the disk to its full entitlement (plan disk + disk add-ons). There is no size argument: treas-mcp reads the entitlement from Treas. The server is powered off and started again; disks never shrink. If the disk is already at its entitlement, treas-mcp says so before asking for anything (Treas reports the disk's current size; nothing is sent). If Treas cannot read the current size at that moment, it says so after the panel approval instead and nothing starts (the server is not restarted). | | reset_server_password | Sets a new generated root/Administrator password (the server must be running). The password is never shown to the assistant: it is saved to a file only you can read (below). |

Turning them on

All of these are needed; otherwise the tools are not registered and whoami says why:

  1. A key with the scopes servers:destructive, servers:read and account:read. Use a separate key for this, restricted to the server(s) you want to manage, with a short expiry (30 days) and a /32 IP allowlist. The panel allows this scope only on accounts with a passkey or two-factor authentication, and only with a 30- or 90-day expiry.

  2. TREAS_MCP_ENABLE_DESTRUCTIVE=1 in the client's user-level server entry. Keep the separate key in its own file and give it its own entry, so your everyday key stays as it is (login without --key-file would replace the key in the OS keychain; a key file set for an entry takes precedence over the keychain):

    treas-mcp login --key-file ~/.treas-mcp/irreversible-key
    { "mcpServers": { "treas-irreversible": { "command": "/usr/local/bin/treas-mcp",
        "env": { "TREAS_API_KEY_FILE": "/home/you/.treas-mcp/irreversible-key", "TREAS_MCP_ENABLE_DESTRUCTIVE": "1" } } } }

    Claude Code: claude mcp add --scope user --transport stdio treas-irreversible -e TREAS_API_KEY_FILE=/home/you/.treas-mcp/irreversible-key -e TREAS_MCP_ENABLE_DESTRUCTIVE=1 -- /usr/local/bin/treas-mcp. Windows (PowerShell): treas-mcp.cmd login --key-file "$env:LOCALAPPDATA\treas-mcp\irreversible-key", and that full path in TREAS_API_KEY_FILE.

  3. The Treas API reports, for this key, whether irreversible operations need panel approval (GET /me → destructiveApprovalRequired; API 1.11 or later). Both true (the default) and false (the account owner turned approval off for this key, API 1.13 or later) register the tools; with false they behave differently (below). An older API that does not report it gets no irreversible tools.

They are also off in read-only mode, when the servers toolset is not selected, and when this version is below the minimum version Treas supports.

treas-mcp doctor run in a terminal sees only that terminal's environment, not your client's server entry: it lists the irreversible tools as "not available: TREAS_MCP_ENABLE_DESTRUCTIVE=1 is not set" and says so. To check the whole setup, pass the entry's variables to it: TREAS_API_KEY_FILE="$HOME/.treas-mcp/irreversible-key" TREAS_MCP_ENABLE_DESTRUCTIVE=1 treas-mcp doctor (PowerShell: $env:TREAS_API_KEY_FILE="$env:LOCALAPPDATA\treas-mcp\irreversible-key"; $env:TREAS_MCP_ENABLE_DESTRUCTIVE='1'; treas-mcp.cmd doctor). It also shows whether panel approval is on for the key.

How the panel approval works

  1. treas-mcp reads the server, its options (reinstalls left, disk entitlement, password account) and checks what Treas would refuse (running job, no reinstalls left, server powered off). It also reads whether Treas requires the panel approval for this key; if it cannot read that, nothing is sent.
  2. If your client can show dialogs, you see the same kind of fixed-text dialog as for high-risk changes and must type the server's IP address and tick "I understand that this cannot be undone". This is only an extra speed bump.
  3. treas-mcp sends the request. Treas starts nothing: it opens an approval request, emails the account owner and returns a link https://cp.treas.net.tr/client/api-approvals/<id>.
  4. The account owner opens the link (or the e-mail, or the list at https://cp.treas.net.tr/client/api-approvals), signs in, checks the operation, the server (IP, product, operating system) and the requesting key, and approves with a passkey or a two-factor code, or rejects. The link itself grants nothing. Never share these codes with anyone, including your AI assistant. If you did not start the request, reject it and revoke the key.
  5. treas-mcp checks the approval every few seconds (up to 10 minutes) and then sends the same request with the approval; the job starts and the tool returns its actionId (follow it with get_action).

Clients that can show a link dialog (URL mode) open the approval page from step 4 directly and the tool waits. Other clients, including those that cannot show dialogs at all, get the link as text (outcome: approval_pending): check that it starts with https://cp.treas.net.tr/, approve it, then ask the assistant to run the same tool with the same arguments again; it continues without a new approval request (it waits up to about 45 seconds per call and says so if the approval has not arrived yet).

Cancelling the tool call only stops the waiting: nothing has been sent at that point, and the job can start only if the account owner approves the request in the panel and the tool is run again with the same arguments. To withdraw, reject the request in the panel (an approved but unused approval can be rejected there too). If the call is cancelled while the approved request is being sent, treas-mcp never sends it again; it only fetches the result if Treas already received it.

The approval is valid only for that key, server, operation, arguments and server state (IP address, name, status, operating system): if anything differs, nothing happens (APPROVAL_MISMATCH). It must be approved within 10 minutes and used within 5 minutes after that, and only once. Treas allows at most 3 open approval requests per account and 10 per hour, and after a rejection the same key cannot ask again for 10 minutes. treas-mcp itself runs one irreversible operation at a time, at most 3 per session, and does not ask again for the same server for 10 minutes after a rejection. It never retries a rejected, expired or mismatched approval on its own. If an approved request for exactly the same operation, server and arguments is still unused (for example after treas-mcp was restarted), running the tool again uses it, as Treas intends; reject it in the panel if you no longer want it.

An API key alone can never approve: even an agent that reads your key and calls the API directly has to wait for the owner's passkey or two-factor approval in the panel — as long as panel approval is on for that key (the default). While treas-mcp expects a panel approval it sends X-Require-Approval: true with the request (API 1.13), so even if the owner turns the setting off while the request is on its way, Treas still asks for the approval and nothing starts without it.

Keys with panel approval turned off

Since API 1.13 the account owner can turn the panel approval off for a single key, only in the Treas panel (Account → Developer → the key → "Panel approval for irreversible operations"). Turning it off asks for:

  • a passkey, if the account has one (only a passkey check started on that page for that key counts);
  • otherwise the account password and a two-factor code that has not been used before (the code you signed in with does not count);
  • only the two-factor code on accounts without a password (signed up with Google or Discord).

Accounts with neither a passkey nor two-factor authentication cannot turn it off (they cannot run irreversible operations through the API at all). It cannot be turned off through the API or by treas-mcp. Turning it back on is one click and needs no confirmation. Every change (off or on) cancels the key's open approval requests. whoami and doctor warn when it is off for the key in use.

What this means — read before turning it off:

  • Anything that can read the key can then reinstall your servers (all data is deleted), expand their disks (the server is restarted) and change their passwords without any approval by you. That includes your AI assistant, a script, or anyone who copies the key from your machine, a log or a repository. There is no second check on Treas's side and nothing can be stopped once it starts.
  • Against a stolen key, only these Treas-side limits remain: the key's IP allowlist (requests are accepted only from the listed addresses) and at most 5 irreversible operations per server per hour (this limits how many, it does not block one). The account owner gets an e-mail for every operation (and when the setting is turned off), so the key can be revoked right away.
  • The key's scopes and the server's IP address as confirmation (confirm) only prevent mistakes on the wrong server: whoever has the key can read the server's IP address through the API. The account must have two-factor authentication or a passkey, but no code is asked for in the API request while approval is off.
  • treas-mcp keeps its own dialog as the only human check: you must type the server's IP address and tick "I understand that this cannot be undone". The dialog says that panel approval is off and that the job starts as soon as you confirm. The request then goes straight to Treas, which starts the job (outcome: started, approval: null); there is no approval link and no waiting.
  • Clients that cannot show this dialog (for example Claude Desktop) cannot run irreversible tools with such a key at all (PANEL_APPROVAL_OFF_NO_DIALOG, nothing is sent): there would be no person in the loop. Use Claude Code, VS Code or Cursor, or turn panel approval back on.
  • The dialog only protects you if you really see it. An Elicitation hook that answers dialogs automatically removes the last check: never install one for this server, and keep panel approval on if you cannot rule that out.
  • If the owner turns the setting on or off while a dialog is open, nothing is sent (APPROVAL_SETTING_CHANGED); run the tool again to see the current state. If approval is turned back on while a request is being processed, Treas answers APPROVAL_REQUIRED and nothing starts; run the tool again for the normal approval flow.

Our recommendation: keep panel approval on. If you turn it off, do it only for a separate key with servers:destructive, restricted to the server(s) it must manage, with a 30-day expiry and a /32 IP allowlist, used from a client that shows dialogs.

The password file

reset_server_password writes the new password to a new file <serviceId>-<UTC time>.txt in ~/.treas-mcp/secrets/ (Windows: %LOCALAPPDATA%\treas-mcp\secrets\; change it with TREAS_MCP_SECRETS_DIR, which must be an absolute local folder: relative and network paths are ignored). The directory is 0700 and the file 0600; on Windows the folder's access list is restricted to your user first, so the file is private from the moment it exists, and the file's own access list is restricted before the password is written (if that fails, the file is deleted and the password is shown in the panel instead). The tool result contains only the file path. The password is valid once the job succeeds; it is then also shown in the panel's connection details. Copy the password to your password manager and delete the file. While treas-mcp runs it deletes these files after 24 hours (it checks at startup and every hour); if it is not running, the file stays until you delete it. Programs running as your user, including an AI agent with shell access, can read the file.

Security model

  • The key lives on your machine: in the OS keychain, in a file only you can read, or in your client's user-level configuration. treas-mcp never prints it, never logs it and never passes it to another process on the command line.
  • Precedence when more than one is configured: TREAS_API_KEY_FILE → TREAS_API_KEY → OS keychain. doctor shows which one is used.
  • Do not put the key in a project .mcp.json and do not export TREAS_API_KEY in your shell profile: a malicious repository could forward it to another server through variable expansion.
  • Treas never ships a project .mcp.json. If your client asks you to approve a project server named treas, decline it (it would shadow your own definition).
  • The keychain protects the key on disk, not from programs running as you: an agent with shell access can read it, just like any other process of yours. Your real limits are the IP allowlist (/32), a short expiry (30–90 days) and restricting the key to specific services.
  • Text written by users or third parties (server names, ticket messages, firewall rule comments, SSH key names) is cleaned of control and invisible characters, shortened, listed in _untrusted and shown as «…»; the model is told to treat it as data. This lowers, but cannot remove, the risk of prompt injection.
  • Privacy: what tools return (server data, tickets, invoices, account profile) is sent to your AI model provider.

Configuration

Environment variables, set in the client's user-level server entry:

| Variable | Default | Meaning | |---|---|---| | TREAS_API_KEY_FILE | — | Key file; must be readable only by you (POSIX 0600/0400; Windows: only you, SYSTEM, Administrators) | | TREAS_API_KEY | — | The key itself (prefer login) | | TREAS_MCP_READ_ONLY | 0 | 1: register only read tools, whatever the key allows | | TREAS_MCP_TOOLSETS | all | Subset of servers,network,firewall,ssh_keys,monitoring,tickets,billing | | TREAS_MCP_ENABLE_DESTRUCTIVE | 0 | 1: allow the irreversible tools (the key and Treas must allow them too) | | TREAS_MCP_SECRETS_DIR | ~/.treas-mcp/secrets (Windows %LOCALAPPDATA%\treas-mcp\secrets) | Where reset_server_password saves new passwords (absolute local folder; relative and network paths are ignored) | | TREAS_MCP_LANG | OS language | tr or en: language of error hints and dialogs | | TREAS_MCP_LOG | warn | stderr log level: error, warn, info, debug |

The API address is built in (https://service.treas.net.tr/api/public/v1) and cannot be changed. NODE_TLS_REJECT_UNAUTHORIZED=0 makes treas-mcp refuse to start.

Commands

treas-mcp                         start the MCP server on stdio (what clients run)
treas-mcp login [--key-file [path]]
treas-mcp logout [--key-file [path]]
treas-mcp doctor
treas-mcp --version | --help

Troubleshooting

| Symptom | What to do | |---|---| | IP_NOT_ALLOWED / IP_ALLOWLIST_REQUIRED | Add the address shown (clientIp, /32) to the key's allowlist. The API has no IPv6 record, so it is your IPv4 address. Your browser may use a different address than Node.js (proxy, VPN, iCloud Private Relay); trust doctor. | | INSUFFICIENT_SCOPE | Add the scope to the key in the panel (or create a new key), then restart the server. | | API_KEY_EXPIRED / API_KEY_DISABLED | Create a new key and run login again. | | Only whoami is listed | Authentication failed or no key is configured; call whoami or run doctor. | | ELICITATION_UNSUPPORTED | Your client cannot show confirmation dialogs (high-risk tools). Use Claude Code, VS Code or Cursor, or make the change in the panel. | | outcome: approval_pending | Approve the request in the panel (link in the result), then run the same tool with the same arguments again. | | APPROVED_RESULT_UNKNOWN | The approved request was sent but the answer was lost; the job may have started. Run the same tool with the same arguments again: it fetches the result and never starts a second job. | | APPROVED_SEND_CANCELLED | The call was cancelled while the approved request was being sent; treas-mcp did not send it again. Check list_server_actions; reject the approval in the panel if you no longer want it. | | APPROVAL_POLICY_UNVERIFIED | treas-mcp could not read from Treas whether the panel approval is required for this key, so nothing was sent. Try again in a minute. | | PANEL_APPROVAL_OFF_NO_DIALOG | Panel approval is off for this key and your client cannot show confirmation dialogs, so nothing was sent. Use Claude Code, VS Code or Cursor, or turn panel approval back on for the key in the panel. | | APPROVAL_SETTING_CHANGED | The key's panel approval was turned on or off while the dialog was open. Nothing was sent; run the tool again. | | APPROVAL_REJECTED / APPROVAL_EXPIRED / APPROVAL_TIMEOUT | Nothing was started. Ask again only if you still want it (after a rejection the key waits 10 minutes: RATE_LIMIT_EXCEEDED, tier: KEY_APPROVAL_COOLDOWN). | | APPROVAL_MISMATCH | The server changed after the approval was requested (or the request differs). Nothing was started; ask again for a new approval. | | POWERED_OFF | reset_server_password needs a running server: start it first. | | env: node: No such file or directory / node: not found | Your client (or the SSH session) cannot find Node.js, typically when it was installed with nvm or Homebrew. Use node's full path as the command and treas-mcp's as the argument: "command": "/full/path/to/node", "args": ["/full/path/to/treas-mcp"] (command -v node). | | USER_DECLINED / PLAN_REJECTED | You declined, or the confirmation expired, was already used or the target changed. Nothing was done; ask again if you still want it. |

License

MIT — see LICENSE. Bundled third-party code and its licenses are listed in dist/THIRD_PARTY_NOTICES.md.

Changes

See CHANGELOG.md (included in the package).

Development

See GELISTIRME.md in the source repository (Turkish): layout, tests (npm test, Docker commands), CI and how to add a tool.