Skip to main content
Glama

mcp-gpt-load — an MCP server for GPT-Load

An unofficial Model Context Protocol server for a self-hosted GPT-Load gateway. Use it to answer operational questions — which subscription account is closest to its limit, which group and model drive spend, why a route is not resolvable — and to make bounded changes: preview a plan, record approval on the host, apply it, then reconcile what the readback proved. Credential, proxy and access-key reveal operations write to local artifacts, so the GPT-Load AUTH_KEY and raw secrets stay out of the model's context.

English · Русский

CI Go 1.25+ License: MIT MCP protocol GPT Load MCP on Glama status: pre-1.0

Experimental (pre-1.0). Not production-ready; no external security audit or certification. Known limits: outbound destination validation does not resolve public hostnames, so DNS rebinding is not prevented; a managed proxy URL can change between validation and dial; direct single-call mutations are journaled but have no approval step. Choose the posture deliberately: observer for read-only analytics, operator for non-destructive changes and probes, admin for gateway management including deletion (110 of the 116 tools), or secret-operator for the full surface (116, including six secret-scope reveal/export/OAuth tools). Keep the MCP client's own approval gate as well; a role or a delegation flag authorizes a posture, not a particular live write. Details are in the safety model below.

Supported upstream: GPT-Load v2.0.0-rc.67, v2.0.0-rc.68 and v2.0.0-rc.69. rc.68 and rc.69 are accepted because their control route tables are byte-identical (93 entries); the control-plane deltas are the additive header_rules.default and https as an outbound proxy scheme. Any other version, including rc.70, is read-only: writes, probes and secret operations fail with UPSTREAM_VERSION_UNVERIFIED.

Who it is for

  • You run GPT-Load and want an agent to answer "which group is burning quota", "why is this model not routable", or "what happened to this request" without opening the panel for every question.

  • You want a bounded change (disable a group, rotate a key, fix a price) without handing an agent an unrestricted admin API and a shared secret in the chat window — and you want multi-step changes to wait for approval recorded on the host.

  • You are comparing MCP admin servers for gateways (LiteLLM, New API, …) and want to know exactly what this one does and refuses to do.

It is not a general-purpose gateway, not a GUI and not a shell: it speaks the GPT-Load HTTP API and nothing else.

Related MCP server: @rarecloudio/mcp-server

Quickstart

Download (Linux amd64)

The v0.1.3 release contains a prebuilt binary, the README, the license and the agent skill. Verify the archive before extracting or running anything:

curl -fL -O https://github.com/torch817/mcp-gpt-load/releases/download/v0.1.3/gpt-load-mcp_0.1.3_linux_amd64.tar.gz
curl -fL -O https://github.com/torch817/mcp-gpt-load/releases/download/v0.1.3/SHA256SUMS
sha256sum -c SHA256SUMS
tar -xzf gpt-load-mcp_0.1.3_linux_amd64.tar.gz
./gpt-load-mcp version
# gpt-load-mcp 0.1.3 (verified GPT Load release 2.0.0-rc.67; supported releases: 2.0.0-rc.67, 2.0.0-rc.68, 2.0.0-rc.69)

The binary is static (CGO_ENABLED=0) and has no runtime dependencies. For other platforms, build from source.

Build from source

You need Go 1.25.4 (the version in go.mod).

git clone https://github.com/torch817/mcp-gpt-load.git
cd mcp-gpt-load
make build VERSION=0.1.3
dist/gpt-load-mcp version
# gpt-load-mcp 0.1.3 (verified GPT Load release 2.0.0-rc.67; supported releases: 2.0.0-rc.67, 2.0.0-rc.68, 2.0.0-rc.69)

make build writes a static binary to dist/gpt-load-mcp; VERSION is also the default in the Makefile.

Write a minimal config. policy.role defaults to observer, so the first run cannot mutate the gateway. state_dir holds the plan journal and artifacts and may be relative:

{
  "instances": [
    {
      "id": "prod",
      "base_url": "https://gpt-load.internal.example",
      "auth_key_env": "GPTLOAD_AUTH_KEY"
    }
  ],
  "policy": { "role": "observer" },
  "state_dir": "./state"
}

