fix: add MCP tools cache reset endpoint (#3602)

* fix: add MCP tools cache reset endpoint

* docs: clarify MCP cache reset scope
This commit is contained in:
Huixin615
2026-06-16 23:20:20 +08:00
committed by GitHub
parent 0966131b31
commit 1896722e66
6 changed files with 137 additions and 8 deletions
+20
View File
@@ -299,6 +299,26 @@ deployment needs additional trusted launchers.
}
```
#### Reset MCP Tools Cache
Clear cached MCP tools and persistent MCP sessions process-wide. This affects
all threads and users in the current Gateway process. Tools are loaded again
from configured MCP servers on the next agent run or tool lookup.
```http
POST /api/mcp/cache/reset
```
Requires an authenticated admin session.
**Response:**
```json
{
"success": true,
"message": "MCP tools cache reset. Tools will reload on next use."
}
```
### Skills
#### List Skills
+8 -8
View File
@@ -427,17 +427,17 @@ SKILL.md Format:
### Configuration Reload
```
1. Client updates MCP config
1. Client updates MCP config or requests a cache reset
PUT /api/mcp/config
POST /api/mcp/cache/reset
2. Gateway writes extensions_config.json
- Updates mcpServers section
- File mtime changes
2. Gateway updates runtime state
- PUT writes extensions_config.json and reloads configuration
- Both endpoints reset the MCP tools cache and persistent sessions
3. MCP Manager detects change
- get_cached_mcp_tools() checks mtime
- If changed: reinitializes MCP client
- Loads updated server configurations
3. MCP Manager reloads on next use
- get_cached_mcp_tools() lazily reinitializes MCP tools
- Loads current server configurations and tool lists
4. Next agent run uses new tools
```