Skip to content

EverythingServer Sample MCP Server Fails to List Resources When Using WithResources... #408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ferosekhanj opened this issue May 13, 2025 · 1 comment · Fixed by #411
Closed
Assignees
Labels
bug Something isn't working

Comments

@ferosekhanj
Copy link

Describe the bug
If one uses the WithResources to add the resource (like it is done in samples\EverythingServer) then the mcp-server in the initialization doesn't list the resources in the capabilities. An explicit WithListResourcesHandler & WithReadResourceHandler works fine.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the csharp-sdk repo with preview.13
  2. Build the samples\EverythingServer
  3. Run npx @modelcontextprotocol/inspector dotnet run --project d:/tmp/mcp/csharp-sdk/samples/EverythingServer --no-build
  4. In the inspector tool Resources tab is disabled
  5. The output of initialize is {
    "capabilities": {
    "logging": {},
    "completions": {},
    "prompts": {
    "listChanged": true
    },
    "tools": {
    "listChanged": true
    }
    },
    "serverInfo": {
    "name": "EverythingServer",
    "version": "1.0.0.0"
    }
    }

Expected behavior
The resource should be listed in the capabilities, and one should be able to list and read the resources.

Logs
Not needed. The issue can be reproduced from the samples.

Additional context
In the claude desktop app. I see the following logs regarding this issue for the EverythingServer sample

2025-05-13T05:56:29.887Z [EverythingServer] [info] Message from client: {"method":"resources/list","params":{},"jsonrpc":"2.0","id":9}
warn: ModelContextProtocol.Server.McpServer[2049951654]
Server (EverythingServer 1.0.0.0), Client (claude-ai 0.1.0) received request for method 'resources/list', but no handler is available.
warn: ModelContextProtocol.Server.McpServer[975074943]
Server (EverythingServer 1.0.0.0), Client (claude-ai 0.1.0) method 'resources/list' request handler failed.
ModelContextProtocol.McpException: Method 'resources/list' is not available.
at ModelContextProtocol.Shared.McpSession.HandleRequest(JsonRpcRequest request, CancellationToken cancellationToken) in D:\tmp\mcp\csharp-sdk\src\ModelContextProtocol\Shared\McpSession.cs:line 301
at ModelContextProtocol.Shared.McpSession.HandleMessageAsync(JsonRpcMessage message, CancellationToken cancellationToken) in D:\tmp\mcp\csharp-sdk\src\ModelContextProtocol\Shared\McpSession.cs:line 232
at ModelContextProtocol.Shared.McpSession.<>c__DisplayClass21_1.<g__ProcessMessageAsync|0>d.MoveNext() in D:\tmp\mcp\csharp-sdk\src\ModelContextProtocol\Shared\McpSession.cs:line 133
2025-05-13T05:56:29.890Z [EverythingServer] [info] Message from server: {"jsonrpc":"2.0","id":9,"error":{"code":-32601,"message":"Method 'resources/list' is not available."}}

@ferosekhanj ferosekhanj added the bug Something isn't working label May 13, 2025
@stephentoub stephentoub self-assigned this May 13, 2025
@stephentoub
Copy link
Contributor

Thanks. Fixed in #411.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants