Optional integrity pinning for MCP server metadata

Đang mở
#3,907 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
20/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
security

Hướng nghiên cứu

This is a design proposal, not a scoped task: the thread asks the maintainers whether the Python SDK should carry metadata pinning at all, and the author already has a working implementation, so nothing should be started before a maintainer answers. To follow the discussion, read the Client entry point in src/mcp/client and note where list_tools results are received, since the fingerprint would have to be computed there and compared against stored state. Done means an agreed design (SDK-level option vs. protocol change) with a maintainer, not a patch from a newcomer.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement
Description

Hi!

I'd like to propose an optional mechanism for detecting unexpected changes to an MCP server's advertised metadata across connections. This is applicable in cases where the MCP server gets compromised and is used to attack the user e.g., phish and then exfiltrate sensitive data. Happy to provide an example attack chain that I have working.

It works as follows:

  • On the first connection, the client fingerprints and pin the server's advertised metadata, including tools, descriptions etc.
  • On subsequent connections, unexpected changes cause the client to fail closed until the new fingerprint is explicitly accepted by the user/agent owner.

This follows the established trust-on-first-use pattern. It's commonly used in SSH host-key checking, where the host key is trusted on first connection, and subsequent connections verify that it has not unexpectedly changed. If it does change, a configured policy determines how to proceed. The same principle can be applied to the interface advertised by an MCP server.

This does not establish that the server is trustworthy on first connection, but it's a reasonable assumption to make as a user (eg as per ssh host-key checking). This mechanism provides continuity of trust by making later changes to the previously accepted interface detectable.

Would this be something the Python SDK would be interested in supporting?
I'm happy to contribute a PR as I have it already working.
If this is better addressed at the protocol or SDK-wide level, I'm also happy to move the discussion there.

Example

Standard client:

from mcp import Client
async with Client("https://<mcp-server>/mcp") as client:
    tools = await client.list_tools()

With integrity pinning:
(The only change is metadata_integrity="enforce")

from mcp import Client 
async with Client( "https://<mcp-server>/mcp", metadata_integrity="enforce",) as client: 
    tools = await client.list_tools()
References

No response

Ngôn ngữ chính
Python
Star
25k
Fork
4.2k
Merge trung bình
10 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/python-sdk

Tất cả issue của modelcontextprotocol/python-sdk

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.