anthropics / anthropics/claude-code

MCP: server advertising `resources` capability is treated as having none

Abierto
#92,729 0 comentarios 0 reacciones 0 asignados Ver en GitHub
area:mcp bug has repro platform:macos
Lenguaje dominante
Python
Estrellas
145k
Forks
23.1k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

### What happens

An MCP server that advertises the `resources` capability in its `initialize` response is treated by Claude Code as having no resource support:

- `ListMcpResourcesTool` with that server name returns `No resources found. MCP servers may still provide tools even if they have no resources.`
- `ReadMcpResourceTool` against a valid URI returns `Server "" does not support resources`

`tools/*` from the same server works fine. Another MCP server configured in the same session (a `stdio` one) *does* have its resources listed correctly, so resource support is working in general — just not for this server.

### The server is advertising it

Server is Rust + [`rmcp`](https://crates.io/crates/rmcp) 3.1.4, Streamable HTTP transport, stateless (`legacy_session_mode: false`, `json_response: true`). Verified directly on the wire with `curl`:

`initialize`:

```json
{"jsonrpc":"2.0","id":1,"result":{
"protocolVersion":"2025-11-25",
"capabilities":{"resources":{},"tools":{}},
"serverInfo":{"name":"...","version":"..."}
}}
```

`resources/list`:

```json
{"jsonrpc":"2.0","id":2,"result":{"resources":[
{"uri":"schema://.../relationships.md","name":"...","mimeType":"text/markdown","size":13995}
]}}
```

`resources/read` returns the document, and `resources/templates/list` returns `{"resourceTemplates":[]}`. All HTTP 200.

Identical `capabilities` are returned when the client negotiates `2024-11-05`, `2025-06-18`, `2025-11-25` or `2026-07-28`, and the same results come through when the server is reached via the `mcp-remote` stdio bridge rather than directly.

### The client received it

Claude Code's own MCP log for the session records a line from that same handshake:

```
{"debug":"Server instructions truncated from 2221 to 2048 chars", ...}
```

The server's `instructions` string is exactly 2221 characters, so the `initialize` response that the client parsed is the one shown above — the one carrying `"resources":{}`. No connection error is logged.

### Possibly relevant

The one observable difference from the `stdio` server whose resources *do* get listed is the shape of the capability object:

| server | `capabilities` |
|---|---|
| works | `{"resources":{"listChanged":false},"tools":{"listChanged":false}}` |
| fails | `{"resources":{},"tools":{}}` |

Both are spec-legal — `resources: {}` means "supported, no optional sub-capabilities". The bundled MCP SDK's own `assertCapability` check (`if (!this._capabilities.resources) throw ...`) treats `{}` as present, since `{}` is truthy, so that check is not the one rejecting it. Something upstream of it appears to decide the server has no resources.

### Environment

- Claude Code in the desktop app (Code tab), macOS 15 (Darwin 25.4.0)
- Server: self-hosted, `rmcp` 3.1.4, Streamable HTTP at `http://localhost:/core/mcp`
- Also reproduced through `mcp-remote` 0.1.38 as a stdio bridge to the same server

### Expected

A server advertising `capabilities.resources` (including as an empty object) has its resources listed by `ListMcpResourcesTool` and readable by `ReadMcpResourceTool`.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start at ListMcpResourcesTool and ReadMcpResourceTool, then trace the upstream MCP capability check and parsing of the initialize response. Compare handling of capabilities.resources as {} with the working {"listChanged":false} shape. Done means servers advertising an empty resources object can list and read resources without changing behavior for unsupported servers.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.