anthropics / anthropics/claude-ai-mcp

Client ignores tools/list response after tools/list_changed notification - uses stale cache

未關閉
#45 15 則留言 6 個 reaction 已指派 0 人 在 GitHub 檢視
backlog bug known-issue
主要語言
沒有語言資料
星號
471
分支
76
PR 合併指標
30 天內沒有已合併 PR

描述

### What happened?

When starting a new Claude session after tools have been added on the server, the client receives the `notifications/tools/list_changed` notification and requests `tools/list`, but seems to use a stale cached tools list from a previous session instead of the response it just received.

### What did you expect to happen?

Once `tools/list` has been called, I expect Claude to be aware of the new list.
The only workaround I found is to disconnect / reconnect the MCP, which will not be very convenient for my users.

### Steps to reproduce

1. Connect to a custom remote MCP server with N tools (e.g., 29 tools)
2. Ask Claude how many tools the MCP has => answer is 29
3. End the session
4. Add a new tool on the server side
5. Start a new session (new conversation)
6. Invoke one of the tools
7. Server sends `notifications/tools/list_changed` notification
8. Client requests `tools/list`
9. Server responds with N+1 tools (e.g., 30 tools)
10. Claude reports seeing only N tools (29) and cannot invoke the new tool

### Area

Protocol (SSE, Streamable HTTP)

### MCP Server (if applicable)

a custom one, not published yet

### Error messages or logs

```shell
# ==== MCP OAuth process starts ====
MCP POST request method=initialize
MCP protocol version negotiated client_protocol=2025-11-25 server_protocol=2025-11-25
MCP POST request method=notifications/initialized
MCP GET SSE stream opened session_tools_version=d598a9ce405759c3 current_tools_version=d598a9ce405759c3
MCP SSE sending tools/list_changed notification tools_version=d598a9ce405759c3
MCP POST request method=tools/list
MCP tools/list requested tools_count=29 tools_version=d598a9ce405759c3
MCP POST request method=initialize
MCP protocol version negotiated client_protocol=2025-11-25 server_protocol=2025-11-25
MCP POST request method=initialize
MCP protocol version negotiated client_protocol=2025-11-25 server_protocol=2025-11-25
MCP POST request method=notifications/initialized
MCP GET SSE stream opened session_tools_version=d598a9ce405759c3 current_tools_version=d598a9ce405759c3
MCP SSE sending tools/list_changed notification tools_version=d598a9ce405759c3
MCP POST request method=tools/list
MCP tools/list requested tools_count=29 tools_version=d598a9ce405759c3
MCP DELETE session terminated
# ==== MCP OAuth process ends ====
# ==== Asking Claude for the tools count here gives 29, but does not make any call to my server, which is probably expected ====
#
# ==== Custom MCP Server restarted with 30 tools instead of 29 ====
# ==== Ask Claude to invoke my 'list-product' tool
MCP POST request method=initialize
MCP protocol version negotiated client_protocol=2025-11-25 server_protocol=2025-11-25
MCP POST request method=notifications/initialized
MCP GET SSE stream opened session_tools_version=b23e878d4246f96a current_tools_version=b23e878d4246f96a
MCP SSE sending tools/list_changed notification tools_version=b23e878d4246f96a
MCP tool invocation tool=list-products
MCP POST request method=tools/list
MCP tools/list requested tools_count=30 tools_version=b23e878d4246f96a
# ==== Asking Claude for the tools count here still gives 29 => KO ====
```

### Additional context

The errors logs are an extract of my own custom MCP.

Environment:
- Claude Desktop (chat)
- MCP Server: Custom server implementing MCP protocol version 2025-11-25

Protocol Details:
- Transport: Streamable HTTP (as per https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#streamable-http)
- Server capabilities: tools: { listChanged: true }
- Protocol version negotiated during initialize: 2025-11-25
- Notification format verified to match https://github.com/modelcontextprotocol/python-sdk

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。