Skip to content
Merged
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
7 changes: 6 additions & 1 deletion cmd/mcpproxy/doctor_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,11 @@ func displaySecurityFeaturesStatus() {
if routingMode == "" {
routingMode = config.RoutingModeRetrieveTools
}
fmt.Printf(" Routing Mode: %s\n", routingMode)
// Labelled "configured" on purpose: this function reads the config FILE, and
// /mcp binds its routing mode at startup — a mode saved but not yet adopted
// (or hand-edited into the file) is not what a running daemon is serving.
// `mcpproxy status` asks the daemon and reports the served one.
fmt.Printf(" Routing Mode (configured): %s\n", routingMode)
switch routingMode {
case config.RoutingModeDirect:
fmt.Println(" All upstream tools exposed directly via /mcp endpoint")
Expand All @@ -627,6 +631,7 @@ func displaySecurityFeaturesStatus() {
fmt.Println(" BM25 search via retrieve_tools + call_tool variants")
}
fmt.Printf(" Endpoints: /mcp/all (direct), /mcp/code (code_execution), /mcp/call (retrieve_tools)\n")
fmt.Println(" A running daemon keeps serving the mode it started with — `mcpproxy status` reports that one")
fmt.Println()

// Sensitive Data Detection status
Expand Down
9 changes: 9 additions & 0 deletions cmd/mcpproxy/status_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ func collectStatusFromDaemon(cfg *config.Config, client *cliclient.Client, socke
info.ListenAddr = cfg.Listen
}

// Take the routing mode from the RUNNING daemon, not from the config file.
// /mcp binds its mode at startup, so a mode saved but not yet adopted (or
// hand-edited into the file) is not what the daemon is serving — and
// `mcpproxy status` is one of the documented ways to check which surface an
// agent will get. Older daemons omit the field; the config value stands in.
if mode, ok := statusData["routing_mode"].(string); ok && mode != "" {
info.RoutingMode = mode
}

// Extract upstream stats
if stats, ok := statusData["upstream_stats"].(map[string]interface{}); ok {
info.Servers = extractServerCounts(stats)
Expand Down
18 changes: 17 additions & 1 deletion docs/api/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,27 @@ Get the current routing mode and available MCP endpoints.
"code_execution": "/mcp/code",
"retrieve_tools": "/mcp/call"
},
"available_modes": ["retrieve_tools", "direct", "code_execution"]
"available_modes": ["retrieve_tools", "direct", "code_execution"],
"tool_response_mode": "full",
"direct_tool_response_mode": "full",
"pending_routing_mode": "",
"restart_required": false
}
}
```

| Field | Meaning |
|-------|---------|
| `routing_mode` | The mode `/mcp` is **actually serving** — recorded when the server bound it at startup, not read back from the config. A config change (API or hand-edited file) cannot rebind `/mcp`. |
| `pending_routing_mode` | The mode the next start will adopt, when it differs from the served one. Empty when nothing is pending. |
| `restart_required` | True exactly when `pending_routing_mode` is set. |
| `tool_response_mode` | Spec 085 serialization of `retrieve_tools` results, resolved (`full` when unset). Hot-reloadable. |
| `direct_tool_response_mode` | Spec 102 serialization of direct-surface listings, resolved (`full` when unset). Hot-reloadable. |

A restart-gated change is persisted immediately and reported as pending; later
changes to other settings apply hot and leave it pending. Re-applying the mode
that is already being served clears it.

See [Routing Modes](../features/routing-modes.md) for details on each mode.

#### MCP tool surface: compact responses and describe_tool (Spec 085)
Expand Down
35 changes: 34 additions & 1 deletion docs/features/routing-modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,45 @@ curl -H "X-API-Key: your-key" http://127.0.0.1:8080/api/v1/routing
"code_execution": "/mcp/code",
"retrieve_tools": "/mcp/call"
},
"available_modes": ["retrieve_tools", "direct", "code_execution"]
"available_modes": ["retrieve_tools", "direct", "code_execution"],
"tool_response_mode": "full",
"direct_tool_response_mode": "full",
"pending_routing_mode": "",
"restart_required": false
}
```

`routing_mode` is the mode `/mcp` is **actually serving**. When a routing-mode
change has been saved but not yet applied, `pending_routing_mode` names the mode
the next start will adopt and `restart_required` is `true` — see
[Changing Routing Mode](#changing-routing-mode). `tool_response_mode` and
`direct_tool_response_mode` report the two serialization axes, resolved (an unset
value reads as `"full"`).

```bash
# Status endpoint also includes routing_mode
curl -H "X-API-Key: your-key" http://127.0.0.1:8080/api/v1/status
```

## Changing Routing Mode

### From the Web UI

The **Mode** control in the header is a switcher. Its **Surface** tab lists the
three routing modes with what each costs an agent and which dedicated endpoint
always serves it; its **Schema detail** tab holds the two serialization axes
(`tool_response_mode` and `direct_tool_response_mode`), which apply immediately.

Picking a routing mode saves it and marks it **pending**: the header keeps naming
the mode `/mcp` is still serving, and the panel says which mode the next start
will adopt — plus the dedicated endpoint that already serves it, if you would
rather point your client there than restart. **Cancel — keep <mode>** reverts a
pending choice.

The same three fields also live in **Settings → General**.

### From the config file

1. Edit `~/.mcpproxy/mcp_config.json`:
```json
{
Expand All @@ -233,6 +261,11 @@ curl -H "X-API-Key: your-key" http://127.0.0.1:8080/api/v1/status

The routing mode is applied at startup and determines which MCP server instance handles the default `/mcp` endpoint. Dedicated endpoints (`/mcp/all`, `/mcp/code`, `/mcp/call`) are always available regardless of the configured mode.

While the change is pending, the rest of the configuration keeps working
normally: settings that hot-reload — including both serialization axes — apply
immediately and leave the pending routing mode intact on disk. `mcpproxy status`
and `/api/v1/routing` keep reporting the mode `/mcp` is really serving.

## Tool Refresh

When upstream servers connect, disconnect, or update their tools:
Expand Down
5 changes: 3 additions & 2 deletions docs/features/schema-deferred-direct-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ MCPPROXY_DIRECT_TOOL_RESPONSE_MODE=deferred mcpproxy serve
mcpproxy serve --direct-tool-response-mode=deferred
```

Or from the UI — **Settings → General → "Detail in Direct-mode listings"**, in
both the Web UI and the macOS tray. The routing-mode field ("How agents find
Or from the UI — the **Mode** switcher in the Web UI header, under **Schema
detail → Direct listings**, or **Settings → General → "Detail in Direct-mode
listings"**, in both the Web UI and the macOS tray. The routing-mode field ("How agents find
tools") heads the same section, two rows above. Note the asymmetry: changing the
serialization mode applies hot, but changing `routing_mode` needs a restart (the
badge on that field says so), because `/mcp` binds its routing mode once at
Expand Down
47 changes: 28 additions & 19 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading