Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

mcpdotnet.TestSseServer can work #97

Closed
wants to merge 4 commits into from
Closed

mcpdotnet.TestSseServer can work #97

wants to merge 4 commits into from

Conversation

iwaitu
Copy link

@iwaitu iwaitu commented Mar 18, 2025

Pull Request

Description of Changes

sse server "mcpdotnet.TestSseServer" now work for me.

Related Issue(s)

  • Fixes #

iwaitu added 4 commits March 18, 2025 14:33
- 使 `IMcpServer` 继承自 `IAsyncDisposable`,并添加多个请求处理程序设置方法。
- 在 `McpServer` 类中实现新方法,并将 `SetPingHandler` 和 `SetInitializeHandler` 修改为公共方法。
- 将 `McpServerHandlers` 类的访问修饰符改为 `internal`。
- 更新 `Program.cs` 中的服务器实例创建方式,使用 `McpServerFactory.Create` 方法,并调整处理程序注册逻辑。
修改 `IMcpClient` 和 `IMcpServer` 接口中的方法名称,从 `SendRequestAsync` 更改为 `SendRequest`,以简化接口的使用。更新 `McpClient` 和 `McpServer` 类中对该方法的调用,并在 `McpClientExtensions` 中替换所有相关调用,确保一致性。同时,更新 `McpJsonRpcEndpoint` 类中的实现。添加 `Main` 方法以启动服务器,并清理 `mcpdotnet.Tests.csproj` 中不再需要的测试文件。
将 IMcpClient 和 IMcpServer 接口中的 SendRequest 方法重命名为 SendRequestAsync,以符合异步编程的命名约定。更新了 McpClient 类及相关扩展类中的所有调用,确保一致性和异步操作的正确性。同时,McpJsonRpcEndpoint 抽象类中的实现也进行了相应的重命名和调整。
在 `McpServer.cs` 文件中,启用了 `SetToolsHandler`、`SetPromptsHandler` 和 `SetResourcesHandler` 方法,以确保服务器初始化时正确设置这些处理程序。同时,将原本抛出的异常注释掉,改为直接返回,以提高代码的容错性。
@eiriktsarpalis
Copy link
Collaborator

Thanks, but this has already been addressed by #81

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants