modelcontextprotocol / modelcontextprotocol/python-sdk
Add add_resource_template() to MCPServer
未關閉
還沒有人認領這個 Issue。
v2
- 主要語言
- Python
- 星號
- 24.3k
- 分支
- 4k
- 平均合併
- 1 天 1 小時
- 30 天內合併 PR
- 31
描述
Description
MCPServer and ResourceManager have add_resource() method for static Resources, but there is no way to handle ResourceTemplate without using @resource decorator.
I am implementing the following workaround using the decorator for my usecase, but it is a bit odd.
server = MCPServer("...")
# Configure resources (implemented in other files)
server.resource("resource://users")(resources.list_users)
server.resource("resource://users/{id}")(resources.get_user)
References
It was implemented in #3208.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 MCPServer 和 ResourceManager add_resource() 入口開始,然後閱讀 #3208 中的實作。確定 ResourceTemplate 如何透過現有的裝飾器路徑處理,並定義相符的直接 API。完成標準是呼叫端可以在不使用 @resource 的情況下註冊 ResourceTemplate,並為新行為提供涵蓋測試。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- backend-api-design
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 活躍
- 描述清晰度
- 基本清楚
- 新手友好度
- 68/100