Agents (MCP server)
rustman mcp serve runs Rustman as a Model Context Protocol server, so an AI agent (Claude Code, Claude Desktop, IDE agents, any MCP client) can use your workspace: its saved requests, environments, explorations and reports. The agent goes through the same engine and the same safety policy as you. It can’t read secret values, it is read-only unless rustman.toml says otherwise, and every call it makes is written to an audit log.
The server is built on the official Rust SDK, rmcp 3.10. It negotiates MCP protocol revisions up to 2025-11-25 through initialize.
Setup
Claude Code
From the workspace folder (or any folder below it):
claude mcp add rustman -- rustman mcp serve
Claude Desktop and other clients
Configure a stdio server whose command is rustman with the arguments mcp serve --workspace /path/to/workspace:
{
"mcpServers": {
"rustman": {
"command": "rustman",
"args": ["mcp", "serve", "--workspace", "/path/to/workspace"]
}
}
}
rustman mcp serve finds the workspace like every other command: --workspace <dir>, else the folder holding rustman.toml at or above the current one. Without a workspace it exits with code 2 before the handshake. The session starts in the active environment (--env, else RUSTMAN_ENV, else default_environment); an agent can switch environments for its own session only.
Over stdio, stdout carries only MCP messages. Warnings, errors and logs (-v, RUST_LOG) go to stderr, redacted.
HTTP mode
For clients that can’t spawn a process, --http serves the Streamable HTTP transport at /mcp:
rustman mcp serve --http # http://127.0.0.1:8765/mcp
rustman mcp serve --http 127.0.0.1:9000 --token-file ~/.config/rustman/mcp-token
HTTP mode is a convenience for local tools, not a hosted service. Three locks protect it:
- Loopback bind. The default address is
127.0.0.1:8765. A non-loopback address such as0.0.0.0:8765is refused with exit code 2 unless--allow-remoteis also given, and then a warning is printed. Requests whoseHostis not a loopback name are rejected. When--allow-remoteserves a non-loopback address thisHostcheck is off (on a loopback address it stays on), because remote clients reach the server under names it cannot know: the bearer token and the Origin check below are then the only locks, so keep the token secret and serve remote mode only on a trusted network. - Bearer token. Every request needs
Authorization: Bearer <token>. The token is read from--token-file(surrounding whitespace is ignored, and an empty file is an error) or generated at startup (32 random bytes, base64url) and printed once on stderr. A missing or wrong token gets401and never reaches MCP. Tokens are compared in constant time. - Origin check. A request carrying an
Originheader gets403unless the origin is a loopback origin (localhost,127.0.0.0/8,[::1]) or listed in[agent].allowed_origins. This stops a web page from driving the server through DNS rebinding.
There is no TLS and no OAuth: keep HTTP mode on the loopback interface.
Permissions: the [agent] table
Agent permissions come only from rustman.toml. No command-line flag raises them, so an agent that can run shell commands can’t relaunch the server with more rights, and a change to them shows up in git diff and code review.
Without an [agent] table, these defaults apply:
[agent]
allow_mutations = false # POST, PUT and PATCH
allow_destructive = false # DELETE and unknown methods (implies allow_mutations)
require_confirmation = true # mutations need a client that can ask the human
allowed_hosts = [] # empty: the hosts of the session's active environment
allowed_origins = [] # browser origins accepted in HTTP mode, besides loopback
max_output_bytes = 262144 # cap on one serialized tool result (256 KiB)
max_jobs = 2 # background jobs at once
plugin_kinds = [] # plugin request kinds agents may run (each counts as a mutation)
allowed_hosts and allowed_origins take origins written as scheme://host[:port], as [safety].allowed_hosts does. Unknown keys and invalid values are errors, so a misspelled permission is never ignored.
What an agent may send
Every request an agent triggers, saved or ad hoc, passes these checks before anything is sent:
- Method. By default only GET, HEAD and OPTIONS.
allow_mutations = trueadds POST, PUT and PATCH;allow_destructive = trueadds DELETE and every other method. A refused method getscode: "blocked"with the reasonmutations not allowed for agentsordestructive not allowed for agents. - Allowlist. The origin must be in
[agent].allowed_hosts, or, when that is empty, among thehttp(s)origins of the session’s active environment variables (base_url: http://127.0.0.1:8080/apiallowshttp://127.0.0.1:8080).[safety].allowed_hostsdoesn’t apply to agents. Anything else getscode: "blocked"with the reasonhost not allowed, and so does every redirect hop that leaves the allowlist. - Production. An environment marked
production: true, or a host in[safety].production_hosts, is refused: agents can’t confirm production hosts. - Confirmation. See below.
A request of a plugin kind is run by its plugin, under the plugin’s own grants, not sent by the agent gate. It runs only when plugin_kinds lists its kind, counts as a mutation (it needs allow_mutations and the human’s confirmation), and is audited with the kind as its method and <kind>:<request id> as its URL. An unlisted kind gets code: "blocked" with plugin kind '<kind>' not allowed for agents (list it in [agent] plugin_kinds). The network requests the workspace’s plugins send in an agent session must also reach an origin of the allowlist above, and each one gets an audit line (see Plugins).
All the requests of a session share one rate limit and one concurrency limit, from [safety].rate and [safety].concurrency, rpc_call calls included (over HTTP or WebSocket).
rpc_call sends JSON-RPC calls, which are all POSTs: instead of the method rule it only sends methods matching [jsonrpc] agent_read_only_methods, and refuses subscriptions; the allowlist and production checks apply as above. See JSON-RPC.
grpc_list, grpc_describe and grpc_call check a gRPC target as the http or https origin it is reached over (grpc://h:1 as http://h:1); grpc:// and grpcs:// values of the active environment count for the allowlist like http(s) ones. grpc_call calls unary and server-streaming methods only. Every gRPC call is a POST, so the method rule reads the proto instead: a method marked option idempotency_level = NO_SIDE_EFFECTS; is a read, and any other method is a mutation, which needs allow_mutations and the human’s confirmation like an HTTP POST. See gRPC.
graphql_introspect and graphql_query reach the endpoint through the same sender as rpc_call (allowlist, production check and rate limit, on every request and redirect hop). Every GraphQL operation over HTTP is a POST, so the method rule reads the operation instead: a query is a read, and a mutation needs allow_mutations and the human’s confirmation like an HTTP POST (refused with blocked: mutations not allowed for agents otherwise). Subscriptions, and saved requests with transport: ws or sse, are refused with code: "blocked". So are an endpoint URL that carries query, operationName or extensions parameters (some servers run those in place of the POSTed body, so the operation the human confirmed might not be the one that runs) and $file upload markers in the variables of an ad-hoc graphql_query operation (an agent can’t attach a workspace file; a saved request you wrote may still upload one). graphql_query validates the document against the request’s active schema before sending, as rustman graphql query does without --no-validate; an invalid document comes back with outcome: "errored" and nothing is sent. graphql_introspect reads the schema_file or the cached schema and introspects the endpoint only when there is neither, or with refresh: true; the result is cached in .rustman/graphql/schemas/ like rustman graphql introspect’s.
send_request and run_collection also run saved kind: kafka, kind: mqtt and kind: amqp request files. A produce is a mutation (refused with blocked: produce requires allow_mutations unless [agent] allow_mutations, then confirmed by the human), a consume from a named AMQP queue without requeue or through a persistent MQTT session (clean_session: false) is destructive, and every broker (and a Kafka schema_registry.url) must pass the allowlist as its http(s) origin (mqtt:// and amqp:// URLs of the active environment count; Kafka host:port brokers need [agent] allowed_hosts). Agent consumes stop after at most 100 messages or 60 s. See Messaging.
The EVM tools (evm_call, evm_decode, evm_tx, evm_block, evm_logs_query, evm_ens) are read-only: they reach nodes through the same sender as rpc_call (allowlist and rate limit), pass the JSON-RPC method guards, never take or send a signed transaction, and evm_logs_query spans at most 10,000 blocks. See EVM toolkit.
realtime_listen opens a WebSocket or SSE session and returns the messages it received, after at most 100 messages or 60 s. Its URL must pass the allowlist (a ws:// URL is checked as its http:// origin, wss:// as https://), and sending frames is a mutation: refused with blocked: sending frames requires allow_mutations unless [agent] allow_mutations, and confirmed by the human otherwise. See WebSocket and SSE.
send_request and run_collection compare snapshots in CI mode: an agent never writes or updates a snapshot file, and a missing snapshot fails the assertion.
Human confirmation
When mutations are allowed, each mutating request first asks the human, through MCP elicitation, with the method, the redacted URL and the environment:
An agent wants to send DELETE http://127.0.0.1:8080/users/7 (environment 'local'). Allow it?
Only an explicit yes sends the request. Declining or dismissing the question gets code: "declined". A client that doesn’t support elicitation gets code: "confirmation_unavailable", unless require_confirmation = false: that setting accepts unattended mutations and should be used only when you trust the agent’s every call. A client that supports elicitation is always asked, whatever the setting. If asking fails, the call fails with confirmation_unavailable.
Clients that speak the stateless 2026-07-28 revision can’t receive elicitation requests from the server, so for them mutations fail closed with confirmation_unavailable (or need require_confirmation = false).
Tools
Every tool declares an input and an output JSON Schema, and returns structuredContent that conforms to its output schema, plus a one-line summary as text. Tools are thin adapters over the same engine calls the CLI makes.
The reference below is generated from the tool schemas that tools/list returns; a test keeps it in sync.
| Tool | Arguments (required) | Read-only | Description |
|---|---|---|---|
list_requests | collection, kind, text, cursor, limit | yes | List the workspace’s saved requests, filtered by collection folder, kind or text, 50 per page. |
get_request | path | yes | Read one saved request file by its id or path. Secrets appear as {{name}} references, never as values. |
list_environments | none | yes | List the environments: names, which is active in this session, and variable and secret names. |
select_environment | name | yes | Make an environment active for this session only; nothing is written to disk. |
send_request | path, vars, method, url, headers, body, timeout_ms | no | Send a saved request (path, optional vars) or an ad-hoc one (method, url, headers, body) through the safety policy. Returns the redacted exchange. |
run_collection | path, filter, vars, bail | no | Run the requests under a folder or file like rustman run, in the background. Returns a job_id; get_report with it gives the run report. |
import_openapi | spec, into, dry_run | no | Import an OpenAPI document (a workspace file or an allowed URL) as a request collection. dry_run (the default) only reports what would change. |
explore_plan | spec, target, probes, operations, seed, fuzz_cases, allow_mutations, allow_destructive, cursor, limit | yes | Plan the probes of an exploration against a target without sending anything. Review it before explore_run. |
explore_run | spec, target, probes, operations, seed, fuzz_cases, allow_mutations, allow_destructive, cursor, limit, max_probes, max_duration_ms, fail_on | no | Start an exploration in the background (read-only unless rustman.toml allows more). Returns a job_id and exploration_id. |
explore_status | id | yes | The phase, progress and findings by severity of an exploration, by job_id or exploration_id (default: the latest). |
explore_cancel | job_id | no | Stop a running exploration job. It stays resumable with rustman explore resume <id>. |
get_report | id, format | yes | A report by exploration id, run job id or JSON report file of the workspace (such as out/report.json): a summary (default), or rendered as json, markdown, junit, sarif or html. |
list_findings | exploration_id, severity, operation, cursor, limit | yes | The findings of an exploration (default: the latest), filtered by minimum severity and operation, 50 per page. |
search_history | url, method, status, since, until, cursor, limit | yes | Search recorded exchanges by URL text, method, status range (500-599, 5xx, 404) and time range, newest first, 50 per page. |
rpc_call | path, endpoint, method, params, vars, timeout_ms | no | Send one JSON-RPC call (endpoint, method, params) or a saved jsonrpc request through the safety policy. Only methods matching [jsonrpc] agent_read_only_methods are sent; subscriptions are refused. |
realtime_listen | path, url, frames, max_messages, duration_ms, vars | no | Open a WebSocket (ws:// or wss:// url) or SSE (http(s):// url) session, or a saved ws or sse request, through the safety policy, optionally send initial frames (a mutation: needs [agent] allow_mutations), and return the redacted messages received, after at most 100 messages or 60 s. |
graphql_introspect | endpoint, path, type_name, refresh, vars | yes | The schema of a GraphQL endpoint or saved graphql request: its schema_file or cached schema, else (or with refresh) introspected through the safety policy and cached. Lists the root and named types, or describes type_name. |
graphql_query | path, endpoint, query, operation_name, variables, headers, vars, timeout_ms | no | Validate and send a GraphQL query or mutation (endpoint, query, operation_name, variables, headers) or a saved graphql request over HTTP through the safety policy. A mutation needs [agent] allow_mutations and the human’s confirmation; subscriptions are refused. Returns the redacted data and errors. |
list_webhook_captures | path, method, verdict, since, cursor, limit | yes | List the webhook captures saved to request history from the webhook inspector, newest first, filtered by path text, method, signature verdict and time, 50 per page. Redacted; nothing is replayed. |
grpc_list | target, path, refresh, vars | yes | List the services and methods (with call types) of a gRPC target or saved grpc request, by reflection or its schema, through the safety policy’s allowlist. |
grpc_describe | symbol, target, path, refresh, vars | yes | Describe a gRPC service, method (with a request message template) or message of a target or saved grpc request. |
grpc_call | path, target, method, message, metadata, deadline_ms, vars | no | Call a unary or server-streaming gRPC method (target, method, message, metadata) or a saved grpc request through the safety policy. Returns the redacted status, metadata and messages; streams stop at 100 messages or 30 s. |
evm_call | path, rpc, to, abi, function, args, block, from, estimate, vars | yes | Run a read-only eth_call (a saved evm-call request, or rpc, to, abi, function, args, block) through the safety policy and return the decoded outputs or revert, with the node’s chain and client. Never signs or sends a transaction. |
evm_decode | abi, data, topics | yes | Decode call data, revert data or (with topics) a log with an ABI (erc20, erc721, erc1155 or a workspace ABI file), offline. |
evm_tx | hash, rpc, vars | yes | Read a transaction and its receipt by hash, with input data and logs decoded (token amounts in token units). |
evm_block | block, rpc, vars | yes | Read a block by number, tag or hash: number, hash, timestamp, gas and transaction count. |
evm_logs_query | from_block, to_block, addresses, event, topics, rpc, vars | yes | Query logs by address, event signature and topics over a block range of at most 10000 blocks, decoded. |
evm_ens | target, rpc, vars | yes | Resolve an ENS name to an address, or an address to its primary name verified by a forward lookup (needs a mainnet endpoint or [evm] ens_rpc). |
Some tools belong to an optional capability and are registered only when rustman-mcp is built with its cargo feature: graphql_introspect and graphql_query with graphql, list_webhook_captures with webhook, and grpc_list, grpc_describe and grpc_call with grpc. All three features are on by default, so the rustman binary has every tool. A build without a feature (for example --no-default-features --features grpc) doesn’t list its tools in tools/list, and calling one gets a protocol error, like any unknown tool.
list_webhook_captures reads the captures you saved to request history from the webhook inspector (save to history, request webhook). The agent server runs no listener, so a capture that was never saved isn’t visible to agents. The captures were redacted when saved and are redacted again on the way out; bodies longer than the inline limit come with a body_ref like send_request’s.
Notes:
- Saved and ad-hoc requests go through the runner like
rustman send: variables, auth, assertions, captures and history all apply. Requests with OAuth2 auth can’t be sent by agents, because the token flow may need a browser; runrustman auth loginand send them yourself. Requests with Digest auth are refused with an error rather than sent without credentials, because the agent path does not answer the challenge; send them withrustman send. explore_planandexplore_runread the document from a workspace file or from anhttp(s)URL on a host agents may reach. The target must be such a host too. The seed defaults to0, so a plan stays the same between its pages and theexplore_runthat follows; passseedto vary the fuzz cases. Probes are read-only unless the agent asks forallow_mutations(orallow_destructive) and[agent]allows it; a mutating exploration asks the human first.import_openapiwithdry_run: falsewrites workspace files, so it asks the human first, like a mutation (and fails withconfirmation_unavailablewhen the client can’t ask, unlessrequire_confirmation = false). The running session keeps the request list it started with; reconnect to see the new files.run_collectionandexplore_runstart background jobs; see below.
Background jobs
explore_run and run_collection answer within 2 seconds with a job_id and keep working in the background, so an agent never waits on a long call. At most max_jobs jobs (2 by default) run at a time across every session of the server; a further job-starting call, from any session, gets code: "busy" until one ends. A cancelled job keeps its slot until its work has really stopped.
- Status.
explore_statusreports an exploration’s state (running,completed,cancelled,interruptedorfailed), phase, probes done out of the total, and findings by severity.get_reportwith a run’sjob_idreturns the run report once the run ends; while it runs, the error message says how far it got (job-1 is still running (2/5 requests)). A report file is read only inside the workspace (a symlink leading out of it is refused) and up to 32 MiB; a file that is not a report is refused without quoting it. - Progress. When the
tools/callthat started a job carried a progress token (_meta.progressToken), the server sendsnotifications/progressfor that token every 2 seconds while the job runs, and once more when it ends.progresscounts probes or requests done,totalis the job’s size, andmessagereads likejob-1 running: 12/51 probes. Messages are redacted like every other output. Thetools/callitself has already answered with thejob_id, so these notifications arrive after its response; this is how the server keeps a long job visible without making the agent wait. The MCP specification expects progress to stop when its request completes, so a strict client may drop them or log them under an unknown token. Pollexplore_statusorget_reportwhen yours does. - Cancellation.
explore_cancelwith thejob_id(or exploration id) stops an exploration; an MCPnotifications/cancelledfor thetools/callthat started an exploration or a run does the same, if the client still sends one after that call answered (many clients only cancel requests still pending, so preferexplore_cancel). Cancelling stops dispatching new probes or requests, lets those in flight finish for up to 10 seconds, and still cleans up what the probes created, exactly like Ctrl+C onrustman explore run. The job’s status becomescancelled. - Resuming. An exploration is journaled under
.rustman/explorations/<id>/like one started from the terminal, so a cancelled exploration stays resumable:rustman explore resume <exploration_id>runs the probes that did not finish, and never sends one twice. A run’s report stays available for the session; an exploration’s report is written next to its journal.
Resources
| URI | Content |
|---|---|
rustman://requests/<path> | A request file of the workspace, by its path (users/get-user.rman.yaml) |
rustman://reports/<id> | A rustman.report/v1 report: an exploration id, or the job id of a finished run |
rustman://schemas/<name> | report (the report JSON Schema) or an imported OpenAPI snapshot from .rustman/openapi/ |
rustman://bodies/<id> | The whole redacted body of a truncated response (body_ref) |
Every content is redacted. A path with .., a root, a drive or a backslash is refused before anything is read, and only files the workspace loaded as requests are readable under rustman://requests/.
Prompts
explore-api(argumentsspec,target) guides an agent throughexplore_plan, reviewing the plan with the human,explore_run, pollingexplore_status, thenget_reportandlist_findings.triage-findings(argumentexploration_id) guides an agent through grouping an exploration’s findings by root cause, with reproduction steps and a proposed fix per cause.
Secrets and redaction
An agent can refer to secrets by name but never read their values, in any form. Engine output is already redacted; the server then runs a second pass over the final JSON of every tool result, resource, log and progress message, which replaces:
- every value of the session environment’s secrets, and of the secrets and credentials of every request sent in the session, in the forms the redactor matches (JSON, URL and HTML encodings) plus their base64 forms (standard and URL-safe, padded or not), with
«redacted:<name>»; - the values of the
Authorization,Proxy-Authorization,Cookie,Set-CookieandX-Api-Keyheaders wherever a header appears, with«redacted:<Header-Name>»; - literal credentials pasted into tracked request and collection files: those headers’ values and the credentials of
authblocks (a Basic password, a Bearer token, an API key value). They are redacted in every output, including the file textget_requestandrustman://requests/return. Literals shorter than 6 characters are too common to replace everywhere and stay visible in file text; use a{{secret}}reference for any credential.
A backend that echoes Authorization: Bearer <api_token> into its body is shown as Bearer «redacted:api_token». Other transforms of a secret (hashing, encryption, custom encodings) are not recognized.
Output limits
- A tool result whose JSON exceeds
max_output_bytes(256 KiB by default) is refused withcode: "invalid_input": narrow the request or page through it. - A response body over 32 KiB is cut to its first 32 KiB with
truncated: true, its fullsizein bytes, and abody_refsuch asrustman://bodies/b3. The whole redacted body stays readable throughresources/readwhile the session keeps it: each session keeps up to 64 MiB of bodies, dropping the least recently used first. - Lists return 50 items by default with a
next_cursorwhen more exist. Pass it back to get the next page; the last page has none. A cursor from a list that has changed since is refused.
Audit log
Every tool call appends one JSON line to .rustman/audit/<YYYY-MM-DD>.ndjson (UTC date) with the timestamp, session id, client name, tool, redacted arguments, outcome (ok, error, blocked or declined), the reason of a failed call and, for outbound requests, the method and redacted URL:
{"timestamp":"2026-11-18T10:04:12.311Z","session":"9f1c…","client":"claude-code","tool":"send_request","arguments":{"method":"POST","url":"http://127.0.0.1:8080/users"},"outcome":"blocked","reason":"mutations not allowed for agents","method":"POST","url":"http://127.0.0.1:8080/users"}
Plugin network requests in agent sessions get a line each too, with session plugins, client plugin and tool plugin:<name>.
Lines are appended with one write each; the server never rewrites or deletes them. Retention is up to you (the files are small). The audit log fails closed: if it can’t be written, the call is refused before it runs, or fails if the line can’t be appended afterwards. A background job checks it before each request it sends, so once the log can’t be written the job sends nothing more. .rustman/ is git-ignored by rustman init.
Error codes
Tool errors are tool results with isError: true and structuredContent {"code": "...", "message": "..."}, not protocol errors:
| Code | Meaning |
|---|---|
not_found | The request, environment, report or resource does not exist |
invalid_input | Malformed arguments, a stale cursor, or a result over max_output_bytes |
blocked | Refused by the agent permissions or the safety policy; the message is the reason |
declined | The human declined or dismissed the confirmation |
confirmation_unavailable | A mutating call needs confirmation and the client can’t ask |
busy | Too many background jobs are running (max_jobs) |
internal | Anything else, such as a network error or an audit log that can’t be written |