GPTLOAD_AUTH_KEY is the same AUTH_KEY your GPT-Load instance uses. Replace base_url with the address of your gateway. The key value lives only in that environment variable (or in a 0600 file named by auth_key_file), never in the config file.

That example is a deliberate read-only install. observer is also the config default, so an omitted role cannot mutate the gateway. Choose one posture and record it:

  • Observer / analytics: keep policy.role: "observer". Reads, usage, logs and route inspection work; every write, probe and secret operation returns ROLE_DENIED.

  • Full gateway management: set policy.role: "admin". That reaches 110 of the 116 tools — every operation outside the six-tool secret scope, including group/credential/proxy/price deletion, settings and channel changes. It deliberately does not reach the six secret-scope tools (reveal, download, export-all and OAuth completion); those require secret-operator, which is a strict superset and also grants deletes.

  • Full 116 (secret operations): set policy.role: "secret-operator" using examples/config.secret-operator.example.json. All six secret-scope tools become callable; every value still goes to a 0600 artifact in a 0700 root, and artifact get is the only read path. The secret path is exercised by tests/stdio against the fake API.

  • operator is the middle tier, not "full admin": it adds non-destructive mutations and probes but cannot delete objects, change global settings (gptload_settings_update) or a group's channel, or delete access keys and prices. gptload_group_settings_update is operator-scope.

Whichever role you choose, keep the MCP client's approval gate. With Hermes trust: untrusted and approvals active (approvals.mode smart or manual), a tool without readOnlyHint asks the user before every call. A profile with approvals.mode: off, a YOLO session, or a remembered per-tool Allow gets no prompt, and there the server role is the only gate. The role is a second, local guard, not a replacement for host consent.

journal bounds the server's own state: at most max_plans plan files of at most max_plan_bytes each, an append-only journal of at most max_journal_bytes, and evidence_retention_hours after a plan's expiry before a settled plan file is deleted. Admission fails closed at the cap; a plan that is still in flight or has an unknown step is never evicted. The defaults are 128 plans, 262144 bytes per plan, 8388608 bytes of journal and 168 hours.

Check the wiring before adding the server to a client:

export GPTLOAD_AUTH_KEY='<your-gateway-auth-key>'
dist/gpt-load-mcp doctor --config gpt-load-mcp.json
config.instances                   ok    1 configured
policy.role                        ok    observer
artifacts.root                     ok    owner-only directory present
journal                            ok    ./state
instance[prod].process             ok    GET /health answered
instance[prod].auth                ok    principal=admin
instance[prod].version             ok    2.0.0-rc.67
instance[prod].telemetry           ok    no dropped/failed request-log writes reported
verdict: ok (0 failed checks)

doctor exits non-zero when a check fails, so it is usable in a script. The block above is real output from the repository's local fake API fixture (tests/manual), not from a production gateway; paths, the configured instance name and the principal line will differ on your host.

Add the server to your MCP client (path and config location are placeholders):

{
  "mcpServers": {
    "gpt-load": {
      "command": "/path/to/mcp-gpt-load/dist/gpt-load-mcp",
      "args": ["serve", "--config", "/path/to/gpt-load-mcp.json"],
      "env": { "GPTLOAD_AUTH_KEY": "<provided-by-your-secret-manager>" }
    }
  }
}

If your client inherits the process environment, omit env and export GPTLOAD_AUTH_KEY before starting the client. Do not commit a real key to a client config file. The client starts the server with serve; the command is also the default when no subcommand is given.

All commands: serve (default), doctor, version, catalog, artifact list|get|delete, approve, plans. Run gpt-load-mcp help for usage (the --help flag is not accepted).

Try these tasks

The server ships four MCP prompts, so you can start with a sentence instead of a tool name. Prompts are text guidance; they are not a policy or an approval mechanism.

Prompt

Say something like

Calls

cost_review

"Review the last 24 hours of spend: which group and model drive it, and where is usage data missing?"

gptload_usage_summary, then gptload_usage_compare against the preceding window

route_audit

"Why is gpt-4.1 not routable for access key 3 right now?"

gptload_route_inspect, gptload_route_matrix

investigate_failure

"Investigate request <id>: log facts first, hypotheses second."

