modelcontextprotocol / modelcontextprotocol/python-sdk

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

Offen
#1,705 28 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

documentation enhancement needs confirmation
Vorherrschende Sprache
Python
Sterne
24.3k
Forks
4k
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
31

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Es werden keine Dateien oder Tests genannt. Beginne damit, die bestehende Dokumentation des SDK sowie die Konfigurations- oder Erweiterungspunkte für MCP-Server und -Tools zu prüfen, und ermittle anschließend, ob sich Capability-Kontrollen hinzufügen lassen, ohne eine Durchsetzung auf Betriebssystemebene vorauszusetzen. Als abgeschlossen gilt die Arbeit, wenn Sicherheitsrichtlinien, Beispiele für Datei- und Netzwerkbeschränkungen sowie umsetzbare Hooks oder Konfigurationspunkte dokumentiert und durch geeignete Validierung abgedeckt sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation, security
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.