0Pricing
MCP Academy · Lección

Negociar capacidades

Compruebe qué funciones admiten ambas partes.

Negociar capacidades es una lección gratuita de MCP Academy en CoddyKit. Esta es la lección 3 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.

Not Everyone Speaks Every Feature

MCP is rich, but no client or server supports it all. So at startup both sides negotiate which features they have, like two devices agreeing on what they can do. 🤝

It Happens at Initialize

This deal is struck during the initialize handshake, the very first exchange. After it, each side knows what the other offers and what is off the table.

Two Capability Bundles

The client announces its clientCapabilities and the server announces its serverCapabilities. Each bundle is just a map of feature flags and small options.

What a Server Declares

A server lists what it provides: things like tools, resources, and prompts. If a key is absent, clients know not to expect that primitive from you.

"capabilities": { "tools": {}, "resources": {} }

What a Client Declares

A client lists features it can offer back, such as roots, sampling, and elicitation. That is how your server learns it may even ask for roots at all.

"capabilities": { "roots": {}, "sampling": {} }

Sub-flags Add Detail

A capability can hold extra options. For example, roots may carry listChanged: true, meaning the client will notify you when its root set changes.

"roots": { "listChanged": true }

Absence Means No

The rule is simple: if a capability is missing, treat the feature as unavailable. Never call something the other side never promised it could do.

Version Comes First

Alongside features, both sides send a protocolVersion. They must agree on a shared version, or the session is rejected before any real work begins.

The SDK Does the Heavy Lifting

You rarely build these maps by hand. The Python SDK fills in your server capabilities from the tools and resources you registered, then exchanges them for you.

Read the Other Side's Flags

After init, you can inspect the client capabilities your session captured. That check is exactly what guards an optional call like list_roots.

caps = ctx.session.client_params.capabilities

Negotiate Once, Trust Throughout

Capabilities are settled at startup and hold for the session. You can rely on them for the connection's life without re-negotiating on every call.

Quick Check

Recall when and how features get agreed on.

Recap: The Capability Deal

At initialize, client and server swap capability maps and a protocol version. A missing flag means unsupported, and the SDK builds and reads these for you. 🎯

Preguntas frecuentes

¿La lección «Negociar capacidades» es gratis?

Sí — el texto completo de «Negociar capacidades» 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 «Negociar capacidades»?

Compruebe qué funciones admiten ambas partes. 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 3 de 4.

¿Cuánto tiempo toma la lección «Negociar capacidades»?

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

  1. Qué indican las raíces a un servidor
  2. Solicitar las raíces del cliente
  3. Negociar capacidades
  4. Respetar los límites del cliente
← Volver a MCP Academy