gptload_request_diagnose (with gptload_logs_list / gptload_log_get for raw records)

safe_change

"Disable group 7 — preview it, then wait for my approval. It stays disabled until it is explicitly re-enabled; there is no scheduler."

gptload_change_preview → local approve → gptload_change_apply → gptload_operation_reconcile

There is no prompt for quota totals on purpose: the tool is the answer. Ask "which subscription accounts are closest to their 5h or 7d limit, and what is the estimated reference cost?" and the agent must call gptload_subscription_quota; gptload_subscription_accounts is the four-account home widget and says so in completeness and warnings.

A read the agent can do on its own. This is a trimmed result of gptload_groups_list against the fake API fixture (synthetic data):

{
  "instance_id": "prod",
  "operation": "control.groups.list",
  "effect": "read",
  "upstream_version": "2.0.0-rc.67",
  "data": { "items": [
    { "id": 1, "name": "alpha", "channel_id": "openai", "credentials": 2, "enabled": true },
    { "id": 2, "name": "beta", "channel_id": "anthropic", "credentials": 0, "enabled": true }
  ] },
  "completeness": { "partial": false, "records": 2 }
}

A change set that must be approved:

gptload_change_preview {"summary":"disable noisy group","steps":[{"op":"group_settings_update","group_id":7,"enabled":false}]}
# -> approval_state: pending-operator-approval, plan_id: <plan-id>

# operator on the host that owns the journal:
gpt-load-mcp approve <plan-id>

gptload_change_apply {"plan_id":"<plan-id>"}
gptload_operation_reconcile {"plan_id":"<plan-id>"}

A boolean confirmed=true, or a token repeated by the model, is not approval. Approval is a local CLI action on the host that owns the journal, or an explicit policy.allow_unapproved_apply delegation for headless automation. That delegation removes only the CLI step for change sets; the client's own approval gate is separate and remains in force where the host runs approvals — for example, Hermes trust: untrusted with approvals.mode smart/manual asks before gptload_change_apply runs, while approvals.mode: off or YOLO suppresses that prompt.

What it covers

116 typed tools over the 93 control route entries of the pinned release, plus the process health route. That is the 115 existing names plus the additive gptload_subscription_quota inventory: server and instance info, groups, channels, model discovery, client catalog and profiles, model prices, proxies, credentials and staged OAuth, access keys, global settings and redaction, request logs, usage analytics, artifacts, change sets, and clone/migration/drift checks.

Two result shapes, not one. 85 of the 116 tools return the standard envelope: instance_id, operation, observed_at, provenance, effect, upstream_version, data, plus pagination, completeness, readback and warning fields when they apply. The other 31 tools return task-specific results (28 distinct schemas): change sets, health and diagnosis, usage reports, introspection, routing, artifacts and the local journal, and configuration diff/export/preview. Those are the families where a single data field would lose the answer — a change preview returns plan_id, approval_state, steps and reversible; a diagnosis returns facts and hypotheses. A client must not assume one envelope for every tool.

The discovery frame is bounded: the per-tool JSON in tools/list sums to 277,947 bytes (about 271 KiB), down from 993,159 bytes; most of the reduction came from removing the never-assigned Envelope.report field from 84 output schemas. That field is gone, while usage_report.report remains required and populated. Every tool still declares an output schema, the 115 existing names are unchanged, and the one additive tool is counted explicitly. The budget test fails if the total exceeds 300 KB, any of the 85 envelope schemas exceeds 3,000 bytes, or a usage schema exceeds 10,000 bytes.

Handler-level business failures are MCP tool errors (isError: true) with a stable code such as ROLE_DENIED, UPSTREAM_VERSION_UNVERIFIED, APPROVAL_REQUIRED or PRECONDITION_FAILED. Argument-schema violations are rejected before the handler and come back as plain-text isError results without a stable code, so do not parse them for control flow.

Roles are enforced by this server, not by GPT-Load. GPT-Load itself has two control principals: the AUTH_KEY, which is full admin on every control route, and an access key, which is GET-only on seven self-scoped control routes (/api/auth/session, /api/home, /api/home/statistics, /api/models, /api/usage, /api/logs, /api/logs/:request_id) and is also a data-plane inference credential that spends quota and writes usage logs. This server accepts only auth_key_env/auth_key_file and always sends the AUTH_KEY; it has no access-key credential type. So observer is a local guard, not upstream least privilege — an observer deployment still presents the admin key upstream and cannot attribute actions to an MCP actor.

