Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/generate-types/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ export interface PreflightResponse {
health?: HealthStatus; // Unified health status calculated by the backend
trust_mode?: string; // Per-server approval trust mode (spec 086): 'auto' | 'scan' | 'manual'; raw configured value, absent when unset (effective default: scan, spec 119)
expose_skills?: boolean; // Per-server skills override (MCP skills extension); absent = inherit, false = exclude this server's skills
client_features?: string[]; // Which of the calling client's features this server may use: 'elicitation' | 'sampling' | 'roots'; absent = none
expose_prompts?: boolean; // F9 per-server prompt-aggregation override; absent = inherit default aggregation, false = exclude this server's prompts
forward_headers?: string[]; // Spec 112 allowlist of inbound MCP client header names forwarded to this server on tools/call (names only, never values)
security_scan?: SecurityScanSummary; // Latest scan summary (spec 086); ABSENT when no scan has ever run
Expand Down
2 changes: 1 addition & 1 deletion cmd/mcpproxy/activity_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestActivityViewTypeFilter(t *testing.T) {
{view: "", want: ""},
{view: "all", want: ""},
{view: "calls", want: "tool_call,internal_tool_call"},
{view: "system", want: "policy_decision,quarantine_change,server_change,system_start,system_stop,config_change,tool_quarantine_change,skill_quarantine_change,skill_access,security_scan,credential_broker,preflight,prompt_get,profile_change,upstream_event"},
{view: "system", want: "policy_decision,quarantine_change,server_change,system_start,system_stop,config_change,tool_quarantine_change,skill_quarantine_change,skill_access,security_scan,credential_broker,preflight,prompt_get,profile_change,upstream_event,client_request"},
{view: "bogus", wantErr: true},
}

Expand Down
2 changes: 2 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ the error names the field.
| `enable_prompts` | boolean | `true` | Enable mcpproxy's built-in prompts (setup / troubleshoot workflows) and advertise the MCP `prompts` capability. Governs only the built-ins; upstream aggregation is controlled separately by `aggregate_upstream_prompts`. |
| `aggregate_upstream_prompts` | boolean | `false` | **Opt-in.** When `true`, aggregate every connected upstream server's MCP prompts into mcpproxy's own `prompts/list` (exposed as `<server>__<prompt>`). Off by default so users are safe until they deliberately enable it. Requires `enable_prompts: true` (the default) to have any effect. Hot-reloadable. The per-server [`expose_prompts`](#per-server-settings) override further filters which servers contribute once this is on. |
| `enable_skills` | boolean | `false` | **Opt-in.** When `true`, mcpproxy reads the skills that upstream servers expose through the MCP skills extension. In this release they are visible to administrators only and are not offered to agents. Hot-reloadable. The per-server `expose_skills` override further filters which servers contribute once this is on. See [Skills over MCP](features/skills.md). |
| `enable_client_features` | boolean | `true` | Kill switch for the per-server `client_features`. `false` offers the calling MCP client's elicitation, sampling and roots to no server. Takes effect after a restart. See [Upstream requests to the client](features/client-requests.md). |
| `check_server_repo` | boolean | `true` | Enable repository detection for MCP servers (shows install commands) |

---
Expand Down Expand Up @@ -459,6 +460,7 @@ the error names the field.
| `reconnect_on_use` | boolean | No | When `true`, tool calls to a disconnected server trigger an immediate reconnect attempt (15s timeout) before failing (default: `false`) |
| `expose_prompts` | boolean | No | Per-server override for whether this server's MCP prompts are aggregated into mcpproxy's `prompts/list`. Only takes effect when the global `aggregate_upstream_prompts` master switch is on. Omit to expose prompts whenever the server advertises `Capabilities.Prompts`; `false` opts this server out even if it does. |
| `expose_skills` | boolean | No | Per-server override for whether mcpproxy reads this server's skills (MCP skills extension). Only takes effect when the global `enable_skills` switch is on. Omit to read skills whenever the server supports them; `false` opts this server out. See [Skills over MCP](features/skills.md). |
| `client_features` | array | No | **Opt-in.** What this server may use of the calling MCP client: any of `"elicitation"`, `"sampling"`, `"roots"`. Omit or `[]` for none. A change reconnects the server. See [Upstream requests to the client](features/client-requests.md). |
| `toon_output` | string | No | Per-server override for the global [`toon_output`](#toon-output-adaptive-result-encoding): `off`, `adaptive`, or `always`. Non-empty value wins over the global for this server's tools; omit to inherit. See [TOON Output](features/toon-output.md). |
| `tool_argument_error_mode` | string | No | Argument-error policy for this upstream: omitted, empty, or `detailed` retains diagnostic messages; `redacted` replaces eligible argument-error messages with `Invalid tool arguments.`. See [Tool Argument Errors](#tool-argument-errors). |
| `forward_headers` | array | No | Names of inbound MCP client HTTP headers to forward to this server on `tools/call`. Exact names only. See [Client Header Forwarding](#client-header-forwarding). Ignored for `stdio` and `sse`. `[]` clears it. |
Expand Down
9 changes: 9 additions & 0 deletions docs/configuration/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,15 @@ With `require_mcp_auth` off, a change that would let a client bound to a profile

See [Skills over MCP](/features/skills).

### Upstream requests to the client (`enable_client_features`) {#client-features}

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `enable_client_features` | boolean | `true` | Kill switch. `false` offers the calling MCP client's elicitation, sampling and roots to no server, whatever its `client_features`. Takes effect after a restart. |
| `mcpServers[].client_features` | array | none | What this server may use of the calling MCP client: any of `"elicitation"`, `"sampling"`, `"roots"`. A change reconnects the server. |

See [Upstream requests to the client](/features/client-requests).

### MCP Servers

See [Upstream Servers](/configuration/upstream-servers) for detailed server configuration.
Expand Down
2 changes: 2 additions & 0 deletions docs/features/activity-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ curl -X POST -H "X-API-Key: $TOKEN" -H "X-MCPProxy-Run: nightly-2026-11-15" \

A row carries the server, the kind, the diagnostic code (`MCPX_*`) and its fixed message, never the raw error text. Repeats within a minute are one row with `metadata.count`, `first_at` and `last_at`; one server adds at most 120 rows an hour. The rows appear in the System view (`--type upstream_event`) and in the timeline of every session that called the server while the event happened. A session in which a call to a server failed because the server could not be reached (`network`), and which started while that server was already down, also shows the cause from before its start, marked `precedes_session`: one row per server, the server's latest `connection_lost` or `process_exited` row, when no `connection_restored` came after it before the session started and it was recorded since MCPProxy last started. A row stands for its repeats, so a loss repeated during the session counts at its last repeat, and a recovery repeated after the session started does not count as one before it. A call that waited for a login is not given an earlier row: its own row says the server needs a login.

**Requests from an upstream to the client.** When a server asks the calling client for an approval (elicitation), a model completion (sampling) or its roots, the request is recorded as a `client_request` row: the server, the method as the tool name, what was asked (capped and scanned for sensitive data) and `metadata.outcome` (`forwarded`, `unanswered` or `failed`). What came back is not stored, only its shape (action, field names and sizes, `response_bytes`, `root_count`). Administrators only. See [Upstream requests to the client](client-requests.md).

**Why a call to a server that is not connected failed.** Such a call is never sent. When the server waits for a login (logged out, parked for sign-in, or its last connect failed on OAuth) the call is recorded with error class `auth` and the reason "The upstream server needs a login."; otherwise it is `network`, "The upstream server could not be reached." A network failure, and an HTTP answer that says nothing about credentials (5xx, 429, 404), is never read as a login requirement.

**Reading a session.** `GET /api/v1/work-sessions` lists sessions (`?failed=true` for the ones that failed), and `GET /api/v1/work-sessions/{id}/timeline` returns one session's rows and upstream events in time order, positioned at its first failure with the 20 rows before it. See the [REST API reference](../api/rest-api.md#work-sessions).
Expand Down
82 changes: 82 additions & 0 deletions docs/features/client-requests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
id: client-requests
title: Upstream Requests to the Client
sidebar_label: Elicitation, Sampling & Roots
description: How upstream servers ask the user, the client's model or the client's roots through MCPProxy
keywords: [elicitation, sampling, roots, server-initiated requests, approval, enable_client_features, client_features, client_request]
---

# 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:

```json
{ "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):

```json
{ "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:

| Request | Answer |
|---|---|
| Elicitation | `decline` |
| Sampling | an error |
| Roots | an 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.

```bash
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.
2 changes: 2 additions & 0 deletions frontend/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,8 @@ export type ActivityType =
| 'skill_quarantine_change'
/** Spec 125: an agent searched, loaded or read a skill (never carries the skill text). */
| 'skill_access'
/** #1964: an upstream server asked the calling client for elicitation, sampling or roots. */
| 'client_request'

export type ActivitySource = 'mcp' | 'cli' | 'api'

Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export interface Server {
health?: HealthStatus; // Unified health status calculated by the backend
trust_mode?: string; // Per-server approval trust mode (spec 086): 'auto' | 'scan' | 'manual'; raw configured value, absent when unset (effective default: scan, spec 119)
expose_skills?: boolean; // Per-server skills override (MCP skills extension); absent = inherit, false = exclude this server's skills
client_features?: string[]; // Which of the calling client's features this server may use: 'elicitation' | 'sampling' | 'roots'; absent = none
expose_prompts?: boolean; // F9 per-server prompt-aggregation override; absent = inherit default aggregation, false = exclude this server's prompts
forward_headers?: string[]; // Spec 112 allowlist of inbound MCP client header names forwarded to this server on tools/call (names only, never values)
security_scan?: SecurityScanSummary; // Latest scan summary (spec 086); ABSENT when no scan has ever run
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/utils/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export const ACTIVITY_TYPE_LABELS: Record<string, string> = {
'profile_change': 'Profile Change', // Spec 108: client binding / credential change
'upstream_event': 'Upstream Event', // Spec 124: connection lost/restored, process exited, OAuth refresh failed, login required
'skill_quarantine_change': 'Skill Approval Change', // Spec 125: a skill's approval state (administrator-only)
'skill_access': 'Skill Access' // Spec 125: an agent searched, loaded or read a skill
'skill_access': 'Skill Access', // Spec 125: an agent searched, loaded or read a skill
'client_request': 'Client Request' // #1964: an upstream asked the client for elicitation, sampling or roots
}

const typeLabels = ACTIVITY_TYPE_LABELS
Expand Down Expand Up @@ -101,7 +102,8 @@ const typeIcons: Record<string, string> = {
'profile_change': '🪪',
'upstream_event': '🔌',
'skill_quarantine_change': '📚',
'skill_access': '📖'
'skill_access': '📖',
'client_request': '🙋'
}

// Status labels
Expand Down
Loading
Loading