Alternative to `RunSessionHandler` for accessing MCP servers
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- csharp
调研方向
首先检查 RunSessionHandler 和 McpServer API,尤其是 McpServer.SessionId 和 RunAsync,并将其与 issue 1382 中链接的讨论进行比较。确定保留对活动 MCP 服务器的访问权限并在之后发送通知的受支持方式,包括应如何处理无状态服务器。
由索引模型根据 Issue 内容生成。
描述
Now that RunSessionHandler has been marked as experimental, what is the correct way to access the MCP servers in order to send notifications at a later time?
We currently have:
var mcpServers = new ConcurrentDictionary<string, McpServer>();
options.RunSessionHandler = async (_, mcpServer, token) =>
{
if (mcpServer.SessionId == null)
{
// There is no sessionId if serverOptions.Stateless is true.
await mcpServer.RunAsync(token);
return;
}
try
{
mcpServers[mcpServer.SessionId] = mcpServer;
await mcpServer.RunAsync(token);
}
finally
{
// This code runs when the session ends.
mcpServers.TryRemove(mcpServer.SessionId, out var _);
}
};
We are then able to send notifications to the active servers.
(initially posted here)
- 主要语言
- C#
- 星标
- 4.6k
- 派生
- 817
- 平均合并
- 8 天 7 小时
- 30 天内合并 PR
- 3
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/csharp-sdk 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/csharp-sdk#1867 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
modelcontextprotocol/csharp-sdk#1836 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement needs confirmation
难度 2/5 1-3 小时 新手友好度 64/100
modelcontextprotocol/csharp-sdk#678 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement needs confirmation P3 ready for work
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/csharp-sdk#515 · 6 条评论 · 3 个 reaction ·
维护者通常 1 天内回复
查看 modelcontextprotocol/csharp-sdk 的全部 Issue
相似的 Issue
-
bug P3
难度 2/5 1-3 小时 新手友好度 88/100
nightscout/nocturne#1908 ·
维护者通常 1 天内回复
-
bug documentation Needs: Triage :mag:
难度 2/5 1-3 小时 新手友好度 78/100
-
WPF: each page's `Title` overwrites the window title, and returning to a page does not restore it未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
agentic-workflows area/Docs partner/agentic-workflows
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
jamesmontemagno/tiny-clips#378 · 2 条评论 ·
维护者通常 1 天内回复