Role

Can do

observer

reads (GET-class operations, route inspect, usage, logs without bodies), plus local plan preview/cancel — plans write to the bounded local store, not upstream

operator

+ non-destructive mutations, external probes, change-set preview/apply when approved

admin

+ destructive mutations (group/credential/proxy/price deletion, settings, channel change)

secret-operator

+ reveal/download of credentials, access keys and proxies into artifacts

Tool listing is not role-filtered: the server advertises all 116 tools at every role and gates the call instead. At admin, 110 are callable; the six still refused are proxy_reveal, access_key_reveal, credential_reveal, credential_export, credentials_export_all and stage_oauth_complete. secret-operator is a strict superset, not an additive "admin plus secrets" mode. gptload_log_get itself is callable at every role, but requesting the request body additionally needs secret-operator. Note that admin can still create or rotate an access key; the one-time secret goes to a 0600 artifact and the model sees only a mask, but the call's effect is secret_export and the artifact is retrievable by a local operator.

Effects are labelled per call: read, local (plan and artifact bookkeeping, no upstream call), upstream_mutation, upstream_destructive, external_probe (may spend provider quota), and secret_export (the payload never enters model context).

Subscription quota and estimated reference cost

gptload_subscription_accounts is the GPT Load home widget, not the account inventory: upstream caps it at four subscription accounts that had at least one successful attempt in the last 24 hours, deduplicated by credential identity. The result is now marked partial/truncated, carries home_view_limit: 4 and selection_window_seconds: 86400, warns that a short or empty list is not an inventory, and points at the complete tool. Account e-mail, proxy configuration and the rest of the account payload are dropped; ids, masks, statuses, quota windows and reset-credit counts remain.

gptload_subscription_quota is the complete read-only path:

  1. GET /api/groups?connection_type=subscription until total_pages, using the returned page_size (a local limits.max_page_size of 50 lowers the request; it does not silently cap the inventory);

  2. GET /api/groups/:id/credentials?page_size=… for every page of every subscription group (rc.67 accepts only 20/50/100; a local limit between values is lowered to an accepted one, below 20 it is refused locally);

  3. one GET /api/groups/:id/credentials/:credential_id per credential, because only the detail route populates observed_usage.estimated_reference_cost_nano_usd;

  4. keep one entry per credential_id (the record id the collection route returns; this is the only proven identity), retain both group memberships when the same id is listed twice, keep the newest observation per window, and roll up credential records.

