modelcontextprotocol / modelcontextprotocol/python-sdk

Document and provide hooks for sandboxing file and network access in MCP tools

未關閉
#1,705 28 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

documentation enhancement needs confirmation
主要語言
Python
星號
24.3k
分支
4k
平均合併
1 天 1 小時
30 天內合併 PR
31

描述

Description

Summary

MCP tools and resources built with the Python SDK can, by default, access the full file system, network, and environment of the host process. This is powerful but risky, especially when:

  • servers are installed from third parties, or
  • LLM agents can call tools based on prompt-injected instructions.

The SDK should clearly document this and provide hooks/patterns for limiting capabilities.

Proposal

  1. Document security considerations

    • Add a “Security considerations” section explicitly calling out:
      • file system access,
      • network access,
      • environment variables and credentials.
  2. Provide capability hooks

    • Offer configuration points or helper utilities to:
      • restrict file access to specific directories (allowlist),
      • restrict outbound network calls to certain hosts/domains,
      • prevent access to environment variables by default.
  3. Encourage process-level sandboxing

    • Provide guidance on running MCP servers in:
      • containers with minimal privileges,
      • separate processes with limited OS capabilities.

Why this matters

  • Defense in depth: Even if application code is careful, configuration mistakes or third-party code can introduce risk.
  • Prompt-injection mitigation: Restricting what tools can do reduces the impact of malicious prompts.
  • Operational guidance: Many users are new to MCP and benefit from clear security best practices.

Acceptance criteria

  • Documentation clearly describes the security implications of running MCP servers and tools.
  • There are example patterns for restricting file and network access.
  • Where feasible, the SDK exposes hooks or configuration points for capability control.
References

No response

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

未指定檔案或測試。首先檢視 SDK 現有的文件,以及 MCP 伺服器和工具的設定或擴充點,然後判斷是否能在不假設由作業系統層級強制執行的情況下新增能力控制。完成標準是:安全性指南、檔案和網路限制範例,以及可行的 hook 或設定點都已記錄,並由適當的驗證涵蓋。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
documentation, security
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
活躍
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。