MCP Server
Connect AI agents to WS Model Proxy over /mcp using OAuth 2.1 with optional DPoP or agent tokens, configure fine-grained scopes and node allowlists, and explore all 28 tools.
WS Model Proxy includes a built-in Model Context Protocol (MCP) server at POST /mcp so coding and ops agents can inspect your fleet, manage pools and runtimes, apply profiles, run diagnostics, and edit node files within explicit per-credential boundaries.
The MCP server is enabled by default. Set WMP_MCP_ENABLED=false and restart to turn it off completely: /mcp, OAuth endpoints, discovery documents, and MCP login/consent pages then return HTTP 404 while Access → Agents remains available for revoking existing credentials.
Important: While
WMP_MCP_ENABLED=true,BETTER_AUTH_URLmust usehttps://(plainhttp://is accepted only onlocalhost,[::1], and127.x.x.xfor local development).
Transport and Protocol
- Endpoint:
POST https://models.example.com/mcponly. Any other HTTP method (GET,DELETE, etc.) receives405 Method Not AllowedwithAllow: POSTbefore authentication. - Protocols:
- Primary: MCP
2026-07-28(responseMode: "json", no subscriptions/notifications). Requires header/body agreement:MCP-Protocol-Version,Mcp-Method, and (when calling a tool)Mcp-Name. - Compatibility: Stateless
2025-06-18Streamable HTTP (Accept: application/json, text/event-stream, 15 s SSE keepalive for long tool calls).
- Primary: MCP
- Stateless & single-message: No MCP session IDs or sticky routing. JSON-RPC batch arrays are rejected with HTTP 400 (
-32600), and request bodies are capped at 1 MiB. - No cookie auth: Only
Authorization: BearerandAuthorization: DPoPauthenticate/mcp.
Authentication Options
1. OAuth 2.1 (with optional DPoP)
Interactive MCP clients discover and authorize against four standard metadata endpoints:
- Protected Resource (RFC 9728):
/.well-known/oauth-protected-resourceand/.well-known/oauth-protected-resource/mcp - Authorization Server (RFC 8414):
/.well-known/oauth-authorization-server/api/authand/api/auth/.well-known/oauth-authorization-server
Key properties:
- Registration: Supports both CIMD (Client ID Metadata Document hosted over public HTTPS) and unauthenticated RFC 7591 Dynamic Client Registration (
POST /api/auth/oauth2/register, rate-limited globally at 60/hour). Unused DCR registrations expire after 24 hours. - PKCE: Mandatory (
S256only) for public clients. Grant types are limited toauthorization_codeandrefresh_token. - Token lifetimes: Access JWTs are valid for 10 minutes (audience-bound to the canonical
/mcpURL) and checked live against the databaseMcpGranton every call. Refresh tokens rotate on every use with a 72-hour rolling inactivity expiry and a 30-second cached retry window. - DPoP (sender-constrained, recommended): Clients can register with
"dpop_bound_access_tokens": trueand send an RFC 9449DPoPproof JWT (ES256,htumatching the canonical public token or/mcpURL,athon/mcp). Behind a reverse proxy, preserve the canonicalHostheader so DPoPhtuvalidation succeeds.
2. Agent Tokens (wsmp_agent_...)
For headless scripts, CI, or clients that prefer static bearer credentials, create an agent token in the browser under Access → Agents:
- Choose exact scopes, allowed nodes, and an expiry (default 90 days, capped by
WMP_AGENT_TOKEN_MAX_LIFETIME_DAYS, range 1–3650). - Up to 10 active agent tokens per user.
WMP_AGENT_TOKEN_ALLOW_NO_EXPIRYdefaults totrue. Setting it tofalseboth prevents creating new no-expiry tokens and immediately blocks existing no-expiry tokens (401 invalid_tokenwithmcp_pat_no_expiry_blocked) until re-enabled.- Send as
Authorization: Bearer wsmp_agent_....
Client Configuration Examples
Claude Code
Using OAuth 2.1 (opens your browser to sign in and choose scopes/nodes):
claude mcp add --transport http wsmp https://models.example.com/mcp
Or with a headless agent token:
claude mcp add --transport http wsmp https://models.example.com/mcp \
--header "Authorization: Bearer wsmp_agent_..."
Codex
In ~/.codex/config.toml (with OAuth or a bearer token from an environment variable):
# OAuth 2.1 discovery
[mcp_servers.wsmp]
url = "https://models.example.com/mcp"
# Or static agent token via environment variable
[mcp_servers.wsmp]
url = "https://models.example.com/mcp"
bearer_token_env_var = "WSMP_AGENT_TOKEN"
Generic MCP Client JSON
{
"mcpServers": {
"wsmp": {
"type": "http",
"url": "https://models.example.com/mcp",
"headers": {
"Authorization": "Bearer wsmp_agent_..."
}
}
}
}
Scopes and Owned-Node Allowlists
Every credential—both OAuth grants and agent tokens—always includes read and may opt into any combination of six fine-grained scopes. Tools outside a credential’s effective scopes are omitted from tools/list and fail as unknown tools when called.
| Agent Scope | OAuth Scope | Unlocked Tools |
|---|---|---|
read (required) |
mcp:read |
nodes_get, runtimes_get, pools_get, profiles_get, providers_get, requests_list, metrics_query |
pools |
mcp:pools |
pool_create, pool_update, pool_delete |
runtimes |
mcp:runtimes |
runtime_create, runtime_update, runtime_delete, runtime_start, runtime_stop, profile_save, profile_apply, profile_delete |
nodes:manage |
mcp:nodes:manage |
node_update, node_delete, node_secret_set |
commands |
mcp:commands |
node_command_run, node_command_get, node_command_queue_for_user |
files |
mcp:files |
node_file_read, node_file_write, node_file_edit |
models:test |
mcp:models:test |
model_test |
offline_accessis an OAuth-only scope that enables refresh tokens without adding tools.- The legacy
mcp:writescope was removed in 1.0 and returns400 invalid_scope. - For OAuth connections, effective access is always the intersection of the token’s OAuth scopes and the grant’s current agent scopes edited in Access → Agents.
Owned-Node Allowlists
At consent or token creation (and editable anytime in Access → Agents), choose either all owned nodes (nodeIds: null, including future nodes) or an explicit list of owned nodes ([] allows no nodes):
- Owned nodes only: Sharing a pool or runtime definition never grants an agent access to another user’s hardware—including
model_test, which fails if any candidate placement uses an unowned or disallowed node. - Hidden instances & filtered metrics: When a node allowlist is restricted, any instance bound to—or holding a rank or reservation on—a disallowed node is hidden everywhere (
nodes_get,runtimes_get,pools_get,requests_list, andmetrics_query). - Immediate narrowing & revocation: Narrowing scopes, removing a node from an allowlist, or revoking a credential immediately aborts all in-flight MCP tool calls (including reads), cancels disallowed running node commands and file operations, expires queued commands for newly disallowed scopes/nodes, and clears pending claim-release requests.
Human-Only Boundaries and Safety Guardrails
Even with all seven scopes granted, certain operations remain strictly human-only in the browser (never exposed on MCP):
- Managing pool/runtime shares, API keys, agent tokens, and OAuth grants.
- Enabling cloud fallback modes (
pools.cloud.setMode), paid warm protection, own-key consent, provider accounts/keys/pricing/spend caps, and OpenRouter data-collection settings. - Creating/revoking node enrollment codes, raising or lowering node trust, setting node hold lines, and opening browser terminals.
- Force-releasing unproven stop claims (
runtimes.instances.releaseUnproven). Agents may instead submit an evidence-backedrequestReleaseviaruntime_stopfor a human to approve or decline. - Running or dismissing queued commands.
Queuing Commands for a Human (node_command_queue_for_user)
When a task requires interactive input or elevated privileges (such as a sudo password), an agent calls node_command_queue_for_user with a mandatory note explaining why. The command waits in the dashboard Terminals page until a human clicks Run and presses Enter (or dismisses it).
- Queued commands expire after
expiresInHours(default 24, max 168) or if the queuing credential is revoked or narrowed. - The agent can poll status (
QUEUED,RUN,DISMISSED,EXPIRED,REFUSED,WITHDRAWN) vianode_command_get(output is never returned because it runs in the human’s terminal), and only the queuing credential can withdraw a still-queued command usingcancel: true.
Confirmation Literals and Node File Guardrails
- Confirmation literals: Destructive or high-impact calls require an explicit literal:
confirm: "DELETE"on deletes,confirm: "RUN"onnode_command_run, andconfirm: "MARK_STOPPED"onruntime_stopwithmarkStopped: true. - Node files (
filesscope): Require a Full-control node and operate only on absolute paths insidefeatures.files.roots(default: user home directory; configured locally on the node viawsmp config set-file-roots). Reads paginate at 400 lines / 32 KiB (up to 64 MiB files) and return anetag.node_file_editrequiresifMatch, andnode_file_writerequiresifMatchto overwrite existing files (max 1 MiB decoded write, constrained by the 1 MiB/mcpbody cap).wsmp’s own credentials, secrets, binary, and state directory are off limits.
Warning: Node commands and file tools run with the OS permissions of the
wsmpdaemon account on Full-control nodes. Path restrictions and output redaction are guardrails, not an OS sandbox.
Tool Catalog (28 Tools)
Every tool result is JSON-formatted, redacted of WMP secrets, and capped at 256 KiB (OUTPUT_TOO_LARGE).
Read Tools (read scope)
| Tool | Description |
|---|---|
nodes_get |
List allowed nodes or inspect one in detail (trust, hardware, fabrics, hold, held definitions, instances, detected local servers, secret names). |
runtimes_get |
List or inspect runtimes, version lists, full version specs, presets, and shared definitions. |
pools_get |
List owned and shared pools, or inspect one pool (members, change history, model-name aliases). |
profiles_get |
List or inspect multi-node profiles, pinned versions, hold lines, and whether pins are satisfied. |
providers_get |
List cloud provider accounts, models, active prices, and current-month spend (never keys). |
requests_list |
Inspect recent content-free request metadata (route, target, timings, tokens, compat notes, errors). |
metrics_query |
Query minute/hour rollups for request metrics, engine load, node gauges, and custom:<name> node metrics (excludes model_test / Test page unless includeTests: true). |
Pool Tools (pools scope)
| Tool | Confirm | Description |
|---|---|---|
pool_create |
— | Create a pool from your served models (cloud fallback stays off). |
pool_update |
— | Update an owned pool, contribute/withdraw served models on shared pools, or manage model-name aliases. |
pool_delete |
DELETE |
Delete a pool along with its shares, contributions, API-key bindings, and sidecar links. |
Runtime & Profile Tools (runtimes scope)
| Tool | Confirm | Rate Limit | Description |
|---|---|---|---|
runtime_create |
— | /mcp |
Define an always-on or startable runtime, or fork a shared definition (forkFrom). |
runtime_update |
— | /mcp |
Save a new runtime version (with optional note and restartRunning) or declare model tools/reasoning capabilities. |
runtime_delete |
DELETE |
/mcp |
Delete a runtime with no running instances and no profile pins. |
runtime_start |
— | 10/min (shared) | Preview or start a startable runtime (or restart an instance). Refused on Relay-only or held nodes. |
runtime_stop |
MARK_STOPPED (optional) |
10/min (shared) | Stop an instance or runtime, mark an unproven stop MARK_STOPPED, or submit/withdraw a requestRelease. |
profile_save |
— | /mcp |
Create or replace a profile’s owned nodes and pinned runtime versions. |
profile_apply |
— | 10/min (shared) | Preview or apply a profile across its nodes (refused if any owned node is Relay only). |
profile_delete |
DELETE |
/mcp |
Delete a profile without stopping running instances. |
Node Management Tools (nodes:manage scope)
| Tool | Confirm | Description |
|---|---|---|
node_update |
— | Update labels, port range, hardware declarations, metricCommands (up to 16), fabrics, command lifetime, or trigger a rescan on a Full-control node. |
node_delete |
DELETE |
Delete an offline or stale-heartbeat node (refused with node_online while live). |
node_secret_set |
— | Write or delete (value: null) a WSMP_SECRET_* on a Full-control node. Never logged or echoed. |
Command Tools (commands scope)
| Tool | Confirm | Rate Limit | Description |
|---|---|---|---|
node_command_run |
RUN |
30/min (shared) | Run a one-off text or argv command on a Full-control node (up to 4 KiB; answers within ~15 s). |
node_command_get |
— | /mcp |
Poll command state and 64 KiB output tail (waitMs up to 30 s) or cancel/withdraw (cancel: true). |
node_command_queue_for_user |
— | 30/min (shared) | Queue a command (with mandatory note) for a human to review and run in Terminals. |
File & Testing Tools (files and models:test scopes)
| Tool | Scope | Rate Limit | Description |
|---|---|---|---|
node_file_read |
files |
/mcp |
Read (paginated), stat, list, or search under a Full-control node’s allowed file roots; returns etag. |
node_file_write |
files |
/mcp |
Create, replace (with ifMatch), mkdir, rename, or delete files under allowed roots. |
node_file_edit |
files |
/mcp |
Apply up to 20 exact-text replacements with required ifMatch; returns new etag and diff. |
model_test |
models:test |
2/min (bench) |
Send a test or benchmark to a local pool callable ID (never :external) or an owned runtime (runtime:<id>:<model>). |
Rate Limits
All rate limits are process-local (in-memory) and scale by WMP_RATE_LIMIT_SCALE (default 1, range 0.1–100) with fixed windows:
/mcpendpoint: 120 requests / 60 s per IP (pre-auth), plus 120 requests / 60 s per authenticated identity (sub + client_id).- OAuth consent/continue: 30 requests / 60 s per signed-in user.
- Dynamic Client Registration: 60 requests / 3600 s across the entire server.
- Tool-specific limits:
runtime_start+runtime_stop+profile_applyshare 10/min;node_command_run+node_command_queue_for_usershare 30/min;model_testwithbenchallows 2/min.