What the payload guarantees:

  • Identity is credential_id, never a display mask. The read routes expose the credential record id (the global primary key of the credentials table) and a redacted display mask. Two different records can share a mask, so equal masks are never merged. When two records do share one, identity_ambiguity is true, both stay in accounts, same_display_as_credential_ids names the pair, and the possible upstream-account count is bounded (distinct_accounts_lower_bound..upper_bound); the published count stays credential_records, and no exact distinct-account count is claimed. A record without a credential_id is kept separate and counted in unverified_identity_records, which makes distinct_record_count_exact: false. The routes expose no upstream-account fingerprint, so the tool does not invent one. inventory.complete still means every page was read; the envelope's partial also turns true when identity is ambiguous or a record has no id, because the account aggregate is then bounded rather than exact.

  • Window identity is window_seconds. rc.67 derives label_key from the wire field name, so a 604800-second window can arrive as id: "primary", label_key: "session"; is_primary means "most utilized window", not "the five-hour window". The upstream ids are reported for audit, window_kind is 5h, 7d, custom or unknown from the duration, and label_conflicts_with_seconds flags the contradiction.

  • Missing is not zero. An absent window_seconds, used, remaining or cost stays null; a real zero stays 0. Reset credits are null without an observation, and a disagreement between two memberships is reported as unknown.

  • Completeness is proven, not assumed. Every page is counted; a failed page, a total_items that differs from the collected count, the max_credentials cap or an unread group marks the inventory incomplete and names the reason. A failed detail read keeps the percentage inventory complete but marks cost coverage incomplete. At max_credentials the payload never presents the unread remainder of the current group as the total: omitted_credentials is null, omitted_credentials_complete is false, omitted_credentials_lower_bound is the known remainder, and unread_groups names the groups that were not read at all. No page is fetched past the cap just to size them.

  • Percentages are percentage points. The per-window rollup sums used_percent across credential records and reports coverage_ratio; it never converts to tokens and never claims every account has equal capacity.

  • Cost is per window and is not a bill. estimated_reference_cost_nano_usd is the integer nano-USD value GPT Load prices the window's full-hour usage at from its model price table, with data_complete, usage_complete and pricing_complete. A 5h and a 7d window cover the same traffic, so the rows are separate and must not be added together. billed_api_cost says not_derived: subscription quota is not billed, and /api/usage estimates use the same price table rather than an invoice. The per-window sum is over credential records and says so (aggregation_basis: credential_records). Coverage and exactness are separate: estimated_cost.complete means the whole requested inventory was read and every needed detail read succeeded (scope_complete, detail_complete, with partial_reasons), while a row's record_sum_exact only says the arithmetic over the records read is exact. A row's exact is whole-inventory distinct-account exactness, so a truncated inventory, a failed page, a failed detail read (lower_bound), a mask collision (identity_ambiguity with distinct_account_lower_bound_nano_usd) or an id-less record (identity_unverified, no numeric bound) all leave exact: false without discarding the native record sum.

Safety model

  • No secret in model context. AUTH_KEY does not appear in tool output, logs or errors. Credential values, proxy URLs with credentials, access-key secrets and OAuth material are written to 0600 files in a 0700 directory with TTL, size limits and checksums; tools return metadata and masks. The payload is read only through the local artifact get command. The artifact files are owner-readable on the host and are not encrypted at rest.

  • No hidden side channels. No shell, no database access, no service restarts, no browser automation, no implicit background jobs. Every network call is a documented GPT-Load route and is labelled with its effect.

  • Multi-step changes are plans, not transactions. change_preview records expected-before fingerprints for readable targets and returns a plan_id; change_apply refuses without an approval recorded on this host (APPROVAL_REQUIRED) unless policy.allow_unapproved_apply is set, and writes a journal entry before each step. That setting explicitly delegates consent for the extra out-of-chat gpt-load-mcp approve <plan-id> step; it does not disable the MCP client's own approval gate. A cancel is terminal and only one apply can claim a plan. Before a step runs, apply re-reads a readable target and refuses with PRECONDITION_FAILED when the fingerprint recorded at preview no longer matches; a failed preflight read is PRECONDITION_READ_FAILED/PRECONDITION_UNAVAILABLE and the step is not sent, so an edit made after preview is not silently overwritten. This is a read-then-write, not an atomic CAS: a concurrent edit can still land between the check and the write. A create step has no earlier object and therefore carries no fingerprint. Reconcile reports what a readback showed; only a NOT_FOUND readback proves absence.

  • Every mutation attempt is journaled. Single-call mutation tools (create/update/delete a group, credential, proxy, access key or price) execute immediately at the configured role with no plan and no server-side approval step. The shared invoke boundary appends a durable intent entry (fsynced) after every local gate and immediately before the request is sent, then exactly one terminal phase: applied, failed for a definite refusal, or unknown with may_have_applied for a lost/ambiguous response. If the intent cannot be written, nothing is sent; if the terminal phase cannot be written, the call is reported as OUTCOME_UNKNOWN, never success. Reads and post-mutation readbacks are not journaled. The mutation id is returned in meta.mutation_id or in the error details, and gptload_operation_get / gptload_operation_reconcile accept it; reconcile is read-only and can attach mutation.reconcile evidence without retrying. The journal stores ids, codes, hashes, artifact ids/hashes and multipart file names/sha256s only — never bodies, headers, secret values or upstream messages. Multi-step plan correlation is carried down to the same boundary, so a step is logged exactly once per phase. "No approval step" here is server-side only: while the host runs approvals the MCP client's trust gate still applies, and with Hermes trust: untrusted plus approvals.mode smart/manual the user is asked before the call reaches the server. If you need a recorded approval for every change, use change sets instead of direct mutations.

  • Config parsing fails closed. Unknown config keys are rejected, a typo cannot silently disable a safety setting, and an unknown upstream version blocks writes rather than guessing. This does not make this build safe overall — see the known limits below.

