modelcontextprotocol / modelcontextprotocol/python-sdk
Specifying capabilities w/ FastMCP Server
Chưa có ai nhận issue này.
- #1043 của @gspencergoog — đã đóng, không merge
- Ngôn ngữ chính
- Python
- Star
- 24.3k
- Fork
- 4k
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 31
Mô tả
Question
I noticed that the FastMCP server does not have the options to manually specify the capabilities of the server, however it is possible to do so with the low-level server.
My current workaround to advertise the capabilities is like so:
mcp = FastMCP("test-server")
# Manually set notification options
lowlevel_server: Server = mcp._mcp_server
lowlevel_server.notification_options.resources_changed = True
lowlevel_server.notification_options.tools_changed = True
# Now, we override the mcp.run()
async def main():
async with stdio_server() as (r, w):
init_opts = lowlevel_server.create_initialization_options(
lowlevel_server.notification_options,
{}
)
await lowlevel_server.run(r, w, init_opts)
if __name__ == "__main__":
anyio.run(main)
Is there any other way to specify the capabilities of the FastMCP server? Is there a reason not to?
Thanks!
Additional Context
No response
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách đọc entry point của FastMCP và các phương thức cấp thấp của Server được nêu trong báo cáo: notification_options, create_initialization_options và run. Xác định cách quá trình khởi tạo FastMCP hiện đang expose các capabilities, và định nghĩa done là cho phép chỉ định các capabilities đó mà không override mcp.run().
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100