modelcontextprotocol / modelcontextprotocol/python-sdk
Document and provide hooks for sandboxing file and network access in MCP tools
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 24.3k
- Forks
- 4k
- Merge moyen
- 1 j 1 h
- PR mergées (30 j)
- 31
Description
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
-
Document security considerations
- Add a “Security considerations” section explicitly calling out:
- file system access,
- network access,
- environment variables and credentials.
- Add a “Security considerations” section explicitly calling out:
-
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.
- Offer configuration points or helper utilities to:
-
Encourage process-level sandboxing
- Provide guidance on running MCP servers in:
- containers with minimal privileges,
- separate processes with limited OS capabilities.
- Provide guidance on running MCP servers in:
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Aucun fichier ni test n’est indiqué. Commencez par examiner la documentation existante du SDK ainsi que les points de configuration ou d’extension des serveurs et outils MCP, puis déterminez s’il est possible d’ajouter des contrôles de capacités sans supposer une application au niveau du système d’exploitation. Le travail est considéré comme terminé lorsque les recommandations de sécurité, les exemples de restrictions concernant les fichiers et le réseau, ainsi que les hooks ou points de configuration réalisables sont documentés et couverts par une validation appropriée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- documentation, security
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100