Acceso a herramientas con privilegios mínimos
Conceda a cada herramienta solo los permisos que realmente necesita.
Acceso a herramientas con privilegios mínimos es una lección gratuita de MCP Academy en CoddyKit. Esta es la lección 2 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de MCP Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de MCP Academy incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
The Principle
Least privilege means each tool gets only the permissions its job requires, and nothing more. If a tool is tricked, the blast radius stays small. 🔒
Narrow the Scope
A tool that reads one report folder should not be able to touch the whole disk. Give it the smallest scope that still gets the work done, then stop there.
Read vs Write
Split read and write into separate tools when you can. A read-only tool that gets injected can leak data, but it cannot quietly change or delete anything.
Scope Credentials, Not Just Tools
Privilege also lives in the token your server holds. Use a database role or API key scoped to exactly the operations needed, so a slip cannot reach unscoped resources.
A Read-Only Tool
This tool can only look up an order, never modify one. The function body defines the ceiling on what the model can do through it.
@mcp.tool()
def get_order(order_id: int) -> str:
"Read one order by id."
return db.fetch_order(order_id)Avoid the God Tool
One run_anything tool that executes arbitrary code or SQL hands the model total control. Prefer many narrow tools with fixed, predictable behavior instead.
Allowlists Over Blocklists
Decide what is permitted, not what is forbidden. An allowlist of safe operations is far easier to reason about than trying to enumerate every dangerous one.
Constrain the Filesystem
If a tool reads files, pin it to one base directory and reject paths that escape it. A bounded root stops a tool from wandering into system files.
Separate Tools by Sensitivity
Keep low-risk lookups apart from high-risk actions. You can then apply stricter checks and confirmation to only the sensitive tools that truly need them.
Per-User Authorization
The server, not the model, decides who may do what. Check the caller's identity before acting so a tool cannot reach data outside that user's permissions.
Default Deny
Start every new tool from the assumption that it can do nothing, then grant exactly what it needs. A default-deny stance keeps accidental power from creeping in.
Quick Check
Pick the design that best follows least privilege.
Recap
Give each tool the smallest scope, split read from write, scope your credentials, and default to deny. Least privilege keeps any single mistake contained. ✅
Preguntas frecuentes
¿La lección «Acceso a herramientas con privilegios mínimos» es gratis?
Sí — el texto completo de «Acceso a herramientas con privilegios mínimos» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de MCP Academy, actualiza a CoddyKit PRO. El curso de MCP Academy incluye 4 lecciones en total.
¿Qué aprenderé en «Acceso a herramientas con privilegios mínimos»?
Conceda a cada herramienta solo los permisos que realmente necesita. Practicas MCP Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar MCP Academy?
No se requiere experiencia previa. MCP Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 2 de 4.
¿Cuánto tiempo toma la lección «Acceso a herramientas con privilegios mínimos»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de MCP Academy?
Sí. Cada lección de MCP Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Amenazas específicas de MCP
- Acceso a herramientas con privilegios mínimos
- Validar y sanear todo
- Proteger las acciones destructivas