Skip to content

Commit 585e443

Browse files
committed
docs: enhance spec with MCP notifications and admin scenarios
- Add User Story 6: Admin Server Management (disable/enable/quarantine) - Add FR-016: Require `notifications/tools/list_changed` for tool sync - Add SC-006: Notification delivery within 1 second of admin action - Update FR-003: Exclude redundant search-workflow tools from /mcp/direct - Update Key Entities: Document notification mechanism Related smart-mcp-proxy#279
1 parent bc2adce commit 585e443

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

  • specs/025-mcp-direct-endpoint

specs/025-mcp-direct-endpoint/spec.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ As an MCP client user, I want to connect to a single endpoint that exposes all a
2828

2929
1. **Given** the direct endpoint is enabled and upstream servers are connected, **When** a client requests the tools list from `/mcp/direct`, **Then** the response includes all tools from connected upstream servers with `server:tool` naming format.
3030

31-
2. **Given** the direct endpoint is enabled, **When** a client requests the tools list, **Then** the response includes all internal MCPProxy tools (retrieve_tools, call_tool_*, upstream_servers, etc.) without a server prefix.
31+
2. **Given** the direct endpoint is enabled, **When** a client requests the tools list, **Then** the response includes management MCPProxy tools (upstream_servers, quarantine_security, code_execution, list_registries, search_servers, read_cache) without a server prefix. Note: Search-workflow tools (retrieve_tools, call_tool_read, call_tool_write, call_tool_destructive) are excluded as they are redundant in direct mode.
3232

3333
3. **Given** the direct endpoint is enabled and a tool exists as `github:create_issue`, **When** a client calls this tool directly, **Then** the call is routed to the github upstream server and executed successfully.
3434

@@ -104,6 +104,26 @@ As an MCP client developer, I want upstream tool annotations (readOnlyHint, dest
104104

105105
---
106106

107+
### User Story 6 - Admin Server Management (Priority: P2)
108+
109+
As an administrator, I want connected clients to be notified when I disable, enable, quarantine, or unquarantine an upstream server, so their tool lists stay synchronized with the current server state.
110+
111+
**Why this priority**: Essential for operational consistency - admin actions must propagate to all connected clients.
112+
113+
**Independent Test**: Can be tested by disabling/enabling a server while a client is connected and verifying the client receives a tool list update notification.
114+
115+
**Acceptance Scenarios**:
116+
117+
1. **Given** a client is connected to `/mcp/direct` and server "github" is enabled, **When** an administrator disables "github" via CLI/WebUI/API, **Then** the system sends `notifications/tools/list_changed` to the client, and the client's subsequent `tools/list` call excludes github:* tools.
118+
119+
2. **Given** a client is connected to `/mcp/direct` and server "github" is disabled, **When** an administrator enables "github" via CLI/WebUI/API, **Then** the system sends `notifications/tools/list_changed` to the client, and the client's subsequent `tools/list` call includes github:* tools.
120+
121+
3. **Given** a client is connected to `/mcp/direct` and server "github" is not quarantined, **When** an administrator quarantines "github", **Then** the system sends `notifications/tools/list_changed` to the client, and the client's subsequent `tools/list` call excludes github:* tools.
122+
123+
4. **Given** a client is connected to `/mcp/direct` and server "github" is quarantined, **When** an administrator unquarantines (approves) "github", **Then** the system sends `notifications/tools/list_changed` to the client, and the client's subsequent `tools/list` call includes github:* tools (once connected).
124+
125+
---
126+
107127
### Edge Cases
108128

109129
- What happens when all upstream servers are disabled or quarantined? → Only internal tools are listed
@@ -117,7 +137,7 @@ As an MCP client developer, I want upstream tool annotations (readOnlyHint, dest
117137

118138
- **FR-001**: System MUST provide a new MCP endpoint at `/mcp/direct` when the feature is enabled
119139
- **FR-002**: System MUST expose all tools from connected, enabled, non-quarantined upstream servers on the direct endpoint
120-
- **FR-003**: System MUST expose all internal MCPProxy tools (retrieve_tools, call_tool_read, call_tool_write, call_tool_destructive, upstream_servers, quarantine_security, read_cache, code_execution, list_registries, search_servers) on the direct endpoint
140+
- **FR-003**: System MUST expose management MCPProxy tools (upstream_servers, quarantine_security, read_cache, code_execution, list_registries, search_servers) on the direct endpoint. Search-workflow tools (retrieve_tools, call_tool_read, call_tool_write, call_tool_destructive) MUST be excluded as they are redundant in direct mode
121141
- **FR-004**: System MUST namespace upstream tools using `server:tool` format to prevent collisions
122142
- **FR-005**: System MUST NOT namespace internal tools (they appear without prefix)
123143
- **FR-006**: System MUST exclude tools from quarantined servers
@@ -130,12 +150,13 @@ As an MCP client developer, I want upstream tool annotations (readOnlyHint, dest
130150
- **FR-013**: System MUST provide a configuration option `enable_direct_endpoint` to enable/disable this feature
131151
- **FR-014**: System MUST default the `enable_direct_endpoint` configuration to `false` (opt-in)
132152
- **FR-015**: System MUST return 404 for `/mcp/direct` when the feature is disabled
153+
- **FR-016**: System MUST send MCP `notifications/tools/list_changed` notification to all connected `/mcp/direct` clients when the tool list changes due to: upstream server connect/disconnect, upstream server enable/disable, upstream server quarantine/unquarantine, or upstream server's own `tools/list_changed` notification
133154

134155
### Key Entities
135156

136157
- **DirectMCPServer**: A separate MCP server instance that manages the direct endpoint, distinct from the search-based MCPProxyServer
137158
- **Tool Namespace**: The `server:tool` naming convention that maps upstream tools to their source server
138-
- **Tool Synchronization**: The mechanism that keeps the direct endpoint's tool list in sync with upstream server state
159+
- **Tool Synchronization**: The mechanism that keeps the direct endpoint's tool list in sync with upstream server state, using MCP `notifications/tools/list_changed` to notify connected clients of changes
139160

140161
## Success Criteria *(mandatory)*
141162

@@ -146,12 +167,14 @@ As an MCP client developer, I want upstream tool annotations (readOnlyHint, dest
146167
- **SC-003**: 100% of upstream tool calls through the direct endpoint succeed when the upstream server is healthy
147168
- **SC-004**: Tool annotations are preserved with 100% fidelity from upstream to direct endpoint
148169
- **SC-005**: Zero tools from quarantined/disabled/disconnected servers appear in the direct endpoint's tool list
170+
- **SC-006**: All connected clients receive `notifications/tools/list_changed` within 1 second of an admin action (enable/disable/quarantine/unquarantine)
149171

150172
## Assumptions
151173

152174
- The existing `EventTypeServersChanged` event provides sufficient notification for tool synchronization
153175
- The `StateView` contains cached tool information suitable for rebuilding the tool list
154176
- The `mcp-go` library's `SetTools()` method provides atomic tool list replacement
177+
- The `mcp-go` library supports sending `notifications/tools/list_changed` to connected clients
155178
- Internal tool handlers can be shared between the existing MCPProxyServer and the new DirectMCPServer
156179

157180
## Out of Scope

0 commit comments

Comments
 (0)