Skip to main content

Upstream Requests to the Client

An MCP server can ask its client for something in the middle of a tool call:

  • Elicitation (elicitation/create): ask the user a question or for approval, for example before a destructive command.
  • Sampling (sampling/createMessage): ask the client's model to generate text.
  • Roots (roots/list): ask which project folders the client is working in.

MCPProxy passes these requests to the MCP client that made the tool call and returns its answer to the upstream server. It works on every call surface: call_tool_*, the direct server__tool names, /mcp/s/<server> and code_execution.

The message of an elicitation starts with the server's name, like [ssh] Confirm destructive command…, so the user can tell which server is asking.

Turning it on​

It is off until you list, per server, what that server may use:

{ "mcpServers": [ { "name": "ssh", "command": "ssh-mcp", "client_features": ["elicitation"] } ] }

The values are elicitation, sampling and roots. A server is offered only the ones it lists, and a quarantined server is offered none. Changing client_features reconnects the server.

To turn it off for every server at once, whatever they list (takes effect after a restart):

{ "enable_client_features": false }

What upstream servers see​

When it connects to a stdio or streamable-HTTP upstream, MCPProxy declares the features listed in client_features: elicitation (form and URL modes), sampling and roots (with listChanged). Legacy SSE upstreams cannot send requests to their client, so they get none.

These requests exist on protocol revisions up to 2025-11-25, which MCPProxy uses on every upstream connection.

Who is asked​

One upstream connection is shared by every client of MCPProxy, so only the client whose call the request belongs to is asked:

  • A streamable-HTTP upstream that sends the request on the call's own response stream is matched to that call.
  • A request from a stdio upstream, or one sent on a streamable-HTTP upstream's standalone stream, carries no call. It goes to the client of the only call in flight to that server. With several calls in flight to the same server, nobody is asked.

The client must have declared the capability (and, for elicitation, the requested mode). A client on protocol 2026-07-28 or later cannot receive these requests.

Roots outside a call. Servers often ask for roots when they connect or when told the roots changed, outside any call. Such a request goes to the last client that called that server. When a different client calls the server, or the last client reports that its roots changed, MCPProxy sends the server notifications/roots/list_changed, so it asks again.

URL-mode elicitation. For one the user accepted, the server's notifications/elicitation/complete goes to the same client, even after the tool call has returned. MCPProxy waits up to an hour for it.

When nobody can be asked​

The upstream gets an immediate answer instead of waiting:

RequestAnswer
Elicitationdecline
Samplingan error
Rootsan empty list

This happens for calls from the REST API or the CLI (roots then go to the last client that called the server), requests sent outside a tool call, concurrent calls to a stdio server, and clients without the capability. The upstream cannot tell a decline given here from the user's own.

At most 4 requests of one server are answered at a time. The rest are refused at once (elicitation decline, otherwise an error) and not recorded.

Activity log​

Every request is recorded as a client_request activity: the server, the method, what the server asked (the first 4 KB, scanned for sensitive data) and whether the client was asked (metadata.outcome: forwarded, unanswered or failed). What the user, the model or the client answered is never stored, only its shape: the elicitation action with field names and sizes, the size of the sampling response, and the number of roots. Only administrators can read these rows.

mcpproxy activity list --type client_request

Limits​

  • The tool call's timeout (call_tool_timeout, default 2 minutes) bounds how long the user has to answer. A prompt left open past it stays on the client's screen; answering it then changes nothing.
  • For a request a streamable-HTTP upstream sends on the call's own response stream, the MCP library MCPProxy uses allows 30 seconds for the answer.
  • Sampling requests are not marked with the server's name: clients show MCPProxy as the requester.

Progress notifications​

When an MCP client sends a progressToken in a tool call's _meta, the upstream server's notifications/progress for that call are forwarded to that client, under the client's own token. Forwarding is best effort: an update is dropped when the client's session cannot take it at once, and a client connection that cannot receive notifications gets none. This needs no client_features entry and works on call_tool_*, the direct server__tool names and /mcp/s/<server>.

  • The upstream never sees the client's token. MCPProxy gives each upstream call a token of its own and maps it back to the calling client until the call returns, times out or the server disconnects. Two clients that use the same token each get only their own progress, and progress is never sent to any other client.
  • A call without a progressToken carries none upstream, and nothing is forwarded.
  • The message is text the upstream server wrote, and it is treated like the text of that tool's result under the output sanitisation policy: under block a message with a critical secret is left out, redact and control-character stripping apply as they would to the result, the message is then cut to 512 bytes, and the spotlight frame is added for untrusted tools when it is on. A message longer than 4 KiB is left out. progress (and total, when the upstream sent one) is forwarded either way.
  • At most one notification per call is forwarded every 100 ms; ones that arrive sooner, or whose progress does not increase, are dropped. The first one that reaches total is not held back by the interval.
  • code_execution sub-calls do not forward progress.

Log messages​

MCPProxy advertises the logging capability. An upstream server's log messages (notifications/message) are forwarded to the MCP clients that are calling that server, on call_tool_*, the direct server__tool names and /mcp/s/<server>. This needs no client_features entry.

  • A log message is not tied to one request, and one upstream connection serves every client. So a message goes only to the client sessions that have a tool call to that server in flight when it arrives, one copy per session. A session that is not calling the server, including any session whose token or profile cannot reach it, gets nothing. Messages sent between calls are not forwarded. Two clients calling the same server at the same time both get its messages.
  • A server with forward_headers set forwards no log messages, and once a call has carried forwarded headers to a server, that server forwards none until it reconnects: each caller may reach it as a different identity, so a message about one caller's request could otherwise reach another.
  • logger is always the upstream server's name; the upstream's own logger is not kept.
  • logging/setLevel sets the level for the client's own session only and is never sent upstream, so no client can change what another one receives. A session that never set a level gets error and above. The upstream sends at whatever level it uses by default. Over Streamable HTTP, logging/setLevel is refused (-32600) under a session id this MCPProxy does not know: one it never initialized, one a client kept across an MCPProxy restart, or one it forgot after the session's stream had stayed closed for 30 minutes; a request the transport refuses anyway (not application/json, an unsupported MCP-Protocol-Version, or a 2026-07-28 request) gets the transport's answer instead; such a client gets error and above until it initializes again.
  • data is text the upstream server wrote. It is treated like the text of an untrusted tool's result under the output sanitisation policy: under block a message with a critical secret is left out, redact and control-character stripping apply, the text is then cut to 1 KiB, and the spotlight frame («untrusted:<server>/logging») is added when it is on. Non-string data is forwarded as its JSON text. Since JSON escaping (a newline written \n, a letter written \u0074) can hide from the detector and from control-character stripping what a client sees once it decodes the text, the decoded data is checked too, each member (a repeated one included) read both as name: value and in JSON syntax with its strings unescaped, and each decoded string on its own: under block a critical secret there leaves the message out; redact and stripping clean each decoded string where it stands, the rest of the text kept byte for byte, and under redact a message whose decoded data still shows a secret (one spread across a name and its value) is left out; then the text is cleaned whole. A message whose data is longer than 4 KiB is dropped.
  • Each upstream server can forward a burst of 20 messages, then 10 per second, shared by all receiving clients; the rest are dropped. A message that arrives while nobody is calling the server uses none of it. Forwarding is best effort: a message is dropped when the client's session cannot take it at once. Log messages are not written to the activity log.
  • code_execution sub-calls do not forward log messages.
  • The 2026-07-28 protocol removed logging/setLevel: a client on it cannot ask for anything below error.