Known limits.

  • Outbound destination validation is literal and read-before-write, not a guarantee. Public hostnames are not resolved before use, so a name can resolve to a metadata or private address at dial time (DNS rebinding) without the policy seeing it. A managed proxy (proxy_id) or an out-of-band edit of the proxy catalog can change the effective URL between the guard's catalog read and the dial. Both remain open.

  • Direct single-call mutations still have no approval step, but they are journaled: intent before send and one terminal phase, with a returned mutation id. A journal that cannot record the intent blocks the send; a failed terminal write is reported unknown. The journal is not an approval or a transaction.

  • Applying a plan is claimed once per journal, but a plan file copied to another host is outside that claim; group_create steps also have no expected-before fingerprint, because there is no earlier object to compare. Treat a restored or copied plan store as new intent and preview it again.

Do not treat the destination check, a reconcile verdict or the local journal as a complete safety control in this build.

Compatibility and status

Upstream release

Status

Behaviour

v2.0.0-rc.67 (with or without the v prefix; build metadata after + is accepted)

supported

full surface, according to the configured role

v2.0.0-rc.68 (same + rule)

supported

full surface; accepted on an audit entry showing the control route table is byte-identical to rc.67 (93 routes) and that header_rules.default is additive

v2.0.0-rc.69 (same + rule)

supported

full surface; same route table (93 routes, zero non-test control files changed) plus https as an outbound proxy scheme

anything else, including v2.0.0-rc.70, v2.0.0-rc.69x and v2.0.0-rc.69.1

unknown

reads only; writes, probes and secret operations return UPSTREAM_VERSION_UNVERIFIED

The route table, DTO shapes and idempotency rules are pinned per release; a new upstream release requires a re-audit and a new entry in compat.SupportedReleases. There is no "assume latest" mode, no wildcard and no silent route probing. Exact coverage, internal-only routes and the honest gaps are in docs/compatibility.md; the reproducible audit procedure is docs/compatibility-runbook.md.

The code supports the full 116-tool surface under secret-operator, and tests/stdio exercises all six secret operations plus OAuth reachability against the fake API only. This repository does not change a host's role; the example configs are starting points.

This is a working implementation, not a production certification. CI runs gofmt, go vet, go test ./..., go test -race ./..., a build, a catalog check and a gitleaks history scan on pushes to main and on pull requests. The tests drive the server against the repository's local fake API, and a stdio test drives the built binary the way a client would. Green CI means those checks pass; it is not client certification and says nothing about a real GPT-Load deployment. No third-party MCP client has been certified — the protocol-level test speaks raw JSON-RPC, and the server is built on an official MCP SDK; the server negotiates MCP 2024-11-05 … 2025-11-25 over stdio.

What it does not do

  • No channel create/delete (the pinned release exposes only GET /api/channels).

  • No generic task API, database restore, cross-resource transaction or atomic rollback.

  • No future-route simulation: route/inspect explains the current snapshot only.

  • No full leaderboard or latency percentiles: /api/usage returns top-5 plus an Other aggregate.

  • No remote human-approval channel; plan approval is local (or explicitly delegated), and it covers change sets only — direct mutation tools have no approval step.

  • No whole-config import (the pinned release has no such route), no systemd/Docker management, no shell.

Development

make test        # go test ./...
make race        # go test -race ./...
make vet
make build VERSION=0.1.3
make catalog     # regenerate docs/coverage.md

The test suite uses internal/fakeapi, a local stand-in for the GPT-Load control API that implements the rc.67 envelope, strict query allowlists, the seven Idempotency-Key routes and failure injection (including timeout-after-commit). No test contacts a real GPT-Load instance or a real provider.

Docs, help, security, license

Unofficial. Not affiliated with, endorsed by or supported by the GPT-Load authors. It talks to GPT-Load only through its public HTTP API and contains no GPT-Load source code.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers